Ziwei Zhou
Ziwei Zhou

Reputation: 1

Simple Transformers: loading a fine tuned Seq2Seq MarianMT model gives wrong predictions

Loading a fine tuned Seq2Seq MarianMT model gives wrong predictions

I initialized and trained the following model:

model = Seq2SeqModel(
    encoder_decoder_type="marian",
    encoder_decoder_name="Helsinki-NLP/opus-mt-en-mul",
    args=model_args,
    use_cuda=True,
)

After training, model.predict(['this is a test']) gives me desired output. However, when I loaded back this model to make prediction. The output is off:

from transformers import MarianMTModel
my_model = MarianMTModel.from_pretrained('outputs/best_model')

translated = my_model.generate(**tokenizer(['this is a test'], return_tensors="pt", padding=True))
[tokenizer.decode(t, skip_special_tokens=True) for t in translated]

Anything i missed?

Upvotes: 0

Views: 12

Answers (0)

Related Questions