ComfyUI Node

Load Core ML UNet

The node that finally uses your Mac's Neural Engine

By aszc-dev·Created 3 years ago·Updated 2 months ago· 183
Load Core ML UNet
    • coreml_model
    coreml_name
    compute_unit

    If you run ComfyUI on an Apple Silicon Mac, you've probably noticed the same thing everyone does: it works, but the M-series chip's crown jewel - the Neural Engine (ANE) - mostly sits idle while the GPU or CPU does all the work. The Core ML UNet Loader is the piece of the Core ML Suite that fixes that. It loads a Stable Diffusion UNet that's been converted to Apple's Core ML format, so the actual denoising runs through the ANE instead of plain Metal.

    Is it worth it? The author (aszc-dev, who posts on Reddit as Kiepan) measured the jump directly: 1.25 it/s with standard MPS on an M2, up to 2.15 it/s with CPU_AND_NE. The README's own number is roughly 1.5–2× faster at 512×512. That's not an NVIDIA-beating number - one commenter correctly notes it's slower than a 1080 Ti - but if a Mac is what you own, that's a real, free speedup. It's the difference between watching paint dry and waiting impatiently.

    What it actually does

    The node is boring in the best way: it looks in ComfyUI's models/unet folder, lists the Core ML models you've dropped there, and loads the one you pick into a coremltools wrapper. The dropdown (coreml_name) is populated from the .mlpackage folders in that directory - so the first thing you'll fight is getting your model into the right place. Community Core ML models on HuggingFace (the coreml-community org) ship as ZIPs. Unzip them and move the model folder into models/unet. A ZIP sitting in there won't show up, and neither will a stray safetensors file.

    The one other input, compute_unit, decides what hardware the model runs on. Four choices: CPU_AND_NE, CPU_AND_GPU, ALL, CPU_ONLY. That NE is the Neural Engine - the README spells it "CPU_AND_ANE," same thing, the dropdown just uses coremltools' name. Here's the catch that trips everyone: picking CPU_AND_NE only actually hits the ANE if the model was converted with the SPLIT_EINSUM attention implementation. Convert with ORIGINAL and the model runs on GPU no matter what you select. If the ANE route silently feels slower, that's the reason.

    The output is a coreml_model, which wires straight into the Core ML Sampler (or the experimental Adapter if you want to use a stock KSampler instead).

    Installing it

    If you haven't installed the pack yet:

    cd ComfyUI/custom_nodes
    git clone https://github.com/aszc-dev/ComfyUI-CoreMLSuite
    cd ComfyUI-CoreMLSuite
    pip install -r requirements.txt
    

    Or skip all that and use ComfyUI Manager: hit the Manager button, "Install Custom Nodes," search "Core ML," install, restart. The heavy deps are coremltools>=9 and coreml-diffusion, and this is Apple Silicon-only - on a Windows/NVIDIA box these nodes are just decoration.

    Where people get burned

    • The model won't appear in the dropdown. It's still a ZIP, it's in the wrong folder, or the folder name is wrong. Unzip, confirm the .mlpackage folder is directly in models/unet.
    • Wrong resolution. A converted Core ML model is fixed to its conversion size (512×512 by default). Feed it a different-sized latent and you'll get shape errors. Re-convert at the size you want rather than fighting it.
    • Stale models after the 2.0.0 update. The pack changed the UNet's hidden-states layout in v2.0.0; anything converted with an older version must be re-converted or it silently produces garbage. If you updated the suite and output went wrong, reconvert.
    • Slow first load. .mlpackage models take noticeably longer to load into memory. The compiled .mlmodelc bundles load much faster - the README recommends them if your workflow is latency-sensitive.
    • SDXL. The loader can load an SDXL UNet, but SDXL on the ANE isn't supported. If loading hangs, switch to CPU_AND_GPU or CPU_ONLY.
    CategoryCore ML Suite

    Inputs (2)

    NameTypeDefaultDescription
    coreml_nameCOMBO0 options:
    compute_unitCOMBO4 options: CPU_AND_NE, CPU_AND_GPU, ALL, CPU_ONLY

    Outputs (1)

    NameTypeDescription
    coreml_modelCOREML_UNET