Converted pytorch model to onnx does not work correctly
I converted pretrained 'Rostlab/prot_bert_bfd' @ huggingface to onnx, then tried to convert a checkpoint from fine tuning of the pretrained model. Comparing to pretrained model, conversion of fine tuned model generated a lot of warnings. Basically the warnings said that parameters from first to last layer were not initialized. The converted model did not work correctly. 

This is how I called the conversion module:

python3 -m transformers.convert_graph_to_onnx --model Rostlab/prot_bert_bfd --framework pt prot_bert_bfd.onnx
I did similarly for checkpoint model.

Does the module work on checkpoint?



This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.<|||||>> I converted pretrained 'Rostlab/prot_bert_bfd' @ huggingface to onnx, then tried to convert a checkpoint from fine tuning of the pretrained model. Comparing to pretrained model, conversion of fine tuned model generated a lot of warnings. Basically the warnings said that parameters from first to last layer were not initialized. The converted model did not work correctly.
> 
> This is how I called the conversion module:
> 
> python3 -m transformers.convert_graph_to_onnx --model Rostlab/prot_bert_bfd --framework pt prot_bert_bfd.onnx
> I did similarly for checkpoint model.
> 
> Does the module work on checkpoint?

Hello @yzhang-github-pub ,I have used the same line of code as you did for a PEGASUS model on colab:
`!python3 -m transformers.convert_graph_to_onnx --model jpcorb20/pegasus-large-reddit_tifu-samsum-256 --framework pt pegasus-large-reddit_tifu-samsum-256.onnx`
**The following error keeps showing and the coversion fails. Can you please tell me how did you solve this problem??**
**The error:**

> Some weights of the model checkpoint at jpcorb20/pegasus-large-reddit_tifu-samsum-256 were not used when initializing PegasusModel: ['final_logits_bias', 'lm_head.weight']

> - This IS expected if you are initializing PegasusModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
> - This IS NOT expected if you are initializing PegasusModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
> Downloading: 100% 1.50k/1.50k [00:00<00:00, 1.29MB/s]
> Downloading: 100% 1.91M/1.91M [00:01<00:00, 1.12MB/s]
> Downloading: 100% 1.34k/1.34k [00:00<00:00, 1.18MB/s]
> Error while converting the model: Folder /content is not empty, aborting conversion<|||||>I wrote a script to do onnx conversion, by importing onnx and onnxruntime modules. I heard some versions of transformer have bugs in onnx conversion and model loading. 
