Convert Checkpoint to Core ML
Turn any SD1.5 or SDXL checkpoint into a Core ML model — once
- lora_params
- coreml_model
Core ML models aren't something you download for every checkpoint you like - they're something you make. That's this node's whole job: it takes a normal Stable Diffusion checkpoint sitting in models/checkpoints, converts its UNet to Apple's Core ML format, saves the result into models/unet, and hands you back a ready-to-use coreml_model for the Core ML Sampler.
A few facts up front so you know what you're signing up for. The conversion takes a few minutes for an SD1.5 model (the author's own ballpark), longer for SDXL. The result is fixed: the model is baked for one resolution, one batch size, and one attention implementation. Want a different size? Re-convert. That's the fundamental trade of this whole suite - you're giving up flexibility for ANE speed, and the speedup is roughly 1.5–2× at 512×512 on Apple Silicon.
How it works
The conversion pipeline is an adaptation of Apple's ml-stable-diffusion that the author has since rewritten to run natively on diffusers' UNet2DConditionModel - so no Apple package dependency, just coreml-diffusion and coremltools. Here's the part people miss: the conversion parameters are encoded into the output filename. The node checks whether a model with that exact name already exists in models/unet; if it does, it skips the whole conversion and just loads it. This means your first conversion is slow and every re-run is instant, but it also means any change to a parameter - width, ControlNet toggle, LoRA, whatever - produces a new name and triggers a fresh conversion. That's by design, and it's why you can freely rename the output file afterward without breaking anything (the loader doesn't care about the name).
The inputs that matter
Most of the required inputs are exactly the things that get baked into the file:
- ckpt_name - the checkpoint from
models/checkpoints. If it uses a custom architecture config (some models ship a.yaml), drop a same-named.yamlintomodels/configsor conversion will use the wrong architecture. - model_version -
SD15orSDXL. (Newer 2.x builds of the suite auto-detect this from the weights and drop the dropdown; if you don't see it, that's why.) - height / width / batch_size - multiples of 8, default 512×512 batch 1. These become the model's fixed input shape. Batch >1 speeds up batch generation but also raises peak memory, which matters on 8 GB Macs.
- attention_implementation - the big one.
SPLIT_EINSUM/SPLIT_EINSUM_V2are the ANE-friendly paths;ORIGINALruns on GPU instead. Pick based on the compute unit you'll load with. - controlnet_support - must be on before conversion if you ever want ControlNet on this model. No retrofits.
- quantize_nbits (optional) -
none/8/6/4, a k-means weight palettization that shrinks the file. The author's measurements: 8-bit halves the size with no visible loss, 6-bit is ~2.7× smaller (the sweet spot on 16 GB Macs), 4-bit ~4× smaller for 8 GB machines. Default staysnoneso old workflows keep byte-identical output. - lora_params (optional) - from the Core ML LoRA Loader, bakes LoRAs in at conversion time.
The output, coreml_model, goes straight into the Core ML Sampler.
Installing and troubleshooting
It's part of the Core ML Suite pack - ComfyUI Manager, search "Core ML," or:
cd ComfyUI/custom_nodes
git clone https://github.com/aszc-dev/ComfyUI-CoreMLSuite
cd ComfyUI-CoreMLSuite
pip install -r requirements.txt
Then restart ComfyUI. Three gotchas to keep in your back pocket: SD2.1 checkpoints are not supported at all. SDXL converted models must be loaded with CPU_AND_GPU or CPU_ONLY - SDXL on the ANE doesn't work and loading can hang. And if you're upgrading from a pre-2.0.0 version of the pack, old converted models are incompatible - the UNet's hidden-states layout changed, so re-convert anything that starts misbehaving.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| ckpt_name | COMBO | 0 options: | |
| model_version | COMBO | 2 options: SD15, SDXL | |
| height | INT | 512 | — |
| width | INT | 512 | — |
| batch_size | INT | 11–64 | — |
| attention_implementation | COMBO | 3 options: SPLIT_EINSUM, SPLIT_EINSUM_V2, ORIGINAL | |
| compute_unit | COMBO | 4 options: CPU_AND_NE, CPU_AND_GPU, ALL, CPU_ONLY | |
| controlnet_support | BOOLEAN | false | — |
| quantize_nbitsopt | COMBO | none | 4 options: none, 8, 6, 4 |
| lora_paramsopt | LORA_PARAMS | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| coreml_model | COREML_UNET | — |