coremltools 7.0
- New submodule
coremltools.optimize
for model quantization and compressioncoremltools.optimize.coreml
for compressing coreml models, in a data free manner.coremltools.compresstion_utils.*
APIs have been moved herecoremltools.optimize.torch
for compressing torch model with training data and fine-tuning. The fine tuned torch model can then be converted usingcoremltools.convert
- The default neural network backend is now
mlprogram
for iOS15/macOS12. Previously callingcoremltools.convert()
without providing theconvert_to
or theminimum_deployment_target
arguments, used the lowest deployment target (iOS11/macOS10.13) and theneuralnetwork
backend. Now the conversion process will default to iOS15/macOS12 and themlprogram
backend. You can change this behavior by providing aminimum_deployment_target
orconvert_to
value. - Python 3.11 support.
- Support for new PyTorch ops:
repeat_interleave
,unflatten
,col2im
,view_as_real
,rand
,logical_not
,fliplr
,quantized_matmul
,randn
,randn_like
,scaled_dot_product_attention
,stft
,tile
pass_pipeline
parameter has been added tocoremltools.convert
to allow controls over which optimizations are performed.- MLModel batch prediction support.
- Support for converting statically quantized PyTorch models.
- Prediction from compiled model (
.modelc
files). Get compiled model files from anMLModel
instance. Python API to explicitly compile a model. - Faster weight palletization for large tensors.
- New utility method for getting weight metadata:
coremltools.optimize.coreml.get_weights_metadata
. This information can be used to customize optimization across ops when usingcoremltools.optimize.coreml
APIs. - New and updated MIL ops for iOS17/macOS14/watchOS10/tvOS17
coremltools.compression_utils
is deprecated.- Changes default I/O type for Neural Networks to FP16 for iOS16/macOS13 or later when
mlprogram
backend is used. - Changes upper input range behavior when backend is
mlprogram
:- If
RangeDim
is used and no upper-bound is set (with a positive number), an exception will be raised. - If the user does not use the
inputs
parameter but there are undetermined dim in input shape (for example, TF with "None" in input placeholder), it will be sanitized to a finite number (default_size + 1) and raise a warning.
- If
- Various other bug fixes, enhancements, clean ups and optimizations.
Special thanks to our external contributors for this release: @fukatani , @pcuenca , @KWiecko , @comeweber , @sercand , @mlaves, @cclauss, @smpanaro , @nikalra, @jszaday