gitmyhub

coremltools

Python ★ 5.3k updated 3d ago

Core ML tools contain supporting tools for Core ML model conversion, editing, and validation.

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.