ComfyUI Node

AMModelLoader

Why this pack makes you re-download your Flux

By leeguandong·Created 2 years ago·Updated about a year ago· 4
AMModelLoader
    • pipe
    model_typeFLUX
    model_nameblack-forest-labs/FLUX.1-dev
    load_local_modelfalse
    dtypefloat16
    enable_cpu_offloadtrue
    local_model_pathblack-forest-labs/FLUX.1-dev

    AMModelLoader is the part of this pack people usually hit first, and it's the part that makes you stop and ask "wait, why am I downloading this again?" Because you are. This node does not load a ComfyUI checkpoint. It loads a whole HuggingFace diffusers pipeline - a folder of model files in HF layout - which is a completely separate install from the .safetensors you already have in models/checkpoints. If you've been running Flux through ComfyUI's native nodes, that's a fresh multi-gigabyte download for a parallel copy of a model you already own.

    Here's what it actually does under the hood: it calls FluxPipeline.from_pretrained(model_name) (or StableDiffusion3Pipeline for SD3), which grabs the model straight from the HuggingFace Hub and caches it in ~/.cache/huggingface. For Flux it enables VAE slicing and tiling; with enable_cpu_offload on, Flux gets enable_sequential_cpu_offload() and SD3 gets enable_model_cpu_offload(). Out comes one MODEL_PIPE output, the shared pipe type that AttentionMask and AMSample consume.

    The inputs that matter:

    • model_type - FLUX or SD3. Sets both which pipeline loads and how prompts are handled downstream.
    • model_name - the HF repo id. Default is black-forest-labs/FLUX.1-dev, which is gated: you need a HuggingFace account, a token, and an accepted license, or the download dies.
    • load_local_model + local_model_path - flip this on to point at a diffusers-format folder you already downloaded. This is the sane path if you don't want to redo the download, but you still need the folder in HF layout, not a single safetensors file.
    • dtype - float16 or bfloat16. Fine to leave at float16; bfloat16 is the safer choice on some cards (like 40-series) if you run into NaN issues.
    • enable_cpu_offload - defaults on, and on a 12B model you'll want it unless you have a big card. It costs speed.

    Honest take: this is the awkward prerequisite of the whole pack. FLUX.1-dev is roughly 24GB in fp16, it's non-commercial licensed, and the diffusers path re-downloads everything instead of reusing your ComfyUI install. If you don't specifically want the attention-mask experiment the pack is for, this node is pure overhead - that's the whole case for skipping the pack and sticking with native Flux nodes.

    Install is the same shared pack install (the README's own clone URL is stale and points at a repo that doesn't exist - use this one):

    cd ComfyUI/custom_nodes
    git clone https://github.com/leeguandong/ComfyUI_FluxAttentionMask
    

    Restart ComfyUI. There's no requirements.txt in the repo, so it leans on whatever diffusers, transformers, and torch are already in your ComfyUI environment. Two gotchas to expect: the gated-model download failing with a 401 until you run huggingface-cli login and accept the license, and your ComfyUI env's diffusers version mattering a lot downstream - the pack's mask feature depends on an unmerged diffusers PR, so on a stock install the attention mask gets silently ignored. This is a small, unmaintained research pack (a few stars, no commits since March 2025), so treat it as an experiment with real rough edges, not infrastructure.

    Categorysd

    Inputs (6)

    NameTypeDefaultDescription
    model_typeCOMBOFLUX2 options: FLUX, SD3
    model_nameSTRINGblack-forest-labs/FLUX.1-dev
    load_local_modelBOOLEANfalse
    dtypeCOMBOfloat162 options: float16, bfloat16
    enable_cpu_offloadBOOLEANtrue
    local_model_pathoptSTRINGblack-forest-labs/FLUX.1-dev

    Outputs (1)

    NameTypeDescription
    pipeMODEL_PIPE