Model generates only one sentence

#2
by SinfulDragon - opened

Hello, I try your model, and it's generated only one sentence, even if I wrote more than one in the input parameters.

from transformers import T5ForConditionalGeneration, T5Tokenizer
import gc
import torch

#device = 'cuda'
device = 'cpu'

model_name = 'utrobinmv/t5_translate_en_ru_zh_large_1024_v2'
model = T5ForConditionalGeneration.from_pretrained(model_name)
model.eval()
model.to(device)
tokenizer = T5Tokenizer.from_pretrained(model_name)

prefix = 'translate to en: '
src_text = prefix + "Съешь ещё этих мягких французских булок. Они очень вкусные!"

input_ids = tokenizer(src_text, return_tensors="pt")

generated_tokens = model.generate(**input_ids.to(device))
result = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
print(result)

The output is:

Eat more of these soft French buns.

Они что, не вкусные? :(
I am new to LM and I have not been able to solve the problem, although I tried to play with the config a little bit, but nothing came up

Sign up or log in to comment