Unverified Commit c99e9846 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Fix Yolos ONNX export test (#18606)


Co-authored-by: default avatarlewtun <lewis.c.tunstall@gmail.com>
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent 358478e7
...@@ -284,6 +284,12 @@ class OnnxExportTestCaseV2(TestCase): ...@@ -284,6 +284,12 @@ class OnnxExportTestCaseV2(TestCase):
model_class = FeaturesManager.get_model_class_for_feature(feature) model_class = FeaturesManager.get_model_class_for_feature(feature)
config = AutoConfig.from_pretrained(model_name) config = AutoConfig.from_pretrained(model_name)
model = model_class.from_config(config) model = model_class.from_config(config)
# Dynamic axes aren't supported for YOLO-like models. This means they cannot be exported to ONNX on CUDA devices.
# See: https://github.com/ultralytics/yolov5/pull/8378
if model.__class__.__name__.startswith("Yolos") and device != "cpu":
return
onnx_config = onnx_config_class_constructor(model.config) onnx_config = onnx_config_class_constructor(model.config)
if is_torch_available(): if is_torch_available():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment