Nodes/ComfyUI-LoRA-Lens/LoRA Test — Grid Collector
ComfyUI Node

LoRA Test — Grid Collector

The Grid-Maker That Waits Until Every Cell Is Filled

By astropuzzo·Created 2 months ago·Updated about a month ago· 0
LoRA Test — Grid Collector
  • images
    run_idmanual_run
    prompt_index0
    lora_index0
    prompt_count1
    lora_count1
    prompt_labelPrompt 1
    prompt_text
    lora_labelLoRA
    output_prefixLoRA_Test
    grid_mode
    cell_width384
    label_height64
    font_size22

    If you've ever compared LoRAs by juggling a wall of SaveImage nodes and squinting at filenames, LoRATestGridCollector is the node that ends that. It's the sink at the end of ComfyUI-LoRA-Lens' hand-built test flow: you feed it each generated image as the batch runs, and it quietly stashes the image, waits until the whole prompt×LoRA matrix is done, then renders clean, labeled comparison grids for you. It never outputs to the graph - it is the end of the line, an output node that returns preview images to the UI instead.

    How it works. Every image that arrives is saved as a "cell" - a PNG plus a JSON sidecar - into ComfyUI/output/LoRA_Test_Grids/<run_id>/_cells/, named by position like p000_l002.png. The position is what matters: prompt_index and lora_index tell it where in the matrix this image belongs, and prompt_count/lora_count tell it the shape of the whole thing. When all cells for one prompt row exist, it renders a per-prompt labeled grid. When every cell in the matrix exists, it renders a master grid with prompt excerpts and LoRA labels, writes a manifest.json, and fires a lorapromptqueue.matrix_complete websocket event that the test controller (and the dashboard) listen for to know the run is done and analysis can start.

    Two mechanical details worth knowing. It's an output node, so ComfyUI already treats it as always-run - but its IS_CHANGED also returns NaN on purpose, the classic idiom (covered in the KB's comfyui-node-plumbing.md) that defeats the execution cache so a collector can never be skipped. Second, all the cell-writing and grid-rendering happens under a lock, because in a batched run multiple instances may execute close together.

    Inputs that matter:

    • images - the current cell's image, straight from your VAE-decode.
    • run_id - names the output folder. Make it unique per run. Reusing one is how stale cells poison a grid.
    • prompt_index / lora_index and prompt_count / lora_count - the cell's position and the matrix's shape.
    • prompt_label, prompt_text, lora_label - the captions that go on the grid.
    • grid_mode - per_prompt_and_master (both), master_only, per_prompt_only, or off. Off still saves every cell; it just never renders a grid.
    • cell_width, label_height, font_size - grid cosmetics (width in 16px steps, 160–1024).

    The trap most people hit: run_id collisions. The node accumulates cells per run folder, so if you reuse a run_id for a new matrix, leftover cells from the previous run can make a row look "complete" when it isn't - or your master grid silently mixes old and new images. Treat run_id like a seed: new run, new id.

    Installation is the shared pack story: ComfyUI Manager (search "ComfyUI LoRA Lens"), or git clone https://github.com/astropuzzo/ComfyUI-LoRA-Lens.git into custom_nodes, install requirements.txt with ComfyUI's own Python, restart. The face-analysis dependencies (insightface, onnxruntime-gpu) only matter if you use the analyzer - the grid collector itself runs on stock ComfyUI, which is part of why it's a handy node to have even if you never touch the ranking features.

    Categoryautomation/LoRA testing

    Inputs (14)

    NameTypeDefaultDescription
    imagesIMAGE
    run_idSTRINGmanual_run
    prompt_indexINT00–10000
    lora_indexINT00–10000
    prompt_countINT11–10000
    lora_countINT11–10000
    prompt_labelSTRINGPrompt 1
    prompt_textSTRING
    lora_labelSTRINGLoRA
    output_prefixSTRINGLoRA_Test
    grid_modeCOMBO4 options: per_prompt_and_master, master_only, per_prompt_only, off
    cell_widthINT384160–1024
    label_heightINT6432–180
    font_sizeINT2210–64

    Outputs (0)

    No outputs