diff --git a/pyproject.toml b/pyproject.toml index abad4046..12c4faa9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,7 +92,8 @@ dev = [ ] export = [ "numpy<2.0.0", # TF 2.20 compatibility - "onnx>=1.12.0,<1.18.0", # ONNX export + "onnx>=1.12.0; platform_system != 'Darwin'", # ONNX export + "onnx>=1.12.0,<1.18.0; platform_system == 'Darwin'", # TF inference hanging on MacOS "coremltools>=8.0; platform_system != 'Windows' and python_version <= '3.13'", # CoreML supported on macOS and Linux "scikit-learn>=1.3.2; platform_system != 'Windows' and python_version <= '3.13'", # CoreML k-means quantization "openvino>=2024.0.0", # OpenVINO export diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 5876258f..f7ab4eb3 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -582,9 +582,9 @@ class Exporter: @try_export def export_onnx(self, prefix=colorstr("ONNX:")): """Export YOLO model to ONNX format.""" - requirements = ["onnx>=1.12.0,<1.18.0"] + requirements = ["onnx>=1.12.0"] if self.args.simplify: - requirements += ["onnxslim>=0.1.59", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")] + requirements += ["onnxslim>=0.1.65", "onnxruntime" + ("-gpu" if torch.cuda.is_available() else "")] check_requirements(requirements) import onnx # noqa @@ -960,9 +960,9 @@ class Exporter: "sng4onnx>=1.0.1", # required by 'onnx2tf' package "onnx_graphsurgeon>=0.3.26", # required by 'onnx2tf' package "ai-edge-litert>=1.2.0,<1.4.0", # required by 'onnx2tf' package - "onnx>=1.12.0,<1.18.0", + "onnx>=1.12.0", "onnx2tf>=1.26.3", - "onnxslim>=0.1.59", + "onnxslim>=0.1.65", "onnxruntime-gpu" if cuda else "onnxruntime", "protobuf>=5", ),