]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
coreml : fix --quantize crash for mlprogram format; fix --optimize-ane label (#3868)
authorChristopher Albert <redacted>
Tue, 9 Jun 2026 06:34:31 +0000 (08:34 +0200)
committerGitHub <redacted>
Tue, 9 Jun 2026 06:34:31 +0000 (08:34 +0200)
commitba573929cd31ddea3c77c5dc9caae78da8117123
tree8ea1aae9cc62409718b46d105b9818a672af6790
parent84bd03a438454a82150853dce83818013c6609d2
coreml : fix --quantize crash for mlprogram format; fix --optimize-ane label (#3868)

commit 8b92060 switched ct.convert() to mlprogram, but did not update
the --quantize path.  quantize_weights() from
neural_network.quantization_utils only works with the legacy
neuralnetwork format.  Running with --quantize crashed with:

  Exception: MLModel of type mlProgram cannot be loaded just from the
  model spec object. It also needs the path to the weights file.

Fix: pass compute_precision=ct.precision.FLOAT16 into ct.convert() when
--quantize is set.  This matches the original intent of nbits=16 (F16
storage) without changing the quantization scheme or model accuracy.

Also fix the three boolean CLI flags (--encoder-only, --quantize,
--optimize-ane) to use a _str_to_bool helper so that both
  --flag True
and
  --flag False
parse correctly.  The type=bool form accepted "False" as True because
bool("False") == True.

Remove the "currently broken" label from --optimize-ane: the ANE path
(WhisperANE with Conv2d attention and LayerNormANE) converts and loads
correctly with both PyTorch 2.x and coremltools 9.x.
models/convert-whisper-to-coreml.py