Skip to main content

PyCoreML

CoreML inference from Python — powered by Swift & ApplePy.

Direct access to Apple's CoreML framework with explicit compute unit selection (CPU, GPU, Neural Engine).

macOS only — requires Swift 6.0+ toolchain

Install

pip install -e .

Usage

import pycoreml

# Load and describe a model
info = pycoreml.load_model("/path/to/model.mlmodelc")
desc = pycoreml.model_description("/path/to/model.mlmodelc")

# Run prediction
result = pycoreml.predict("/path/to/model.mlmodelc", {"x": 42.0})

# Predict with explicit compute unit (the killer feature)
result = pycoreml.predict_with_options(
    "/path/to/model.mlmodelc",
    {"x": 42.0},
    "cpuAndNeuralEngine"  # or "cpuOnly", "cpuAndGPU", "all"
)

API

Function Returns Description
load_model(path) str Load model and return description
model_description(path) dict[str, str] Model metadata
predict(path, inputs) dict[str, float] Run inference
list_compute_units() list[str] Available compute units
predict_with_options(path, inputs, unit) dict[str, float] Predict with compute unit control

Examples

See pycoreml/examples/demo.py for a full demo.

License

BSD-3-Clause © Jagtesh Chadha — see LICENSE.

Release files for pycoreml 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycoreml 0.3.0
File Size Uploaded
pycoreml-0.3.0.tar.gz 7.5 kB Details

Release files / pycoreml-0.3.0.tar.gz

Download URL pycoreml-0.3.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
69eed55b84edbaf175925df662eb7e39d6f5dfa7feca6b5ab4e400b4b6688784
BLAKE2b-256 checksum
How to use checksums
f93661212b6e2a3478fe8df971cffb6b7b845b91dd9e81c3920c3601df9e2f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page