text: 
  
  TITLE
  Converting PyTorch to ONNX model doubles file size for Deberta v3. Not case of renaming.
  
  COMMENTS
  1
  
  REACTIONS
  +1: 0
  -1: 0
  laugh: 0
  hooray: 0
  heart: 0
  rocket: 0
  eyes: 0
  
  BODY
  ### System Info
  
  ```shell
  - OS Platform and Distribution: Amazon Linux 2
  - ONNX version 1.11.0 
  - Python version: 3.8
  - Transformers 4.17
  ```
  
  
  ### Who can help?
  
  @LysandreJik, @patil-suraj
  
  ### Describe the bug
  When I try and convert `microsoft/deberta-v3-large` to onnx format, the file size doubles to 1.8Gb while the pytorch file size is 800Mb. 
  There was an issue [here](https://github.com/onnx/onnx/issues/3278#issuecomment-781948998) that was resolved by removing the duplication of weights. However, trying this code snippet in the deberta case only reduced the file size from 1.8Gb to 1.6Gb.
  
  
  ### Information
  
  - [ ] The official example scripts
  - [X] My own modified scripts
  
  ### Tasks
  
  - [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
  - [ ] My own task or dataset (give details below)
  
  ### Reproduction
  
  
  ```
  from collections import OrderedDict
  from typing import Mapping
  from pathlib import Path
  from transformers.onnx import export
  from transformers.onnx import OnnxConfig
  from transformers import AutoTokenizer, AutoModel, AutoConfig
  
  onnx_path = Path("deberta.onnx")
  
  class DebertaConfig(OnnxConfig):
      @property
      def inputs(self) -> Mapping[str, Mapping[int, str]]:
          return OrderedDict(
              [
                  ("input_ids", {0: "batch", 1: "sequence"}),
                  ("attention_mask", {0: "batch", 1: "sequence"}),
                  ("token_type_ids", {0: "batch", 1: "sequence"}),
              ]
          )
  
  config = AutoConfig.from_pretrained("microsoft/deberta-v3-large")
  
  base_model = AutoModel.from_pretrained("microsoft/deberta-v3-large")
  tokenizer = AutoTokenizer.from_pretrained("microsoft/deberta-v3-large")
  onnx_config = DebertaConfig(config)
  onnx_inputs, onnx_outputs = export(tokenizer, base_model, onnx_config, 15, onnx_path)
  ```
  
  ### Expected behavior
  
  ```shell
  Expect the model.onnx file to be ~800Mb like the pytorch file.
  ```
  