Error while loading the xl model.

#8
by mahyar10 - opened
# pip install accelerate
import torch
from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained("google/flan-t5-xl")
model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-xl", device_map="auto", torch_dtype=torch.float16)

input_text = "translate English to German: How old are you?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))

raises this error:

OSError: google/flan-t5-xl does not appear to have a file named pytorch_model.bin, tf_model.h5, model.ckpt or flax_model.msgpack.```

Works fine for the small model.

Hi @mahyar10
What is your transformers version? I suspect you are using a previous version that does not support model sharding

My version was 4.16.2 but after upgrading to 4.25.1, it works fine. Thanks!

mahyar10 changed discussion status to closed

Sign up or log in to comment