issue

#2
by superAhmed91 - opened

I don't know if is there specific system information that the model fine tuned on or what but the model is not working correctly with me
I tried and here is my code

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_id = "bakrianoo/t5-arabic-small"
tokenizer = AutoTokenizer.from_pretrained( model_id, use_fast=False)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)
model.eval()

question = 'how many governerates on egypt?'

inputs = tokenizer(
      question,
      return_tensors="pt",
      truncation=True,
      max_length=128
)

with torch.inference_mode():
 output = model.generate(
            **inputs,
            max_new_tokens=48,
            num_beams=1,
            do_sample=False
 )

    answer = tokenizer.decode(
        output[0],
        skip_special_tokens=True
    )


print(answer)

and the answer was <extra_id_0>

Sign up or log in to comment