Introduction
Core ML models are the trained models that apps run on Apple devices through
Core ML, Apple’s
machine learning framework, introduced in 2017. Developers convert a model from PyTorch,
TensorFlow or another framework with Apple’s coremltools, add the file to an Xcode
project, and Xcode compiles it into an .mlmodelc folder that ships inside the
app.
There are two forms. An .mlmodel is a single file. An
.mlpackage, added in 2021 for the newer ML Program model type, is a folder
that keeps the weights in a separate file so large models are easier to handle.
Structure
An .mlmodel file is one Protocol
Buffers message of type Model, defined in the
Model.proto schema that Apple publishes with coremltools. It has a
specificationVersion, a description of the inputs, outputs and
metadata such as author and licence, and exactly one model body: a neural network, an ML
Program, a pipeline of other models, a tree ensemble, a linear model and so on.
An .mlpackage is a folder (shown as one file on a Mac) with a
Manifest.json and a Data/com.apple.CoreML/ folder holding the
model.mlmodel specification and a weights/ folder with the
weights.
Links
Software
Developers
- coremltools, Apple’s Python package for converting, editing and checking models
- Core ML, the framework apps use to run them, for Swift and Objective-C