coremltools

Use Core ML to integrate machine learning models into your app. Core ML provides a unified representation for all models. Your app uses Core ML APIs and user data to make predictions, and to train or fine-tune models, all on the user’s device.

Core ML optimizes on-device performance by leveraging the CPU, GPU, and Neural Engine while minimizing its memory footprint and power consumption. Running a model strictly on the user’s device removes any need for a network connection, which helps keep the user’s data private and your app responsive.

Introduction

Use coremltools to convert models from third-party libraries to the Core ML format.

Core ML is an Apple framework to integrate machine learning models into your app.

Use the coremltools Python package to convert models from third-party training libraries such as TensorFlow and PyTorch to the Core ML format. You can then use Core ML to integrate the models into your app.

Core ML provides a unified representation for all models. Your app uses Core ML APIs and user data to make predictions, and to fine-tune models, all on the user’s device. Running a model strictly on the user’s device removes any need for a network connection, which helps keep the user’s data private and your app responsive.

Core ML optimizes on-device performance by leveraging the CPU, GPU, and Neural Engine while minimizing its memory footprint and power consumption.

Additional resources

  • The Machine Learning page provides educational material, tutorials, guides, and documentation for Apple developers.
  • The WWDC session videos are a great place to start if you are new to machine learning technology and Core ML.
  • The Core ML documentation walks you through the first steps in developing an app with a machine learning model.

What is coremltools?

The coremltools Python package is the primary way to convert third-party models to the Core ML format.

With coremltools, you can do the following:

  • Convert trained models from frameworks such as TensorFlow and PyTorch to the Core ML format.
  • Read, write, and optimize Core ML models.
  • Verify conversion/creation in macOS by making predictions using Core ML.

You can convert trained models from the following frameworks to Core ML format:

Model Family

Supported Packages

Neural Networks

TensorFlow 1 (1.14.0+)
TensorFlow 2 (2.1.0+)
PyTorch (1.4.0+, <= 1.6.0)
Keras (2.0.4+)
ONNX (1.6.0)
Caffe (1.0)

Tree Ensembles

XGboost (1.1.0)
scikit-learn (0.18.1)

Generalized Linear Models

scikit-learn (0.18.1)

Support Vector Machines

LIBSVM (3.22)
scikit-learn (0.18.1)

Pipelines (pre and post-processing)

scikit-learn (0.18.1)

Updated 3 months ago



Introduction


Use coremltools to convert models from third-party libraries to the Core ML format.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.