feat(ml): coreml (#17718)

* coreml

* add test

* use arena by default in native installation

* fix tests

* add env to docs

* remove availability envs
This commit is contained in:
Mert 2025-10-14 13:51:31 -04:00 committed by GitHub
parent 43eccca86a
commit 1b62c2ef55
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 47 additions and 6 deletions

View file

@ -96,6 +96,14 @@ class OrtSession:
"precision": "FP32",
"cache_dir": (self.model_path.parent / "openvino").as_posix(),
}
case "CoreMLExecutionProvider":
options = {
"ModelFormat": "MLProgram",
"MLComputeUnits": "ALL",
"SpecializationStrategy": "FastPrediction",
"AllowLowPrecisionAccumulationOnGPU": "1",
"ModelCacheDirectory": (self.model_path.parent / "coreml").as_posix(),
}
case _:
options = {}
provider_options.append(options)
@ -115,7 +123,7 @@ class OrtSession:
@property
def _sess_options_default(self) -> ort.SessionOptions:
sess_options = ort.SessionOptions()
sess_options.enable_cpu_mem_arena = False
sess_options.enable_cpu_mem_arena = settings.model_arena
# avoid thread contention between models
if settings.model_inter_op_threads > 0: