HYPIR Image Restore
The diffusion restorer that's trying not to change your photo
- image
- image
- seed
- prompt
If you've ever fed a faded family scan through a generative upscaler and got back a photo where your grandfather's face is now a handsome stranger, you know the problem HYPIR is answering. It's the same XPixelGroup lab as SUPIR - same "restoration as diffusion" idea - but built on Stable Diffusion 2.1 instead of SDXL, and tuned to be conservative. Where SUPIR captions your image with an LLM and rebuilds it toward what that caption describes, HYPIR just cleans and upscales what's actually there. People who run it describe it exactly that way: reach for it "if you don't want to change the image much."
This node (HyperComfyUIHYPIRRestore) wraps the upstream HYPIR method so you can run it inside ComfyUI. It lands under Hyper Image Restoration/HYPIR, and its happy place is film scans, old prints, and other genuinely damaged sources where you want repairs, not reinvention. Know the context though: by 2026 the default for this job is SeedVR2 or Qwen-Edit, and Comfy Org's upscaling handbook conspicuously left SUPIR and HYPIR out. This is a niche tool for a specific taste - keeping the source recognizable - not the state of the art.
How it works
Under the hood it's a one-step diffusion restore: your image gets bicubic-upscaled to the target size, VAE-encoded into SD2.1's latent space, then pushed through a LoRA-tuned UNet at a fixed timestep (200) that predicts the clean latent in a single denoising step. Decode and you're done - no multi-step sampling loop. That's why it's so much faster than SUPIR and runs fine on older GPUs, and the tiled VAE encode/decode keeps big scans from OOMing you.
The mechanism is worth remembering when you hit the inputs: nothing here touches your ComfyUI checkpoints. The node loads its own diffusers copy of SD2.1 (UNet, VAE, text encoder, tokenizer, scheduler) plus the HYPIR LoRA - a small ComfyUI inside a node, and the first run downloads several gigabytes before anything happens.
The inputs that matter
The README calls image, prompt, base_model_path, weight_name, upscale, patch_size/stride, and scale_by required, but you mostly care about four:
- upscale (default 4, range 1–8) - the factor applied before restoration. 2× on a scan that's already big, 4× if you need print size.
- scale_by -
factor(default) orlongest_side. Picklongest_sideand set target_longest_side when you want a specific output dimension instead of a multiplier. - patch_size / stride (512 / 256) - tile size and overlap for latent processing. This is your memory dial: smaller patches, more VRAM headroom.
- weight_name - dropdown of LoRA files in the node's
models/folder.
Two more worth knowing, both optional: enhancement_strength blends the restored output with the original (0.5 = half-and-half - the honest "I don't fully trust it" setting), and detail_boost (0–1, with detail_sigma for the blur radius) adds an unsharp-mask-style crispness layer that scans often want.
Outputs: image wires to any Save Image node, seed back into a seed control if you want reproducible runs, and prompt is the text that was actually fed to the model - handy because it's the third output, not the image, that tells you whether your enhancement did anything.
There's also a prompt-enhancement sidecar: flip enhance_prompt on and the node sends your notes to an LM Studio chat-completions endpoint (lm_endpoint default http://127.0.0.1:1234, lm_model from LM Studio's UI) and rewrites them into a restoration prompt. It's the pack's one distinctive feature, it's entirely optional, and for plain scans you can ignore it - an empty prompt just means prompt-free restoration.
Installing it
ComfyUI Manager → search "HYPIR" → Install → restart. Or the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/HYPIR-ComfyUI
# restart ComfyUI
Then two downloads, and this is where people get burned:
- The LoRA: grab
HYPIR_sd2.pthfromhttps://huggingface.co/lxq007/HYPIR/tree/mainand drop it inHYPIR-ComfyUI/models/. - A diffusers-format SD2.1 base. The default
base_model_pathofstabilityai/stable-diffusion-2-1-base(512px) works out of the box and downloads on demand;stabilityai/stable-diffusion-2-1(768px) is sharper if you want it. If you prefer offline:huggingface-cli download stabilityai/stable-diffusion-2-1 --local-dir "<your path>" --local-dir-use-symlinks Falseand pointbase_model_pathat that folder.
Dependencies (torch, diffusers, transformers, peft, accelerate, numpy, Pillow, tqdm, requests) are all present in recent ComfyUI builds, so a stock install usually just works.
Common issues
- "Missing config.json" - you pointed
base_model_pathat a raw checkpoint (.safetensors) instead of a real diffusers directory. Give it the repo id or a proper diffusers folder. - Out of memory - lower
patch_size, raisestride, or switch toscale_by = longest_sidewith a smallertarget_longest_side. - LM Studio not triggering - verify
lm_endpoint/lm_model, make sure the server's running, and watch the console for[HYPIR]warnings; on any failure it silently falls back to your original prompt.
One more thing before you use this for client work: HYPIR is non-commercial only, and this pack ships under a CC BY-NC 4.0 / commercial dual license - you need to contact the author (Eric Hiss) for commercial use. Same shape of trap as SUPIR and InsightFace: the code reads free, the thing you actually need isn't.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| prompt | STRING | — | |
| base_model_path | STRING | stabilityai/stable-diffusion-2-1-base | Diffusers-format directory or Hugging Face repo id (e.g. stabilityai/stable-diffusion-2-1-base). |
| weight_name | STRING | HYPIR_sd2.pth | Name of the HYPIR LoRA weight file placed in the node's models folder. |
| upscale | FLOAT | 4.01–8 | Upscale factor applied before restoration (matches HYPIR defaults). |
| patch_size | INT | 512256–1024 | Tile size used for latent processing and VAE tiling. |
| stride | INT | 256128–1024 | Stride between tiles. Lower values improve seam quality at the cost of time. |
| scale_by | STRING | factor | Choose between fixed upscale factor or fitting to a target longest side. |
| target_longest_sideopt | INT | 2048256–8192 | Used when scale_by=longest_side. Final longest edge after upscaling. |
| seedopt | INT | -1 | Random seed for deterministic noise sampling. Use -1 for random seed each run. |
| enhance_promptopt | BOOLEAN | false | Toggle to rewrite the prompt using an LM Studio chat completion before restoration. |
| lm_endpointopt | STRING | http://127.0.0.1:1234 | LM Studio base URL (without /v1/chat/completions). |
| lm_modelopt | STRING | lmstudio | Model identifier exposed by LM Studio (see the UI > Provider > Model). |
| lm_system_promptopt | STRING | You are an expert photographic conservator working with Stable Diffusion 2.1 and the HYPIR restoration LoRA. Rewrite the provided notes into a concise 1-2 sentence restoration prompt that keeps subjects, era, and mood intact. Emphasise realistic fine detail, natural lighting, gentle noise reduction, and faithful colour recovery. Do not invent new elements, props, or camera changes unless explicitly requested. Return only the final prompt text without quotes. If the user supplies no notes, respond with: 'Restored vintage photograph, faithful colours, natural film grain preserved, realistic detail and gentle contrast.' Example: Restored 1950s family portrait, smiling couple on front porch, warm evening light, crisp yet natural detail, subtle grain preserved. | System prompt fed to LM Studio when enhancing text prompts. |
| lm_temperatureopt | FLOAT | 0.600–2 | Sampling temperature passed to LM Studio. |
| lm_max_tokensopt | INT | 12016–512 | Maximum number of tokens generated by LM Studio for the enhanced prompt. |
| enhancement_strengthopt | FLOAT | 1.000–1 | Blend between the original image (0) and the full HYPIR result (1). |
| detail_boostopt | FLOAT | 0.000–1 | Add extra high-frequency detail on top of the restored image. |
| detail_sigmaopt | FLOAT | 1.00.1–5 | Controls the radius of the detail boost blur (higher = broader). |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| seed | INT | — |
| prompt | STRING | — |