I am trying to load the translation pre-trained model (German-English) from http://opennmt.net/Models-py/ and put it into a model object rather than loading the state_dict. The reason is that I am doing a research about model interpretability and I would like to access the embedding layer of the model.
However, I am not sure which encoder and which decoder as well as model parameters (bidirectional or not, n_layers) are used to train the pretrained-model.
Essentially, I want to load the state_dict into an model object and be able to see something like this:
Seq2Seq( (encoder): Encoder( (embedding): Embedding(7855, 256) (rnn): LSTM(256, 512, num_layers=2, dropout=0.5) (dropout): Dropout(p=0.5, inplace=False) ) (decoder): Decoder( (embedding): Embedding(5893, 256) (rnn): LSTM(256, 512, num_layers=2, dropout=0.5) (linear): Linear(in_features=512, out_features=5893, bias=True) (dropout): Dropout(p=0.5, inplace=False) ) )
Thanks. If anyone could help me with it, that would be great!