File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1061,6 +1061,16 @@ def patch_model_for_export(
1061
1061
return MgpstrModelPatcher (self , model , model_kwargs = model_kwargs )
1062
1062
1063
1063
1064
+ class EfficientNetOnnxConfig (ViTOnnxConfig ):
1065
+ @property
1066
+ def outputs (self ) -> Dict [str , Dict [int , str ]]:
1067
+ common_outputs = super ().outputs
1068
+
1069
+ if self .task == "image-classification" :
1070
+ common_outputs ["logits" ] = {0 : "batch_size" , 1 : "num_classes" }
1071
+
1072
+ return common_outputs
1073
+
1064
1074
class SentenceTransformersTransformerOnnxConfig (TextEncoderOnnxConfig ):
1065
1075
NORMALIZED_CONFIG_CLASS = NormalizedTextConfig
1066
1076
DEFAULT_ONNX_OPSET = 14 # Some bottleneck transformers models require a specific ONNX opset to be successfully exported. We put a rather high opset here for the export to work for all architectures.
Original file line number Diff line number Diff line change @@ -639,6 +639,11 @@ class TasksManager:
639
639
"semantic-segmentation" ,
640
640
onnx = "DptOnnxConfig" ,
641
641
),
642
+ "efficientnet" : supported_tasks_mapping (
643
+ "feature-extraction" ,
644
+ "image-classification" ,
645
+ onnx = "EfficientNetOnnxConfig" ,
646
+ ),
642
647
"electra" : supported_tasks_mapping (
643
648
"feature-extraction" ,
644
649
"fill-mask" ,
Original file line number Diff line number Diff line change 77
77
"detr" : "hf-internal-testing/tiny-random-DetrModel" ,
78
78
"distilbert" : "hf-internal-testing/tiny-random-DistilBertModel" ,
79
79
"dpt" : "hf-internal-testing/tiny-random-DPTModel" ,
80
+ "efficientnet" : {
81
+ "hf-internal-testing/tiny-random-EfficientNetModel" : ["feature-extraction" ],
82
+ "hf-internal-testing/tiny-random-EfficientNetForImageClassification" : ["image-classification" ],
83
+ },
80
84
"electra" : "hf-internal-testing/tiny-random-ElectraModel" ,
81
85
"encoder-decoder" : {
82
86
"hf-internal-testing/tiny-random-EncoderDecoderModel-bert-bert" : [
You can’t perform that action at this time.
0 commit comments