Skip to content

Commit

Permalink
Add ONNX export support for PVT
Browse files Browse the repository at this point in the history
  • Loading branch information
xenova committed Aug 30, 2024
1 parent 96afc91 commit 844aa66
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/source/exporters/onnx/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Supported architectures from [🤗 Transformers](https://huggingface.co/docs/tra
- Phi3
- Pix2Struct
- PoolFormer
- PVT
- Qwen2(Qwen1.5)
- RegNet
- ResNet
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 @@ -776,6 +776,10 @@ class HieraOnnxConfig(ViTOnnxConfig):
DEFAULT_ONNX_OPSET = 11


class PvtOnnxConfig(ViTOnnxConfig):
DEFAULT_ONNX_OPSET = 11


class Dinov2DummyInputGenerator(DummyVisionInputGenerator):
def __init__(
self,
Expand Down
5 changes: 5 additions & 0 deletions optimum/exporters/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,11 @@ class TasksManager:
"image-classification",
onnx="PoolFormerOnnxConfig",
),
"pvt": supported_tasks_mapping(
"feature-extraction",
"image-classification",
onnx="PvtOnnxConfig",
),
"regnet": supported_tasks_mapping(
"feature-extraction",
"image-classification",
Expand Down
2 changes: 2 additions & 0 deletions tests/exporters/exporters_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"pix2struct": "fxmarty/pix2struct-tiny-random",
# "rembert": "google/rembert",
"poolformer": "hf-internal-testing/tiny-random-PoolFormerModel",
"pvt": "hf-internal-testing/tiny-random-PvtForImageClassification",
"qwen2": "fxmarty/tiny-dummy-qwen2",
"regnet": "hf-internal-testing/tiny-random-RegNetModel",
"resnet": "hf-internal-testing/tiny-random-resnet",
Expand Down Expand Up @@ -264,6 +265,7 @@
"perceiver": "hf-internal-testing/tiny-random-PerceiverModel", # Not using deepmind/language-perceiver because it takes too much time for testing.
# "rembert": "google/rembert",
"poolformer": "hf-internal-testing/tiny-random-PoolFormerModel",
"pvt": "hf-internal-testing/tiny-random-PvtForImageClassification",
"regnet": "facebook/regnet-y-040",
"resnet": "microsoft/resnet-50",
"roberta": "roberta-base",
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 @@ -133,6 +133,7 @@
"phi3": "Xenova/tiny-random-Phi3ForCausalLM",
"pix2struct": "fxmarty/pix2struct-tiny-random",
"poolformer": "hf-internal-testing/tiny-random-PoolFormerModel",
"pvt": "hf-internal-testing/tiny-random-PvtForImageClassification",
"qwen2": "fxmarty/tiny-dummy-qwen2",
"resnet": "hf-internal-testing/tiny-random-resnet",
"roberta": "hf-internal-testing/tiny-random-RobertaModel",
Expand Down

0 comments on commit 844aa66

Please sign in to comment.