Nodes/ComfyUI_MangaNinjia/MangaNinjiaLoader
ComfyUI Node

MangaNinjiaLoader

Loading MangaNinja's whole Frankenstein pipeline

By smthemex·Created 2 years ago·Updated about a year ago· 58
MangaNinjiaLoader
    • model
    checkpoint
    clip
    controlnet

    MangaNinjiaLoader is where every workflow with this pack starts and where most of the setup pain lives. It takes ordinary building blocks you probably already own - an SD 1.5 checkpoint, a lineart ControlNet, the CLIP vision weights - and glues them into the custom pipeline that MangaNinjiaSampler then runs. It's a slow, heavy, do-it-once node: every run rebuilds the whole thing, so give the first execution some patience and a hot coffee.

    What it assembles

    Alibaba's MangaNinja (the paper spells it MangaNinja; this pack's repo is MangaNinjia, a typo that has shipped in a lot of copies) isn't a single file you can drop into ComfyUI. It's SD 1.5, plus:

    • a denoising UNet and a reference UNet - both cloned from your SD 1.5 UNet and then overwritten with the pack's denoising_unet.pth / reference_unet.pth weights;
    • a ControlNet built from the same UNet and loaded with a lineart ControlNet file, then overwritten with controlnet.pth;
    • a PointNet (point_net.pth) for the correspondence points your MarkImageNodes generate;
    • a CLIP vision/text encoder loaded from clip_l.safetensors in models/clip, plus a lineart preprocessor built from sk_model.pth.

    In the source, that's exactly what happens in nijia_loader(): build the SD 1.5 pipe from a single file, clone its UNet twice, swap in the MangaNinja weights, wrap it in a custom MangaNinjiaPipeline, and hand the bundle back. Hence the MODEL_MangaNinjia output: one opaque bag containing pipe, preprocessor, tokenizer, CLIP encoders, and VAE.

    Inputs and outputs

    Three dropdowns, all with a "none" option:

    • checkpoint - anything in models/checkpoints. Use an SD 1.5 checkpoint with a VAE baked in; the README calls that out explicitly.
    • clip - a CLIP vision/text file from models/clip, i.e. clip_l.safetensors (from OpenAI's clip-vit-large-patch14).
    • controlnet - a lineart ControlNet from models/controlnet, e.g. control_v11p_sd15_lineart_fp16.safetensors (the s2_lineart_anime variant also works).

    Leave any of them at "none" and the loader raises - it literally does raise "no checkpoint" style errors. Pick all three and out comes the single model output that feeds the sampler's model input.

    Install

    The pack itself installs like any other custom node - ComfyUI Manager (search "MangaNinjia") or:

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

    then restart. The README says the requirements.txt is optional ("no need, because it's based on sd1.5 and controlnet") - true if your ComfyUI already has the heavy stack, but it pins basicsr==1.3.5, which the lineart preprocessor imports, so if the annotator fails on basicsr or kornia, run pip install -r requirements.txt.

    The model layout is where people lose an afternoon. You need, from the README:

    models/checkpoints  →  your SD 1.5 safetensors (with VAE)
    models/controlnet   →  control_v11p_sd15_lineart_fp16.safetensors
    models/clip         →  clip_l.safetensors
    models/MangaNinjia  →  denoising_unet.pth, reference_unet.pth,
                           point_net.pth, controlnet.pth, sk_model.pth
    

    The four .pth files (plus sk_model.pth) come from the Johanan0528/MangaNinjia Hugging Face repo. That folder is auto-created and registered as a model directory the first time the node runs, so you can drop the files in before or after install.

    Common issues

    Two failure modes dominate. First, the loader expects xformers - it calls enable_xformers_memory_efficient_attention() on the pipeline, which raises if xformers isn't installed. If your first load dies on that, that's why. Second, VRAM: building SD 1.5 plus two cloned UNets plus a ControlNet in one shot is a real memory spike before the sampler even starts, so an 8 GB card can OOM at load on a busy environment - close the other workflows first. And if you see "no checkpoint" / "no clip" errors, you left a dropdown on "none" rather than having a missing file, which is a quick sanity check before you start re-downloading models.

    CategoryMangaNinjia

    Inputs (3)

    NameTypeDefaultDescription
    checkpointCOMBO1 options: none
    clipCOMBO1 options: none
    controlnetCOMBO1 options: none

    Outputs (1)

    NameTypeDescription
    modelMODEL_MangaNinjia