I am trying to get a PyTorch trace for the facebook/m2m100_418M. But I run into an error
You have to specify either decoder_input_ids or decoder_inputs_embeds. I think the issue is that I do not give outputs, but I don’t know how to do that. Since it is multiple languages. There are several translations for ''Hello world" from one language to another. So here is what I tried so far.
! pip install transformers datasets import torch import numpy as np from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer !pip install sentencepiece model_name = "facebook/m2m100_418M" model = M2M100ForConditionalGeneration.from_pretrained(model_name) tokenizer = M2M100Tokenizer.from_pretrained(model_name) model.eval() example_text = "Hello, world!" tokenizer.src_lang = "en" example_input = tokenizer(example_text, return_tensors="pt").input_ids traced_model = torch.jit.trace(model, example_input)