Error: RuntimeError: expected mat1 nd mat2 to have the same dtype, but got: float != c10::BFloat16

#39
by Iamexperimenting - opened

Hi team,

I'm following this blog https://huggingface.co./blog/gemma-peft,

while runing the below line

text = "Quote: Imagination is"
device = "cuda:0"
inputs = tokenizer(text, return_tensors="pt").to(device)

outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

I get the following error,

RuntimeError: expected mat1 nd mat2 to have the same dtype, but got: float != c10::BFloat16
@ybelkada @suryabhupa

Hi @Iamexperimenting
Hmm, what is your transformers version? Can you try with transformers latest version on pypi? pip install -U transformers

@ybelkada , my transformers version is 4.38.2

@ybelkada @suryabhupa can you please tell whether do I need to upgrade or downrgrade?

Hi @Iamexperimenting

This should not happen in the latest transformers release, can you share with us the full snippet?

its working, thanks. I will close it.

Iamexperimenting changed discussion status to closed

Sign up or log in to comment