wrong output?

#4
by szhf - opened

I ran the example codes:

from transformers import AutoTokenizer, MT5ForConditionalGeneration
tokenizer = AutoTokenizer.from_pretrained("mt5-small")
model = MT5ForConditionalGeneration.from_pretrained("mt5-small")

training

input_ids = tokenizer("The walks in park", return_tensors="pt").input_ids
labels = tokenizer(" cute dog the ", return_tensors="pt").input_ids
outputs = model(input_ids=input_ids, labels=labels)
loss = outputs.loss
logits = outputs.logits

inference

input_ids = tokenizer(
"summarize: studies have shown that owning a dog is good for you", return_tensors="pt"
).input_ids # Batch size 1
outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# studies have shown that owning a dog is good for you.

But got something like this:

Is this an expected outcome?

I can't see the result you got.
And I got "401 Client Error: Unauthorized for url: https://huggingface.co/mt5-small/resolve/main/config.json" error when import pretrained model.

Sign up or log in to comment