mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 03:01:07 +06:00
Fix Yolos ONNX export test (#18606)
Co-authored-by: lewtun <lewis.c.tunstall@gmail.com> Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
parent
358478e729
commit
c99e984657
@ -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():
|
||||||
|
Loading…
Reference in New Issue
Block a user