GPU Compute / Recipe
Image and video batch jobs
Run Diffusers, ComfyUI, or video synthesis pipelines as one-off GPU jobs. Billing stops automatically when the script exits — no persistent endpoint to manage.
npm install -g badgr-cli then badgr login. Setup guide →Batch image generation with Diffusers
Run a Python script that generates images from a list of prompts. Pass model IDs and tokens via --env:
badgr run python generate.py --gpu L40S \ --env HF_TOKEN=$HF_TOKEN \ --env MODEL_ID=black-forest-labs/FLUX.1-schnell
A typical generate.py using Diffusers:
import os, torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained(
os.environ["MODEL_ID"],
torch_dtype=torch.bfloat16,
).to("cuda")
prompts = [
"A sunset over mountain peaks",
"A futuristic city skyline, photorealistic",
"Abstract watercolor painting of a forest",
]
for i, prompt in enumerate(prompts):
image = pipe(prompt, num_inference_steps=4).images[0]
image.save(f"output_{i}.png")
print(f"Saved output_{i}.png")Use a pre-built image
Skip install time by running a container that already has Diffusers, CUDA, and your dependencies. Pass model config via --env:
badgr run \ --image ghcr.io/my-org/diffusers-runner:latest \ --gpu L40S \ --env MODEL_ID=black-forest-labs/FLUX.1-schnell \ --env OUTPUT_DIR=/app/outputs
ComfyUI workflow
Execute a saved ComfyUI workflow headlessly:
badgr run \ --image ghcr.io/my-org/comfyui-runner:latest \ --gpu A100 \ --env WORKFLOW_FILE=workflow.json \ --env OUTPUT_DIR=/app/outputs
Video synthesis
Run a video generation script — for example with CogVideoX or Wan:
badgr run python generate_video.py \ --gpu H100 \ --env HF_TOKEN=$HF_TOKEN \ --env PROMPT="A time-lapse of a blooming flower"
Use the H100 for video models that require large VRAM. Billing stops when the script exits.
Detach and collect outputs later
Use --detach for long-running jobs — badgr returns the job ID immediately:
# Launch and return immediately badgr run python generate.py --gpu L40S --env HF_TOKEN=$HF_TOKEN --detach # Follow logs when ready badgr logs <deployment-id>
Options
--gpu <type>L40S or A100 for images; H100 for large video models--image <ref>Custom container image with your model and dependencies--env KEY=VALUESet environment variables — repeatable--detachReturn job ID immediately, don't stream logs--max-runtime <min>Auto-stop after N minutes (recommended to cap spend)--max-cost <$>Auto-stop when spend reaches this amountNext steps