How do I load a CoreML model?
Generated on 3/21/2025
1 search
To load a CoreML model, you can use the Core ML tools Python API. Here's a general workflow based on the information from the WWDC sessions:
-
Convert the Model: Start by converting your model into the Core ML format using Core ML tools. This involves using the
ct.convert
function to convert models from frameworks like PyTorch or TensorFlow into Core ML models. -
Optimize the Model: During conversion, you can optimize the model for Apple hardware using various techniques such as quantization and efficient key-value caching, especially for large language models.
-
Load the Model: Once you have your model in the Core ML format, you can load it using the Core ML tools Python API. If you're working with multifunction models, you can specify the function name to load a specific function within the model.
-
Run Inference: After loading the model, you can perform predictions as usual using the Core ML framework. Core ML automatically optimizes execution across the CPU, GPU, and neural engine to maximize performance.
For more detailed information, you can refer to the session Bring your machine learning and AI models to Apple silicon (26:24) which covers multifunction models and their usage.

What’s new in Create ML
Explore updates to Create ML, including interactive data source previews and a new template for building object tracking models for visionOS apps. We’ll also cover important framework improvements, including new time-series forecasting and classification APIs.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

Explore object tracking for visionOS
Find out how you can use object tracking to turn real-world objects into virtual anchors in your visionOS app. Learn how you can build spatial experiences with object tracking from start to finish. Find out how to create a reference object using machine learning in Create ML and attach content relative to your target object in Reality Composer Pro, RealityKit or ARKit APIs.

Deploy machine learning and AI models on-device with Core ML
Learn new ways to optimize speed and memory performance when you convert and run machine learning and AI models through Core ML. We’ll cover new options for model representations, performance insights, execution, and model stitching which can be used together to create compelling and private on-device experiences.

Bring your machine learning and AI models to Apple silicon
Learn how to optimize your machine learning and AI models to leverage the power of Apple silicon. Review model conversion workflows to prepare your models for on-device deployment. Understand model compression techniques that are compatible with Apple silicon, and at what stages in your model deployment workflow you can apply them. We’ll also explore the tradeoffs between storage size, latency, power usage and accuracy.

Explore machine learning on Apple platforms
Get started with an overview of machine learning frameworks on Apple platforms. Whether you’re implementing your first ML model, or an ML expert, we’ll offer guidance to help you select the right framework for your app’s needs.