Get ComfyUI running locally, then wire a txt2img graph with a LoRA and ESRGAN upscaling.
What you'll build #
A local ComfyUI install running Stable Diffusion 1.5, plus a node-based text-to-image workflow you'll extend with a LoRA for style control and an ESRGAN upscaler β all copy-pasteable from a clean machine.
Prerequisites #
Verified against ComfyUI v0.33.1 (August 2026) with PyTorch CUDA 13.0 wheels.
Python3.12 or 3.13 (3.13 is the best-supported; 3.14 works but some custom nodes break) andGit- An NVIDIA GPU with 6 GB+ VRAM for comfortable SD 1.5 use. AMD on Linux works via ROCm (swap the torch install for
--index-url https://download.pytorch.org/whl/rocm7.2
); Apple silicon works via PyTorch nightly. No GPU at all? Add--cpu
to the launch command β slow but functional. - ~8 GB free disk for the code and models
Commands below are for Linux/macOS; on Windows use venv\Scripts\activate
and the same pip commands (or grab the portable build from comfy.org and skip section 1).
1. Install ComfyUI #
Clone the repo, create a virtual environment (ComfyUI's pinned deps will conflict with a system Python), and install PyTorch before the rest of the requirements:
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
python3 -m venv venv
source venv/bin/activate
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu130
pip install -r requirements.txt
2. Download a checkpoint #
Checkpoints go in models/checkpoints
. Grab the fp16 SD 1.5 base model from Comfy-Org's Hugging Face archive (~2 GB):
curl -L -o models/checkpoints/v1-5-pruned-emaonly-fp16.safetensors \
"https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors"
3. Run the default txt2img workflow #
python main.py
Open http://127.0.0.1:8188
. Load the default workflow via Workflow β Browse Templates β Image Generation (or it's already on the canvas on first launch). The graph reads left to right:
flowchart LR
LC[Load Checkpoint] --> CT1[CLIP Text Encode<br>positive]
LC --> CT2[CLIP Text Encode<br>negative]
EL[Empty Latent Image] --> KS[KSampler]
CT1 --> KS
CT2 --> KS
LC --> KS
KS --> VD[VAE Decode] --> SI[Save Image]
Pick v1-5-pruned-emaonly-fp16.safetensors
in Load Checkpoint, type a prompt into the positive CLIP Text Encode node, and hit Run (Ctrl+Enter). Images land in the output/
folder.
4. Wire in a LoRA #
LoRAs are small adapter weights that restyle a checkpoint. They live in models/loras
. The official docs use the SD 1.5-compatible blindbox LoRA from Civitai (log in on the site if the direct download 401s):
curl -L -o models/loras/blindbox_V1Mix.safetensors \
"https://civitai.com/api/download/models/32988?type=Model&format=SafeTensor&size=full&fp=fp16"
Back in the browser, press R to refresh the model lists, then double-click empty canvas, search Load LoRA, and splice it between the checkpoint and everything downstream: Load Checkpoint's MODEL
β Load LoRA model
input, CLIP
β clip
input; then Load LoRA's outputs feed the KSampler and both CLIP Text Encode nodes. strength_model
scales the LoRA's effect on the diffusion weights, strength_clip
on the text encoder β 1.0 for both is fine here. Add the trigger words chibi, full body
to your prompt and run again; you'll get toy-figurine style renders. Chain a second Load LoRA node after the first to stack styles.
5. Add upscaling #
SD 1.5 natively generates 512Γ512. Model-based upscaling gets you a clean 4Γ without re-diffusing. Download RealESRGAN into models/upscale_models
:
curl -L -o models/upscale_models/RealESRGAN_x4plus.pth \
"https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth"
Refresh again, add a Load Upscale Model node and an Upscale Image (using Model) node. Wire VAE Decode's IMAGE
into the upscaler's image
input, the model into upscale_model
, and hang a second Save Image off the output so you keep both sizes.
Verify it works #
On launch the terminal should show your GPU and the server address:
Total VRAM 12282 MB, total RAM 32017 MB
pytorch version: 2.8.0+cu130
Device: cuda:0 NVIDIA GeForce RTX 3060
Starting server
To see the GUI go to: http://127.0.0.1:8188
After a run, the progress bar in KSampler completes, got prompt
and Prompt executed
appear in the terminal, and output/
contains a 512Γ512 image plus a 2048Γ2048 upscaled one.
Troubleshooting #
β you got CPU-only wheels (usually by runningAssertionError: Torch not compiled with CUDA enabled
pip install -r requirements.txt
first). Fix:pip uninstall torch torchvision torchaudio
, then reinstall with the--extra-index-url https://download.pytorch.org/whl/cu130
command from step 1.β the model file is corrupt, usually an HTML login page saved assafetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge
.safetensors
. Checkls -lh
; if it's kilobytes, re-download using the/resolve/
URL (not/blob/
) or after logging in to Civitai.β your GPU ran out of VRAM mid-sample. Relaunch withtorch.OutOfMemoryError: CUDA out of memory
python main.py --lowvram
, or drop Empty Latent Image back to 512Γ512.Checkpoint dropdown showsβ the file is in the wrong folder or was added while the server was running. Confirm it's innull
models/checkpoints
(not a subfolder of your home dir) and pressR to refresh.
Next steps #
Install ComfyUI-Manager (git clone https://github.com/ltdrdata/ComfyUI-Manager
inside custom_nodes/
, then restart) β it auto-installs missing custom nodes when you import someone else's workflow. From there, browse the built-in template library for SDXL and image-to-image graphs, work through the official examples, and remember any PNG ComfyUI generates embeds its full workflow β drag one onto the canvas to reload it.
Sources & further reading #
Manual Installation - Local Self-Hostedβ docs.comfy.org - ComfyUI First Image Generationβ docs.comfy.org - ComfyUI LoRA Exampleβ docs.comfy.org - ComfyUI Image Upscale Exampleβ docs.comfy.org - ComfyUI READMEβ github.com - ComfyUI-Managerβ github.com
Mariana SouzaΒ· Senior Editor
Mariana covers the fast-moving world of machine learning and generative AI, with a particular focus on how these technologies are reshaping development workflows. When she isn't stress-testing the latest foundation models, she's usually at a local hackathon.
Discussion 0 #
No comments yet
Be the first to weigh in.