Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 31, 2026·3 min de lectura

CoreML Tools — Convert ML Models to Apple CoreML Format

A Python package for converting trained models from TensorFlow, PyTorch, and other frameworks into Apple's CoreML format for on-device inference on iPhone, iPad, and Mac.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
CoreML Tools
Comando de instalación directa
npx -y tokrepo@latest install de281956-5cea-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

CoreML Tools is Apple's open-source Python library for converting machine learning models into the CoreML format (.mlpackage or .mlmodel). Once converted, models run natively on Apple Neural Engine, GPU, and CPU across iOS, iPadOS, macOS, watchOS, and tvOS with no additional dependencies.

What CoreML Tools Does

  • Converts models from PyTorch, TensorFlow, TensorFlow Lite, scikit-learn, and ONNX to CoreML
  • Applies post-training quantization (INT8, FP16, palettization) to reduce model size
  • Supports neural network, pipeline, and ML program model representations
  • Validates converted models by comparing outputs against the original framework
  • Generates Xcode-ready .mlpackage files for drag-and-drop integration into apps

Architecture Overview

The conversion pipeline starts by importing a model from its source framework into CoreML Tools' intermediate representation (MIL — Model Intermediate Language). MIL normalizes operations across frameworks into a common graph. Optimization passes then apply quantization, graph pruning, and operation fusion. Finally, a backend serializer writes the optimized graph into the CoreML protobuf format, bundled as an .mlpackage with weights and metadata.

Self-Hosting & Configuration

  • Install via pip on macOS or Linux (conversion works on both; inference requires Apple hardware)
  • Use ct.convert() with framework-specific inputs for one-line conversion
  • Specify compute units (CPU, GPU, Neural Engine, or all) in the conversion call
  • Apply quantization with ct.optimize utilities to shrink model size for mobile deployment
  • Test converted models locally using the predict() method before deploying to devices

Key Features

  • Unified converter handles PyTorch (traced and exported), TensorFlow, and ONNX models
  • Post-training compression includes weight quantization, pruning, and palettization
  • Models leverage Apple Neural Engine for hardware-accelerated inference on A-series and M-series chips
  • MIL intermediate representation enables custom optimization passes
  • Supports vision, NLP, audio, and tabular model types

Comparison with Similar Tools

  • ONNX Runtime — cross-platform inference engine; CoreML Tools targets Apple-specific hardware acceleration
  • TensorFlow Lite — mobile inference for Android and iOS; CoreML Tools produces Apple-optimized models
  • OpenVINO — Intel hardware optimization; CoreML Tools targets Apple Neural Engine and GPU
  • TorchScript — PyTorch serialization format; CoreML Tools converts to a format native to Apple platforms
  • NVIDIA TensorRT — GPU inference optimization for NVIDIA hardware; CoreML Tools targets Apple silicon

FAQ

Q: Can I convert models on Linux? A: Yes. Model conversion runs on Linux and macOS. Running inference on the converted model requires Apple hardware.

Q: Which PyTorch export methods are supported? A: Both torch.jit.trace and torch.export (ExecuTorch path) are supported for conversion.

Q: How much smaller are quantized models? A: INT8 quantization typically reduces model size by 4x compared to FP32 with minimal accuracy loss.

Q: Does it support transformer models? A: Yes. CoreML Tools can convert transformer-based models including vision transformers and language models.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados