fix: 🐞 update coreml exports and executorch update (#22872)
Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Laughing-q <1185102784@qq.com>
This commit is contained in:
parent
73d658d460
commit
776f8dbdfe
@ -91,7 +91,7 @@ export = [
|
||||
"numpy<2.0.0", # TF 2.20 compatibility
|
||||
"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
|
||||
"coremltools>=9.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
|
||||
"tensorflow>=2.0.0,<=2.19.0", # TF bug https://github.com/ultralytics/ultralytics/issues/5161
|
||||
|
||||
@ -860,7 +860,9 @@ class Exporter:
|
||||
def export_coreml(self, prefix=colorstr("CoreML:")):
|
||||
"""Export YOLO model to CoreML format."""
|
||||
mlmodel = self.args.format.lower() == "mlmodel" # legacy *.mlmodel export format requested
|
||||
check_requirements("coremltools>=8.0")
|
||||
check_requirements(
|
||||
["coremltools>=9.0", "numpy>=1.14.5,<=2.3.5"]
|
||||
) # latest numpy 2.4.0rc1 breaks coremltools exports
|
||||
import coremltools as ct
|
||||
|
||||
LOGGER.info(f"\n{prefix} starting export with coremltools {ct.__version__}...")
|
||||
@ -1088,7 +1090,7 @@ class Exporter:
|
||||
# TorchAO release compatibility table bug https://github.com/pytorch/ao/issues/2919
|
||||
# Setuptools bug: https://github.com/pypa/setuptools/issues/4483
|
||||
check_requirements("setuptools<71.0.0") # Setuptools bug: https://github.com/pypa/setuptools/issues/4483
|
||||
check_requirements(("executorch==1.0.0", "flatbuffers"))
|
||||
check_requirements(("executorch==1.0.1", "flatbuffers"))
|
||||
|
||||
import torch
|
||||
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
|
||||
|
||||
@ -400,7 +400,9 @@ class AutoBackend(nn.Module):
|
||||
|
||||
# CoreML
|
||||
elif coreml:
|
||||
check_requirements("coremltools>=8.0")
|
||||
check_requirements(
|
||||
["coremltools>=9.0", "numpy>=1.14.5,<=2.3.5"]
|
||||
) # latest numpy 2.4.0rc1 breaks coremltools exports
|
||||
LOGGER.info(f"Loading {w} for CoreML inference...")
|
||||
import coremltools as ct
|
||||
|
||||
@ -573,7 +575,7 @@ class AutoBackend(nn.Module):
|
||||
LOGGER.info(f"Loading {w} for ExecuTorch inference...")
|
||||
# TorchAO release compatibility table bug https://github.com/pytorch/ao/issues/2919
|
||||
check_requirements("setuptools<71.0.0") # Setuptools bug: https://github.com/pypa/setuptools/issues/4483
|
||||
check_requirements(("executorch==1.0.0", "flatbuffers"))
|
||||
check_requirements(("executorch==1.0.1", "flatbuffers"))
|
||||
from executorch.runtime import Runtime
|
||||
|
||||
w = Path(w)
|
||||
|
||||
@ -410,7 +410,7 @@ def check_requirements(requirements=ROOT.parent / "requirements.txt", exclude=()
|
||||
if use_uv:
|
||||
base = (
|
||||
f"uv pip install --no-cache-dir {packages} {commands} "
|
||||
f"--index-strategy=unsafe-best-match --break-system-packages --prerelease=allow"
|
||||
f"--index-strategy=unsafe-best-match --break-system-packages"
|
||||
)
|
||||
try:
|
||||
return subprocess.check_output(base, shell=True, stderr=subprocess.STDOUT, text=True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user