Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ class RemBertOnnxConfig(BertOnnxConfig):
DEFAULT_ONNX_OPSET = 11


class MegatronBertOnnxConfig(BertOnnxConfig):
DEFAULT_ONNX_OPSET = 11


class DistilBertOnnxConfig(BertOnnxConfig):
DEFAULT_ONNX_OPSET = 14 # now uses F.scaled_dot_product_attention by default for transformers>=4.46.0

Expand Down
9 changes: 9 additions & 0 deletions optimum/exporters/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,15 @@ class TasksManager:
onnx="MobileBertOnnxConfig",
tflite="MobileBertTFLiteConfig",
),
"megatron-bert": supported_tasks_mapping(
"feature-extraction",
"fill-mask",
"text-classification",
"multiple-choice",
"token-classification",
"question-answering",
onnx="MegatronBertOnnxConfig",
),
"mobilevit": supported_tasks_mapping(
"feature-extraction",
"image-classification",
Expand Down
1 change: 1 addition & 0 deletions tests/exporters/exporters_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
"hf-internal-testing/tiny-random-UniSpeechSatForXVector": ["audio-xvector"],
},
"audio-spectrogram-transformer": "Ericwang/tiny-random-ast",
"megatron-bert": "hf-internal-testing/tiny-random-MegatronBertModel",
# Disabled for now because some operator seems to not be supported by ONNX.
# "mctct": "hf-internal-testing/tiny-random-MCTCTModel",
"speech-to-text": "hf-internal-testing/tiny-random-Speech2TextModel",
Expand Down