Nodes/ImageReward/ImageRewardLoader
ComfyUI Node

ImageRewardLoader

The node that drags a 1.8 GB taste test into your workflow

By ZaneA·Created 3 years ago·Updated 2 years ago· 34
ImageRewardLoader
    • IMAGEREWARD_MODEL
    modelImageReward-v1.0

    ImageRewardLoader is the boring half of a two-node pair, and that's the point. ImageReward is a scoring model trained on human preference judgments - a "taste meter" that looks at an image, looks at your prompt, and returns a number for how well they match. The loader's whole job is to get that model's weights into memory and hand them to its partner, ImageRewardScore, over an opaque wire. It has exactly one input and one output, and after the first run you will never think about it again.

    So why bother? Because the Score node it feeds is genuinely useful for the "did this come out good?" problem that ComfyUI otherwise leaves to you. People wire it up as a quality gate before saving, to auto-reject the cursed renders (melted faces, extra fingers, the usual), or to rank a batch of candidates and keep the winner. The loader is the unglamorous prerequisite: no loader, no taste test.

    How it works

    Under the hood it's a thin wrapper around the official image-reward pip package. load_model() calls ImageReward.load("ImageReward-v1.0"), which pulls a single ~1.8 GB checkpoint (ImageReward.pt) from HuggingFace on first run - the model now lives at zai-org/ImageReward, the renamed home of the original THUDM repo - and caches it in ~/.cache/ImageReward. The architecture is a BLIP ViT-Large visual encoder plus a small MLP scoring head. You don't need to know any of that to use it, but it's why the download is a gigabyte and a half instead of a few hundred megabytes.

    The node returns the in-memory model as an IMAGEREWARD_MODEL object, which is not something you can inspect or serialize - it's a handle, and its only destination is the model input of ImageRewardScore.

    The inputs that matter

    There's just one, and it's prefilled:

    • model (STRING, default ImageReward-v1.0) - the model name passed straight to the ImageReward loader. Leave it alone unless you've fine-tuned your own checkpoint, in which case you can pass a local file path instead.

    Output: a single IMAGEREWARD_MODEL, which you wire into the model input of ImageRewardScore.

    Install

    Via ComfyUI Manager, search "ImageReward" (pack title: ZaneA/ComfyUI-ImageReward). Or do it by hand:

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

    Then restart ComfyUI. The requirements are image-reward==1.4 and OpenAI's clip built from its git repo. Two gotchas here. First, the clip install compiles from source, so you need a working toolchain - Windows users occasionally stub a toe on this. Second, image-reward pins old versions of things like timm and fairscale, and ComfyUI custom nodes all share one Python environment with no isolation. If another node needs a newer timm, they can fight. That's a classic ComfyUI ecosystem problem, not this pack's fault, but know it going in.

    Common issues

    The most common "failure" is actually a first-run surprise: nothing appears wrong, then ComfyUI quietly downloads ~1.8 GB on your first queue run. Give it a minute. If it errors out there, check that you have network access to HuggingFace - there's no offline mode. If the model loads but scoring misbehaves, that's the Score node's problem, not this one's. This loader is the rare node that just... works, once the dependency dust settles.

    CategoryImageReward

    Inputs (1)

    NameTypeDefaultDescription
    modelSTRINGImageReward-v1.0

    Outputs (1)

    NameTypeDescription
    IMAGEREWARD_MODELIMAGEREWARD_MODEL