Weird output based on example code

#18
by mark100 - opened

Hi all,

I run the example code below on my end:

import torch
from transformers import pipeline

pipe = pipeline(
"text-generation",
model="google/gemma-2-2b",
device="cuda", # replace with "mps" to run on a Mac device
)

text = "Once upon a time,"
outputs = pipe(text, max_new_tokens=256)
response = outputs[0]["generated_text"]
print(response)

but got some weird output

Once upon a time, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and, and,

Anything wrong here? Does anyone get similar output like me?

Google org

Hi @mark100 , I tried replicating the error and did not find the issue. Could you please check by upgrading the transformers version using !pip install -U transformers and let us know if the issue still persists. Thank you.

Same problem here.

Google org

Please have a look at the below output when I tried replicating the issue in Kaggle using GPU T4*2 as well as using Colab Enterprise (T4 * 4). Also, the pre-trained model are not trained for any specific task which might cause output inconsistency. You can use Instruction tuned model instead to have better output.
Screenshot 2024-10-18 at 11.22.09 AM.png

Sign up or log in to comment