Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add convnextv2 onnx export #1560

Merged
merged 1 commit into from
Dec 5, 2023
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
1 change: 1 addition & 0 deletions docs/source/exporters/onnx/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Supported architectures:
- CodeGen
- ConvBert
- ConvNext
- ConvNextV2
- Data2VecAudio
- Data2VecText
- Data2VecVision
Expand Down
4 changes: 4 additions & 0 deletions optimum/exporters/onnx/model_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,10 @@ class ConvNextOnnxConfig(ViTOnnxConfig):
pass


class ConvNextV2OnnxConfig(ViTOnnxConfig):
pass


class MobileViTOnnxConfig(ViTOnnxConfig):
ATOL_FOR_VALIDATION = 1e-4

Expand Down
5 changes: 5 additions & 0 deletions optimum/exporters/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@ class TasksManager:
"image-classification",
onnx="ConvNextOnnxConfig",
),
"convnextv2": supported_tasks_mapping(
"feature-extraction",
"image-classification",
onnx="ConvNextV2OnnxConfig",
),
"cvt": supported_tasks_mapping("feature-extraction", "image-classification", onnx="CvTOnnxConfig"),
"data2vec-text": supported_tasks_mapping(
"feature-extraction",
Expand Down
2 changes: 1 addition & 1 deletion optimum/onnxruntime/modeling_ort.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def forward(
@add_end_docstrings(ONNX_MODEL_END_DOCSTRING)
class ORTModelForImageClassification(ORTModel):
"""
ONNX Model for image-classification tasks. This class officially supports beit, convnext, data2vec_vision, deit, levit, mobilenet_v1, mobilenet_v2, mobilevit, poolformer, resnet, segformer, swin, vit.
ONNX Model for image-classification tasks. This class officially supports beit, convnext, convnextv2, data2vec_vision, deit, levit, mobilenet_v1, mobilenet_v2, mobilevit, poolformer, resnet, segformer, swin, vit.
"""

auto_model_class = AutoModelForImageClassification
Expand Down
1 change: 1 addition & 0 deletions optimum/utils/normalized_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class NormalizedConfigManager:
'clip',
'convbert',
'convnext',
'convnextv2',
'data2vec-text',
'data2vec-vision',
'detr',
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 @@ -53,6 +53,7 @@
"clip": "hf-internal-testing/tiny-random-CLIPModel",
"convbert": "hf-internal-testing/tiny-random-ConvBertModel",
"convnext": "hf-internal-testing/tiny-random-convnext",
"convnextv2": "hf-internal-testing/tiny-random-ConvNextV2Model",
"codegen": "hf-internal-testing/tiny-random-CodeGenModel",
"cvt": "hf-internal-testing/tiny-random-CvTModel",
"data2vec-text": "hf-internal-testing/tiny-random-Data2VecTextModel",
Expand Down
1 change: 1 addition & 0 deletions tests/onnxruntime/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,7 @@ class ORTModelForImageClassificationIntegrationTest(ORTModelTestMixin):
SUPPORTED_ARCHITECTURES = [
"beit",
"convnext",
"convnextv2",
"data2vec_vision",
"deit",
"levit",
Expand Down
1 change: 1 addition & 0 deletions tests/onnxruntime/utils_onnxruntime_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"clip": "hf-internal-testing/tiny-random-CLIPModel",
"convbert": "hf-internal-testing/tiny-random-ConvBertModel",
"convnext": "hf-internal-testing/tiny-random-convnext",
"convnextv2": "hf-internal-testing/tiny-random-ConvNextV2Model",
"codegen": "hf-internal-testing/tiny-random-CodeGenForCausalLM",
"data2vec_text": "hf-internal-testing/tiny-random-Data2VecTextModel",
"data2vec_vision": "hf-internal-testing/tiny-random-Data2VecVisionModel",
Expand Down
Loading