ATul Singh
ATul Singh

Reputation: 532

Difference between mlmodel and mlpackage

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

Upvotes: 3

Views: 2600

Answers (2)

Franck Dernoncourt
Franck Dernoncourt

Reputation: 83397

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

Upvotes: 2

Zayd
Zayd

Reputation: 59

So mlmodel is ur classic file for neural networks in CoreML, packing everything—structure, weights, the whole shebang—into one file.so mlpackage is the new kid pretty much kinda cooler because it splits the model’s brains (the structure) from its brawn (the weights)) This means u can messs with precision and its better for compiling on devices

.mlpackage is great wen u need that precision flexibility or want to leverage better performance on newer devices, while .mlmodel is still hanging around for scenarios needing updates directly on the device or when using custom stuff not yet supported by ML programs

Upvotes: 0

Related Questions