There was an excellent NMT tutorial given during NeurIPS 18.
How does one convert this model to ONNX?
I was trying torch.onnx.export( ),
but what is the model name and how to specify the input considering the code snippet below:
Thanks!
import urllib
url = “https://download.pytorch.org/models/translate/iwslt14/neurips_tutorial_seq2seq.pt 4”
pretrained_model_name = “neurips_tutorial_seq2seq.pt”
urllib.request.urlretrieve(url, pretrained_model_name)
seq2seq_pretrained = LstmSeq2Seq(
encoder_embed_dim=128,
decoder_embed_dim=128,
hidden_dim=256,
src_dict=src_dict,
trg_dict=trg_dict,
)
seq2seq_pretrained.load_state_dict(torch.load(pretrained_model_name))
beam_search_pretrained = BeamSearch(seq2seq_pretrained, 5)
Now:
decode(“meine freunde”, beam_search_pretrained, src_dict, trg_dict, 5)
gives “my friends”