whatisgithub

What is coremltools?

apple/coremltools — explained in plain English

Analysis updated 2026-06-26

5,271PythonAudience · developerComplexity · 3/5LicenseSetup · moderate

In one sentence

Apple's official Python library for converting AI models trained in PyTorch, TensorFlow, or scikit-learn into Core ML format so they run on-device in iPhone, iPad, and Mac apps without a server.

Mindmap

mindmap
  root((repo))
    What it does
      Convert models to Core ML
      Optimize for Apple hardware
      Verify model accuracy
    Supported Inputs
      PyTorch
      TensorFlow 1 and 2
      scikit-learn
      XGBoost and LibSVM
    Apple Targets
      iPhone and iPad
      Mac apps
      Neural Engine
    Use Cases
      On-device inference
      Private AI features
      Offline model serving
    Workflow
      pip install
      Convert model
      Bring into Xcode
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Convert a trained PyTorch image classifier to run fully offline on an iPhone without sending data to a server.

USE CASE 2

Optimize an existing Core ML model to run faster on the iPhone Neural Engine.

USE CASE 3

Verify that a converted Core ML model produces the same predictions as the original PyTorch model.

USE CASE 4

Add on-device AI to a Mac app by converting a scikit-learn or XGBoost model to Core ML format.

What is it built with?

PythonPyTorchTensorFlowCore MLscikit-learnXGBoost

How does it compare?

apple/coremltoolskarpathy/build-nanogptfacebookresearch/sapiens
Stars5,2715,3055,393
LanguagePythonPythonPython
Last pushed2024-08-132026-05-26
MaintenanceStaleMaintained
Setup difficultymoderatemoderatehard
Complexity3/53/54/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Xcode and an Apple developer account to deploy converted models to iOS or macOS apps.

Use freely for any purpose including commercial apps under Apple's BSD-style license, as long as you keep the copyright notice.

So what is it?

This is Apple's official Python library for converting machine learning models into the Core ML format, which is the format Apple devices use to run AI models in apps. If you have trained a model using a popular framework like PyTorch, TensorFlow, scikit-learn, or XGBoost, you can use this library to convert it into a form that an iPhone, iPad, or Mac application can use directly. Core ML is Apple's system for running on-device AI. Instead of sending data to a remote server for processing, Core ML runs the model locally on the device using its CPU, GPU, or Neural Engine. This keeps user data private, reduces power consumption, and avoids the need for a network connection. Beyond conversion, the library also lets you read, edit, and optimize existing Core ML model files, and verify that a converted model produces correct results. Once you have a converted model, you bring it into Xcode, Apple's app development tool, to integrate it into your application. The library supports converting from TensorFlow 1 and 2, PyTorch, scikit-learn, XGBoost, and LibSVM. Installation is through pip, the standard Python package tool. The project is maintained by Apple and includes guides, API documentation, and a specification for the Core ML file format.

Copy-paste prompts

Prompt 1
Convert my PyTorch image classification model to Core ML format using coremltools. Here is my model definition: [paste code].
Prompt 2
I have a TensorFlow 2 text classification model. Walk me through converting it to Core ML with coremltools so I can use it in an iOS app.
Prompt 3
How do I verify that my coremltools-converted model gives the same predictions as my original PyTorch model before shipping it?
Prompt 4
I want to run a Core ML model on the iPhone Neural Engine for maximum speed. What optimizations should I apply with coremltools?
Prompt 5
After converting my model with coremltools, how do I load and test the .mlmodel file in Xcode?

Frequently asked questions

What is coremltools?

Apple's official Python library for converting AI models trained in PyTorch, TensorFlow, or scikit-learn into Core ML format so they run on-device in iPhone, iPad, and Mac apps without a server.

What language is coremltools written in?

Mainly Python. The stack also includes Python, PyTorch, TensorFlow.

What license does coremltools use?

Use freely for any purpose including commercial apps under Apple's BSD-style license, as long as you keep the copyright notice.

How hard is coremltools to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is coremltools for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.