ComfyUI Node

PIH Model Loader

The Loader That Makes PIH Work (and the Google Drive Gotcha)

By chrismyau·Created 3 months ago·Updated 3 months ago· 0
PIH Model Loader
    • PIH Processor

    Model loaders are the most boring nodes in ComfyUI, right up until the checkpoint isn't there. PIH Model Loader is where 90% of the friction with this pack lives, because it's the node that downloads the weights - and that download goes through Google Drive.

    It loads ckpt_g39.pth, the checkpoint for Adobe's CVPR 2023 PIH harmonization model (~93M parameters, trained on the Artist Retouched Dataset), and hands it out as a PIH Processor object for the PIH Harmonize node to consume. No inputs, no settings, nothing to tune. You drop it on the canvas, it does its thing, done.

    What happens on first run

    The first time you execute the graph, the loader checks for the file at ComfyUI/models/PIH/ckpt_g39.pth. If it's missing, it creates the folder and pulls the weights with gdown, straight from the Google Drive link in the README.

    And here's the thing about Google Drive downloads from a script: they fail. Quota limits, virus-scan warnings, rate limits - Google doesn't love anonymous automation, and this is one of those links. When it fails, the node raises an error that tells you exactly what to do: download the file manually and drop it at ComfyUI/models/PIH/ckpt_g39.pth. You can also skip the drama entirely and pre-download it before your first run. Both paths land at the same place, so if the auto-download chokes on you, don't fight it - one manual download and the node is boring again forever.

    What it actually needs

    The dependency story here is refreshingly light. The pack's requirements file lists exactly two packages: Pillow and gdown. Everything heavy - PyTorch, the network code - comes from ComfyUI's own environment, so there's no second Python runtime to babysit and no version conflict nightmare. The model builds on CUDA if it's available and falls back to CPU, but this is a CNN doing a 512×512 prediction pass plus a full-res reapply; on CPU you'll feel every second. Run it on a GPU if you have one.

    A naming trap worth knowing

    The two nodes in this pack live in different menu categories. This loader is filed under "Adobe PIH", while PIH Harmonize sits under "Harmonization/PIH". If you add the Harmonize node, save your workflow, and later search for the loader expecting it in the same menu section, you'll think it's missing. It's not - it's one tab over.

    Install

    ComfyUI Manager, search ComfyUI PIH, install, restart. Manual, same as every custom node:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chrismyau/ComfyUI-PIH
    cd ComfyUI-PIH
    pip install -r requirements.txt
    

    Then restart ComfyUI. One loader per graph is plenty - wire its PIH Processor output into the PIH Harmonize node and you're compositing.

    The honest caveat

    This is a tiny, zero-traction port (you'll find almost no community discussion of it anywhere), so don't expect the model to be a match for diffusion-based relighting if what you actually want is a full relight. What it is: the correct, boring, reliable front half of a tool that harmonizes a cutout without regenerating a single pixel. The loader is the part that just needs to work - and once that checkpoint is sitting in ComfyUI/models/PIH/, it does.

    CategoryAdobe PIH

    Inputs (0)

    No inputs

    Outputs (1)

    NameTypeDescription
    PIH ProcessorPIH_PROCESSOR