CoreML models can be saved as either a Neural Network or a ML Program, in either “.mlmodel” (Neural Net) or “.mlpackage” (Neural Net/ML Program)
I know the Pytorch Saved Models are in .pth or .pt. But what are the differences between mlmodle and mlpackage.
Which is preferred where vs the another ?
Couldnt find any consolidated thing describing this
From https://developer.apple.com/documentation/coreml/updating-a-model-file-to-a-model-package:
A Core ML model package is a file-system structure that can store a model in separate files, similar to an app bundle. Model packages offer more flexibility and extensibility than Core ML model files, including editable metadata and separation of a model’s architecture from its weights and biases.
https://apple.github.io/coremltools/docs-guides/source/comparing-ml-programs-and-neural-networks.html delves into specifics. The main points are:
Neural Network | ML Program |
---|---|
Layers with a computational graph representation | Operations with a programmatic representation |
Weights embedded in layers | Weights decoupled and serialized |
Intermediate tensor type implicit | Intermediate tensor type explicit |
Limited control over precision | More granular control over precision |