Skip to content

Commit

Permalink
add pegasus exporters
Browse files Browse the repository at this point in the history
  • Loading branch information
mht-sharma committed Jan 2, 2023
1 parent 9ac1703 commit e722dbd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ They specify which input generators should be used for the dummy inputs, but rem
- MobileBert
- MobileVit
- OwlVit
- Pegasus
- Perceiver
- PoolFormer
- 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 @@ -447,6 +447,10 @@ def generate_dummy_inputs_for_validation(self, reference_model_inputs: Mapping[s
return super().generate_dummy_inputs_for_validation(reference_model_inputs)


class PegasusOnnxConfig(BartOnnxConfig):
pass


class MarianOnnxConfig(BartOnnxConfig):
pass

Expand Down
9 changes: 9 additions & 0 deletions optimum/exporters/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,15 @@ class TasksManager:
# "zero-shot-object-detection",
# onnx="OwlViTOnnxConfig",
# ),
"pegasus": supported_tasks_mapping(
"default",
"default-with-past",
"causal-lm",
"causal-lm-with-past",
"seq2seq-lm",
"seq2seq-lm-with-past",
onnx="PegasusOnnxConfig",
),
"perceiver": supported_tasks_mapping(
"masked-lm",
"image-classification",
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 @@ -192,6 +192,7 @@ class NormalizedConfigManager:
"mbart": BartLikeNormalizedTextConfig,
"mt5": T5LikeNormalizedTextConfig,
"m2m_100": BartLikeNormalizedTextConfig,
"pegasus": BartLikeNormalizedTextConfig,
"poolformer": NormalizedVisionConfig,
"resnet": NormalizedVisionConfig,
"roberta": NormalizedTextConfig,
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 @@ -69,6 +69,7 @@
"mobilevit": "hf-internal-testing/tiny-random-mobilevit",
"mt5": "lewtun/tiny-random-mt5",
# "owlvit": "google/owlvit-base-patch32",
"pegasus": "hf-internal-testing/tiny-random-PegasusModel",
"perceiver": {
"hf-internal-testing/tiny-random-language_perceiver": ["masked-lm", "sequence-classification"],
"hf-internal-testing/tiny-random-vision_perceiver_conv": ["image-classification"],
Expand Down

0 comments on commit e722dbd

Please sign in to comment.