Skip to content

Commit 3fe276e

Browse files
authored
Mitigate coremltool issue with python 3.13 (#11317)
1 parent 5ef38d3 commit 3fe276e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/source/backends-coreml.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ Note that if the ExecuTorch model has graph breaks, there may be multiple extrac
195195

196196
## Common issues and what to do
197197

198-
During lowering to the CoreML backend, you might see an error like: "ValueError: In op, of type [X], named [Y], the named input [Z] must have the same data type as the named input x. However, [Z] has dtype fp32 whereas x has dtype fp16."
198+
### During lowering
199+
1. "ValueError: In op, of type [X], named [Y], the named input [Z] must have the same data type as the named input x. However, [Z] has dtype fp32 whereas x has dtype fp16."
199200

200201
This happens because the model is in FP16, but CoreML interprets some of the arguments as FP32, which leads to a type mismatch. The solution is to keep the PyTorch model in FP32. Note that the model will be still be converted to FP16 during lowering to CoreML unless specified otherwise in the compute_precision [CoreML CompileSpec](#coreml-compilespec). Also see the [related issue in coremltools](https://github.com/apple/coremltools/issues/2480).
202+
203+
2. coremltools/converters/mil/backend/mil/load.py", line 499, in export
204+
raise RuntimeError("BlobWriter not loaded")
205+
206+
If you're using Python 3.13, try reducing your python version to Python 3.12. coremltools does not support Python 3.13, see this [issue](https://github.com/apple/coremltools/issues/2487).

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ classifiers = [
4949
]
5050

5151
# Python dependencies required for use.
52-
requires-python = ">=3.10"
52+
# coremltools has issue with python 3.13, see https://github.com/apple/coremltools/issues/2487
53+
requires-python = ">=3.10,<3.13"
5354
dependencies=[
5455
"expecttest",
5556
"flatbuffers",

0 commit comments

Comments
 (0)