Set up ComfyUI

Run on a shared GPU machine

These notes come from running the pose-frame benchmark (#79) on a Windows desktop with a 12 GB RTX 3060 that already ran a ComfyUI of its own.

Use the ComfyUI that is already running. A second ComfyUI on the same card competes with the first for VRAM. Each process keeps its own models loaded, so the second one runs short and moves weights in and out of system RAM. A 1024px SDXL frame with an OpenPose ControlNet took 310 to 415 seconds there. The same graph sent to the ComfyUI already running took about 31 seconds a frame, and 55 for the first while the models loaded. The graphs use only core nodes, so any recent ComfyUI can run them. Point COMFYUI_BASE_URL, or the benchmark's --host, at the server that is already running.

Check its models before sending work. /object_info/<node> lists the files a loader node can see, without generating anything:

curl -s http://127.0.0.1:8188/object_info/CheckpointLoaderSimple   # input.required.ckpt_name[0]
curl -s http://127.0.0.1:8188/object_info/LoraLoader               # input.required.lora_name[0]
curl -s http://127.0.0.1:8188/object_info/ControlNetLoader         # input.required.control_net_name[0]

LoraLoader's first required input is model, not the file list, so read lora_name by its key. A file name only says that a file exists. Compare SHA-256 hashes against the recipe's model audit before you call a result reproducible (certutil -hashfile <file> SHA256 on Windows, shasum -a 256 elsewhere).

Match the PyTorch build to the ComfyUI release. ComfyUI 0.46.0 failed at startup on PyTorch 2.6 (a comfy_kitchen schema error on list[int]). It ran on PyTorch 2.11 with CUDA 12.8. When you set up a new ComfyUI, install the PyTorch version its requirements name, not whichever one the machine already has.

Drive it over HTTP with a small script. run-benchmark.py uses only Python's standard library. It uploads each pose with /upload/image, sends the graph to /prompt, polls /history/<id> and fetches the PNG from /view. It writes each frame and a runs.json with the seed, strength, seconds and SHA-256, and skips frames already on disk. A stopped run starts again where it left off, which matters on a machine someone else is using.

On Windows over ssh, the remote shell is cmd.exe. Run one step per ssh call, because a long && chain can stop early without an error. Stop processes by PID, never by image name: taskkill /IM python.exe would also stop the owner's ComfyUI.