diff --git a/optimum/exporters/tasks.py b/optimum/exporters/tasks.py index 584b2d6378b..242f85ab301 100644 --- a/optimum/exporters/tasks.py +++ b/optimum/exporters/tasks.py @@ -1399,9 +1399,11 @@ def _infer_task_from_model_name_or_path( inferred_task_name = "image-classification" else: pipeline_tag = getattr(model_info, "pipeline_tag", None) - # conversational is not a supported task per se, just an alias that may map to - # text-generaton or text2text-generation - if pipeline_tag is not None and pipeline_tag != "conversational": + # The Hub task "conversational" is not a supported task per se, just an alias that may map to + # text-generaton or text2text-generation. + # The Hub task "object-detection" is not a supported task per se, as in Transformers this may map to either + # zero-shot-object-detection or object-detection. + if pipeline_tag is not None and pipeline_tag not in ["conversational", "object-detection"]: inferred_task_name = TasksManager.map_from_synonym(model_info.pipeline_tag) else: transformers_info = model_info.transformersInfo