Skip to main content

Convert diffusion-model checkpoints (SD1.5/SDXL) to Core ML for Apple Neural Engine — framework-free, ComfyUI-independent.

Project description

coreml-diffusion

Convert diffusion-model checkpoints into Core ML .mlpackage artifacts for the Apple Neural Engine (ANE) — framework-free and independent of ComfyUI.

coreml-diffusion takes a single-file Stable Diffusion checkpoint and produces a Core ML UNet you can run on-device (macOS/iOS) or load back into ComfyUI via ComfyUI-CoreMLSuite, which depends on this package for its conversion path.

Positioning

The niche is diffusion models on the Apple Neural Engine via Core ML — inside ComfyUI and on-device. ANE is the differentiator: low-power, GPU-free, embeddable in a Swift/iOS app. This is about feasibility and power efficiency for SD1.5/SDXL on ANE, not a raw-throughput claim against desktop GPUs.

Supported today: SD1.5 and SDXL (verified). SDXL refiner and LCM convert but are not yet golden-verified (experimental). The scope is diffusion architectures generally, not Stable Diffusion specifically.

Install

uv pip install coreml-diffusion          # from PyPI (planned)
uv pip install -e .                       # from a checkout

Requires Python 3.12 and (for conversion) coremltools 9 — conversion runs on macOS; the package imports and its CLI parse on any platform.

CLI

coreml-diffusion convert \
    --ckpt path/to/model.safetensors \
    --model-version SD15 \
    --out unet.mlpackage \
    --height 512 --width 512 \
    --attn-impl SPLIT_EINSUM \
    --quantize none

Options: --batch-size, --controlnet, --lora PATH[:STRENGTH] (repeatable), --config (original-config YAML). --quantize {none,8,6,4} applies k-means weight palettization. Run coreml-diffusion convert --help for the full list.

The output .mlpackage is the deliverable: load it natively in Swift/Core ML, or through ComfyUI-CoreMLSuite.

Library

import coreml_diffusion
from coreml_diffusion import ModelVersion

coreml_diffusion.convert(
    "model.safetensors", ModelVersion.SD15, "unet.mlpackage",
    height=512, width=512, attn_impl="SPLIT_EINSUM",
)

Discovery API (list_model_versions, list_attention_impls, list_quant_modes, CONTRACT_VERSION) reports what this build can convert; the identifiers are an additive-only contract (removing/renaming one is a major bump).

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreml_diffusion-0.1.0.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreml_diffusion-0.1.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file coreml_diffusion-0.1.0.tar.gz.

File metadata

  • Download URL: coreml_diffusion-0.1.0.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for coreml_diffusion-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a89dcfed8cd68df0070e924c4d7d8252f86ae86daa5b49cf58f37fd40a1c2db0
MD5 910803b50612de48867cafe39aa95a5a
BLAKE2b-256 b9b070735f73074cdf030f911fcbc4d9c751e1339a3cf320d5445e9fe03c62be

See more details on using hashes here.

File details

Details for the file coreml_diffusion-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: coreml_diffusion-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for coreml_diffusion-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad71d622282e08cd8bbc8db06263faad870bad005bf2a69fb7e41613d844d653
MD5 efd913810773823994a5bc6677601feb
BLAKE2b-256 8065e79e55272fc31c27fe3db318b06b4048265bdd8c304d140cdcd02cacd384

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page