Nodes/ComfyUI-Image-Inpainting/Load Model Inpaint
ComfyUI Node

Load Model Inpaint

The pack starts here — load the LaMa model that does the heavy lifting

By SherryXieYuchen·Created 2 years ago·Updated 2 years ago· 4
Load Model Inpaint
    • INPAINT_MODEL
    model_name

    "Load Model Inpaint" is the boring, important node at the front of this pack, and it's worth getting right because almost everything else assumes you've done it. It loads an inpainting model from ComfyUI's models/inpaint/ folder and hands it to Inpainting (using Model) as an INPAINT_MODEL. In practice, "an inpainting model" here means one thing: LaMa's big-lama.pt.

    Why LaMa? Because the pack's idea is that you don't need a diffusion pass for the easy 90% of inpainting. LaMa is a fast, feed-forward network trained to fill big masked holes - it's the classic "remove this object and plausible scene continues behind it" engine. It runs in seconds, needs no VAE, no UNet, no sampler. The bundled workflow only reaches for the heavy SD 1.5 + depth ControlNet machinery when LaMa's hallucinated fill isn't good enough for the job, and you want the generator to actually paint something meaningful there.

    How it works

    The dropdown in front of you is populated at runtime from models/inpaint/ - this pack registers that folder itself on import, so it appears in ComfyUI even if you never created it. The extension whitelist is .pt, .pth, .safetensors, .patch.

    Under the hood the node is a spandrel loader with a twist. A .pt file is read with torch.jit.load() and then unwrapped to its state_dict() before being handed to spandrel's ModelLoader; other extensions go through ComfyUI's load_torch_file. Either way you get a spandrel ImageModelDescriptor back on the single INPAINT_MODEL output, and that's the only output - wire it into Inpainting (using Model) and you're done.

    One honest limitation: the runner node only accepts models whose spandrel architecture id is LaMa. Drop a different spandrel-loadable inpaint model in there and it will raise Unknown model_arch. This is a LaMa pack, not a generic model host.

    How to install

    ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Image-Inpainting" → Install → restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SherryXieYuchen/ComfyUI-Image-Inpainting
    # restart ComfyUI
    

    Then the one file this node actually needs:

    mkdir -p ComfyUI/models/inpaint
    # download big-lama.pt into ComfyUI/models/inpaint/
    

    That's it - this pack ships no requirements.txt of its own. It imports spandrel, cv2, tqdm, numpy, all of which already live in a stock ComfyUI environment. The rest of the models in the README (SD 1.5 inpainting checkpoint, VAE, depth ControlNet, RealESRGAN, ZoeDepth, the LCM LoRA) belong to the bundled workflow, not to this node - you don't need any of them to just load LaMa and remove objects.

    Common issues

    • The dropdown is empty. The file isn't in models/inpaint/ (note: not models/checkpoints), or you added it without restarting ComfyUI. The folder list is read at startup.
    • "Model file not found: big-lama.pt". Same thing, spelled out - check the filename and the folder.
    • It loads but the runner errors with "Unknown model_arch". You loaded something that isn't LaMa. Get the canonical big-lama.pt.

    The classic failure people report with LaMa isn't loading - it's OOM on big inputs, and that's handled in the Inpainting (using Model) node, which resizes to a 1024 square before running. Keep your source images near that size and you'll be fine on a 12 GB card.

    Categoryinpaint

    Inputs (1)

    NameTypeDefaultDescription
    model_nameCOMBO0 options:

    Outputs (1)

    NameTypeDescription
    INPAINT_MODELINPAINT_MODEL