Skip to content

Commit aac8b1d

Browse files
Uncomment modernbert config (#2155)
* uncomment modernbert * Update optimum/exporters/onnx/model_configs.py
1 parent c46de05 commit aac8b1d

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

optimum/exporters/onnx/model_configs.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ def inputs(self) -> Dict[str, Dict[int, str]]:
183183
return {"input_ids": dynamic_axis, "attention_mask": dynamic_axis}
184184

185185

186-
# TODO: uncomment when transformers>=4.48.0
187-
# class ModernBertOnnxConfig(DistilBertOnnxConfig):
188-
# pass
186+
class ModernBertOnnxConfig(DistilBertOnnxConfig):
187+
MIN_TRANSFORMERS_VERSION = version.parse("4.48.0")
189188

190189

191190
class MPNetOnnxConfig(DistilBertOnnxConfig):

optimum/exporters/tasks.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -893,15 +893,15 @@ class TasksManager:
893893
"image-classification",
894894
onnx="MobileNetV2OnnxConfig",
895895
),
896-
# "modernbert": supported_tasks_mapping(
897-
# "feature-extraction",
898-
# "fill-mask",
899-
# "text-classification",
900-
# "multiple-choice",
901-
# "token-classification",
902-
# "question-answering",
903-
# onnx="ModernBertOnnxConfig",
904-
# ),
896+
"modernbert": supported_tasks_mapping(
897+
"feature-extraction",
898+
"fill-mask",
899+
"text-classification",
900+
"multiple-choice",
901+
"token-classification",
902+
"question-answering",
903+
onnx="ModernBertOnnxConfig",
904+
),
905905
"mpnet": supported_tasks_mapping(
906906
"feature-extraction",
907907
"fill-mask",

tests/exporters/exporters_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"mobilenet-v2": "hf-internal-testing/tiny-random-MobileNetV2Model",
126126
"mobilenet-v1": "google/mobilenet_v1_0.75_192",
127127
"mobilevit": "hf-internal-testing/tiny-random-mobilevit",
128-
# "modernbert": "hf-internal-testing/tiny-random-ModernBertForMaskedLM",
128+
"modernbert": "hf-internal-testing/tiny-random-ModernBertForMaskedLM",
129129
"mpnet": "hf-internal-testing/tiny-random-MPNetModel",
130130
"mpt": "hf-internal-testing/tiny-random-MptForCausalLM",
131131
"mt5": "lewtun/tiny-random-mt5",
@@ -269,7 +269,7 @@
269269
# "mobilenet_v1": "google/mobilenet_v1_0.75_192",
270270
# "mobilenet_v2": "google/mobilenet_v2_0.35_96",
271271
"mobilevit": "apple/mobilevit-small",
272-
# "modernbert": "answerdotai/ModernBERT-base",
272+
"modernbert": "answerdotai/ModernBERT-base",
273273
"mpt": "mosaicml/mpt-7b",
274274
"mt5": "lewtun/tiny-random-mt5", # Not using google/mt5-small because it takes too much time for testing.
275275
"musicgen": "facebook/musicgen-small",

0 commit comments

Comments
 (0)