Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.78 KB

setup.md

File metadata and controls

63 lines (40 loc) · 1.78 KB

Setting up Core ML backend

This is a tutorial for setting up the Core ML backend.

AOT Setup

  1. Follow the instructions described in Setting Up ExecuTorch to set up ExecuTorch environment.

  2. Run the example script to validate that the Core ML backend is set up correctly.

cd executorch

# Saves add_coreml_all.pte in the current directory if successful.

python3 -m examples.apple.coreml.scripts.export --model_name add

  1. You can now integrate the Core ML backend in code.
# Delegate to Core ML backend
delegated_program_manager = edge_program_manager.to_backend(CoreMLPartitioner())

Integrating Core ML delegate into runtime.

  1. Follow the instructions described in Building with CMake to set up CMake build system.

  2. Install Xcode.

  3. Install Xcode Command Line Tools.

xcode-select --install
  1. Build Core ML delegate. The following will create executorch.xcframework and coreml_backend.xcframework in the cmake-out directory.
cd executorch
./scripts/build_apple_frameworks.sh --coreml
  1. Open the project in Xcode, and drag executorch.xcframework and coreml_backend.xcframework frameworks generated from Step 2 to Frameworks.

  2. Go to project Target’s Build Phases - Link Binaries With Libraries, click the + sign, and add the following frameworks:

executorch.xcframework
coreml_backend.xcframework
  1. Go to project Target’s Build Phases - Link Binaries With Libraries, click the + sign, and add the following frameworks.
Accelerate.framework
CoreML.framework
libsqlite3.tbd
  1. The target could now run a Core ML delegated Program.