Nodes/ComfyUI-Img2Img-Turbo/Img2ImgTurboSketchLoader
ComfyUI Node

Img2ImgTurboSketchLoader

The sketch model loader — the stochastic sibling of the edge one

By chaojie·Created 2 years ago·Updated 2 years ago· 39
Img2ImgTurboSketchLoader
    • model

    Img2ImgTurboSketchLoader is the sketch half of the ComfyUI-Img2Img-Turbo pack: no inputs, no widgets, one model output of type Img2ImgTurboSketchModel. Drop it on the canvas, wire it into Img2ImgTurboSketchRun, and you get a one-step model that turns a rough scribble into a rendered image. Like its edge sibling, the interesting thing isn't the node itself - it's everything it quietly downloads the first time you run it.

    What it loads

    The loader builds a Pix2Pix-Turbo model from the stabilityai/sd-turbo base - tokenizer, CLIP text encoder, VAE, and UNet from HuggingFace - and adds the sketch_to_image_stochastic adapter. That adapter comes from CMU's img2img-turbo project as a single checkpoint:

    https://www.cs.cmu.edu/~img2img-turbo/models/sketch_to_image_stochastic_lora.pkl
    

    On first run you're downloading a few GB of base model plus the sketch LoRA into ComfyUI/models/loras. Then it's cached and the loader becomes near-instant. There's nothing to tune here; the interesting knobs - the seed and the gamma randomness dial - live on the run node.

    One mechanism detail worth knowing: unlike the edge model, the sketch variant swaps the UNet's input convolution for a "twin conv" - a pretrained branch and a trainable branch blended by a scalar. That's how the same network can take a sketch as conditioning instead of an edge map, and it's why the sketch side gets its own randomness control. You don't need to care about any of that to use it; it just explains why the two loaders aren't interchangeable despite looking identical.

    Where it fits

    The pack ships a "painter workflow" - a PainterNode feeding Img2ImgTurboSketchRun - which is the real use case: draw a scribble, get a finished image back fast enough to iterate live. Think of it as the quick-and-dirty version of a scribble ControlNet, except the whole thing runs in a single denoising step with no CFG, no sampler, and no step-count settings to babysit.

    How to install it

    Same pack, same install. ComfyUI Manager: search ComfyUI-Img2Img-Turbo and install. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chaojie/ComfyUI-Img2Img-Turbo
    pip install -r ComfyUI-Img2Img-Turbo/requirements.txt
    

    Restart ComfyUI. Requirements are peft, diffusers==0.25.1, transformers==4.35.2, xformers>=0.0.20.

    Gotchas

    • The diffusers version is the classic breakage. The README warns that if another node upgrades diffusers you should re-pin it: pip install 'diffusers>=0.24.0,<=0.25.1'. The code depends on diffusers APIs that later versions moved on from.
    • CUDA only. .cuda() is called unconditionally; no CPU or MPS path.
    • First run takes a while and prints download progress to the console. That's normal.

    It's a one-trick loader with a big first-run download and a genuinely fun workflow on the other side.

    CategoryImg2ImgTurbo

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    modelImg2ImgTurboSketchModel