Nodes/ComfyUI_HiDiffusion_Pro/HI_Diffusers_Model_Loader
ComfyUI Node

HI_Diffusers_Model_Loader

The Loader That Rebuilds Your Checkpoint as a High-Res Pipeline

By smthemex·Created 2 years ago·Updated 2 years ago· 51
HI_Diffusers_Model_Loader
    • pipe
    function_choice
    ckpt_name
    vae_id
    unet_model
    controlnet_model
    lora
    lora_scale0.8
    trigger_wordsbest quality
    scheduler
    apply_window_attnfalse
    ip_ckpt
    clip_vision

    The name tells you exactly what this node does, which is more than most custom nodes manage. HI_Diffusers_Model_Loader is the first half of a two-node pack: it builds the pipeline, and Hi_Sampler runs it. You'll basically never use one without the other.

    The whole point is HiDiffusion, Megvii's trick for generating at resolutions a model was never trained on. Train SD 1.5 at 512 and ask it for 2048 and you get the classic failure - duplicated faces, extra limbs, composition that falls apart. HiDiffusion attacks that with two ideas: RAU-Net, which downsamples the deep blocks of the U-Net so their receptive field matches what they saw at training resolution, and MSW-MSA, shifted window attention that cuts inference time by roughly 40–60% at high resolutions. This is native high-res generation, not the two-pass hi-res fix you build out of a second KSampler.

    What sets this pack apart from the other HiDiffusion ports: it doesn't monkey-patch ComfyUI's sampler at all. The loader calls HuggingFace's from_single_file on your local checkpoint, loads the whole thing into a diffusers pipeline, applies the HiDiffusion patch to that UNet, and hands you a pipe object that only this pack's sampler understands. You're effectively running a self-contained diffusers generation inside the ComfyUI graph.

    Inputs that actually matter

    There are a dozen inputs, but you'll touch these:

    • function_choice - txt2img or img2img. Pick once here; it decides which pipeline class gets built and what the sampler expects.
    • ckpt_name - your checkpoint, from your normal models/checkpoints folder. The node auto-detects whether it's SD 1.5, SD 2.1, SDXL, Playground v2, or SDXL-inpaint. Unsupported architecture and it raises unsupport model!!.
    • scheduler - 19 choices (DDIM, Euler, the DPM++ family, and friends). Matches what you'd pick on a normal KSampler.
    • apply_window_attn - default off. This is the MSW-MSA toggle. It speeds things up, but at resolutions that don't partition cleanly into windows the author's own code warns the quality drops. Start with it off.

    The rest is the grab-bag: vae_id, unet_model for the SDXL Lightning/Hyper/LCM/DMD2 fast UNets, controlnet_model (SDXL ControlNets only - canny, tile, openpose, scribble, MistoLine, inpainting), and lora + lora_scale + trigger_words. One quirk: trigger_words isn't just a label - if you load a LoRA, those words get appended to your prompt at sample time. Keep them as the LoRA's actual trigger phrase.

    Output

    One output, pipe (type HIDIF_MODEL). It wires into Hi_Sampler's pipe input, and nowhere else.

    Install

    Standard custom-node fare:

    cd ComfyUI/custom_nodes
    git clone https://github.com/smthemex/ComfyUI_HiDiffusion_Pro.git
    

    Or search ComfyUI_HiDiffusion_Pro in ComfyUI Manager. Then restart. There's no requirements.txt shipped, so the real dependencies come from your ComfyUI venv - and the ones that aren't already there will bite you. The README calls for diffusers >= 0.28.0 (the single-file loader needs at least 0.27.2), plus yaml, and the code also imports omegaconf and cv2. Diffusers and omegaconf often aren't in a stock ComfyUI install:

    /path/to/ComfyUI/python_embeded/python -m pip install "diffusers>=0.28.0" omegaconf
    

    Worth knowing before you start: the other HiDiffusion ComfyUI ports earned a reputation for wrecking installs by pinning an ancient torch==1.13.1. This pack doesn't touch torch - it just needs a recent diffusers, which is a much smaller ask.

    Gotchas

    • VRAM is the real cost. The code moves the pipeline to CUDA and enables xformers, VAE tiling, and model CPU offload automatically, but the README is blunt that SDXL at high resolution can blow through memory. On 8GB, plan on slow offloads or stick to SD 1.5.
    • Style IP-Adapter disables HiDiffusion. If you wire in ip_ckpt + clip_vision (from models/photomaker and models/clip_vision) for the style branch, the code calls remove_hidiffusion on the model. You can't have both - style transfer and the resolution patch don't run at the same time.
    • It loads via diffusers, so your checkpoint needs to be something diffusers can reconstruct. Fancy merged or experimental formats may refuse to load.
    CategoryHidiffusion_Pro

    Inputs (12)

    NameTypeDefaultDescription
    function_choiceCOMBO2 options: txt2img, img2img
    ckpt_nameCOMBO0 options:
    vae_idCOMBO1 options: none
    unet_modelCOMBO1 options: none
    controlnet_modelCOMBO1 options: none
    loraCOMBO1 options: none
    lora_scaleFLOAT0.80.1–1
    trigger_wordsSTRINGbest quality
    schedulerCOMBO19 options: DDIM, Euler, Euler a, DDPM, DPM++ 2M, DPM++ 2M Karras, +13
    apply_window_attnBOOLEANfalse
    ip_ckptCOMBO1 options: none
    clip_visionCOMBO1 options: none

    Outputs (1)

    NameTypeDescription
    pipeHIDIF_MODEL