RunPod GPU orchestration pipeline
Find a file
Andrés Buitrago 83a7725ca7 Fix: model paths to ComfyUI/models/, chmod path, image download method
- setup_models.sh: download to /workspace/ComfyUI/models/ not /workspace/models/
  (ComfyUI looks in its own models/ dir, not /workspace/models/)
- comfyui_gen.py: fix chmod path (setup.sh → setup_models.sh)
- comfyui_gen.py: fix additional LoRA download paths to ComfyUI/models/loras/
- comfyui_gen.py: rewrite download_image() — single-shot base64 read with
  regex extraction instead of broken chunked dd approach. Simpler, faster,
  more reliable for ~2MB PNG files.
2026-07-12 23:54:20 -05:00
docs Implement full pipeline: infrastructure, generation, training 2026-07-12 22:40:39 -05:00
generation Fix: model paths to ComfyUI/models/, chmod path, image download method 2026-07-12 23:54:20 -05:00
infrastructure Fix GPU selector: use GraphQL id field, update datacenter mapping 2026-07-12 23:12:42 -05:00
registry Implement full pipeline: infrastructure, generation, training 2026-07-12 22:40:39 -05:00
training Implement full pipeline: infrastructure, generation, training 2026-07-12 22:40:39 -05:00
.env.example Initial commit: RunPod GPU orchestration pipeline 2026-07-12 07:46:51 -05:00
.gitignore Implement full pipeline: infrastructure, generation, training 2026-07-12 22:40:39 -05:00
README.md Initial commit: RunPod GPU orchestration pipeline 2026-07-12 07:46:51 -05:00
requirements.txt Implement full pipeline: infrastructure, generation, training 2026-07-12 22:40:39 -05:00
SPEC.md Initial commit: RunPod GPU orchestration pipeline 2026-07-12 07:46:51 -05:00

Hermes RunPod Pipeline

Compute infrastructure orchestrator for AI image generation on the RunPod GPU cloud. Automated pod lifecycle management with multi-region GPU selection, model deployment, and inference workflow automation.

Overview

This toolchain manages the full lifecycle of GPU-accelerated image generation on RunPod:

  • Pod orchestration — Spin up GPU pods across 3 regions (Americas, Europe, Asia) with automatic failover. Supports RTX 4090, RTX 5090, and A100 80GB on Secure Cloud.
  • Model deployment — Download and configure diffusion models from HuggingFace at pod boot time. Parallel download architecture achieves <30s cold start for full model stacks.
  • ComfyUI automation — Deploy ComfyUI, submit workflow JSONs, poll for completion, and retrieve results — all through SSH-tunnelled API calls.
  • LoRA training — Fine-tune diffusion models on custom datasets using AI-Toolkit, with automatic dataset preparation and weight distribution.

Quick Start

# Install dependencies
pip install -r requirements.txt

# Configure credentials (see docs/credentials.md)
cp .env.example .env
# Edit .env with your RunPod API key and HuggingFace token

# Generate images with a trained LoRA
python generation/comfyui_gen.py \
  --lora "https://files.catbox.moe/xxxxx.safetensors" \
  --lora-strength 0.85 \
  --prompts "subject, photorealistic, detailed" \
  --count 5

Features

  • Multi-region GPU selection — Automatically finds available GPUs across Americas → Europe → Asia with 3×3 fallback (3 GPU types × 3 regions)
  • Parallel model loading — Downloads FLUX transformer, text encoders, VAE, and LoRAs concurrently while ComfyUI installs its dependencies
  • MD5 integrity verification — All model weights and output images are checksum-verified before use
  • Cost-optimized — Pods terminate automatically after generation completes. Typical sessions cost $0.080.10.
  • Composable — Infrastructure modules (GPU selection, SSH, RunPod API) are reusable across training and generation pipelines

GPU Selection Logic

GPU Cloud Hourly Region Priority
RTX 4090 24GB Secure ~$0.69/hr Americas → Europe → Asia
RTX 5090 32GB Secure ~$0.69/hr Americas → Europe → Asia
A100 80GB Secure ~$1.19/hr Americas → Europe → Asia

Fallback order: 4090 → 5090 → A100, each tried across all 3 regions.

Project Structure

├── generation/
│   ├── comfyui_gen.py          # Image generation pipeline
│   ├── setup_models.sh         # Parallel model download script
│   └── workflow_builder.py     # ComfyUI workflow generator
├── training/
│   ├── train_lora.py           # LoRA fine-tuning pipeline
│   ├── setup_training.sh       # Training environment setup
│   └── config_templates/       # AI-Toolkit YAML templates
├── infrastructure/
│   ├── gpu_selector.py         # GPU + region selection
│   ├── runpod_utils.py         # RunPod API wrappers
│   └── ssh_utils.py            # SSH connection management
├── registry/
│   └── lora_manifest.json      # Trained model registry
└── docs/
    ├── credentials.md          # API key setup guide
    └── troubleshooting.md      # Known issues and fixes

Requirements

  • Python 3.10+
  • RunPod account with funded balance
  • HuggingFace account with read token
  • SSH key registered with RunPod

Configuration

See docs/credentials.md for setting up API keys and authentication.

Cold Start Performance

Phase Time
Pod provisioning + GPU allocation 3060s
Model downloads (parallel, 22.5 GB) ~30s
ComfyUI boot + VRAM load 510s
First inference (28 steps, 832×1216) 1015s
Total ~1.52 min

License

MIT