Qwen-Image text-to-image (H100)
Generate images from text with Qwen-Image on an H100.
Hardware: gpu_1x_h100. Save the files under Source files into a folder named
qwen-image-text-to-image, then follow the steps below.
Runs Qwen/Qwen-Image with diffusers QwenImagePipeline to render a prompt containing in-image text to a PNG. The model is ungated and Apache-2.0 licensed: no Hugging Face token or API key is needed.
The ~20B-parameter transformer uses ~41 GB in bf16; together with the text
encoder, VAE and inference workspace it fits an 80 GB H100 (gpu_1x_h100).
Measured peak: 60246 MiB reserved (staging, 2026-10-08).
Files
supercomputer.json—pytorch/pytorch:2.6.0-cuda12.4-cudnn9-develwith the Hugging Face cache on theqwen-image-weightsvolume at/workspace/.cache/huggingface, persistent acrosssuper stopand resume.run.sh— installs exact released dependency versions (diffusers 0.35.1), loads the bf16 pipeline on CUDA, and writes/workspace/out/qwen_image.png. Uses the pipeline's default image dimensions and inference steps, with the upstream recommended true CFG scale of 4 and a blank negative prompt.
Run
cd examples/qwen-image-text-to-image
super create --sku gpu_1x_h100 # → s-xxxx
super run . --script run.sh --on s-xxxx
super run . --script run.sh --on s-xxxx -- 'A bookstore with a sign reading "OPEN BOOKS"'The default prompt depicts a cozy bookshop with a sign reading "OPEN BOOKS". The first run installs dependencies and downloads tens of GB of weights; subsequent runs reuse the mounted cache. A cold run on staging (1x H100, 2026-10-08) took 962 s end to end and peaked at about 59 GiB of GPU memory.
Get the results out
super download s-xxxx /workspace/out/qwen_image.png ./qwen_image.png
super stop s-xxxxNotes
SUPERCOMPUTER_STRESS_DURATION_Sretains the stress harness's soak behavior: generate extra images under/workspace/out/gen/until the requested window ends, then write the final pass artifact. Unset/0 generates one image.OUTcan override the final artifact path.- The base image supplies PyTorch 2.6.0;
run.shprepends/opt/conda/binso Python and pip use that CUDA environment. supercomputer.jsonpins HTTPS certificate variables to the system CA bundle for runtime pip and model downloads.
Source files
run.sh
#!/usr/bin/env bash
# Run inside a supercomputer session (see README.md).
set -euo pipefail
# The base image's torch+CUDA environment lives in conda, outside super run's PATH.
export PATH="/opt/conda/bin:$PATH"
OUT="${OUT:-/workspace/out/qwen_image.png}"
# Preserve the stress harness's window, including dependency install and model load.
STRESS_END=$(( $(date +%s) + ${SUPERCOMPUTER_STRESS_DURATION_S:-0} ))
PROMPT="${1:-A cozy bookshop at dusk, with a clearly legible sign reading \"OPEN BOOKS\", warm lighting and detailed shelves.}"
python -m pip install \
diffusers==0.35.1 transformers==4.55.4 accelerate==1.10.1 \
safetensors==0.6.2 sentencepiece==0.2.1 Pillow==11.3.0
python - "$PROMPT" "$OUT" "$STRESS_END" <<'PYTHON'
import sys
import time
from pathlib import Path
import torch
from diffusers import QwenImagePipeline
prompt, output, stress_end = sys.argv[1:]
output = Path(output)
stress_end = int(stress_end)
pipe = QwenImagePipeline.from_pretrained(
"Qwen/Qwen-Image", torch_dtype=torch.bfloat16
).to("cuda")
output.parent.mkdir(parents=True, exist_ok=True)
n = 0
while True:
image = pipe(prompt=prompt, negative_prompt=" ", true_cfg_scale=4.0).images[0]
if time.time() >= stress_end:
image.save(output)
break
gen_dir = output.parent / "gen"
gen_dir.mkdir(exist_ok=True)
image.save(gen_dir / f"qwen_image_{n:04d}.png")
n += 1
if n:
print(f"soak: generated {n} extra images")
print(f"wrote {output}")
print(f"peak_vram_mib={torch.cuda.max_memory_reserved() // 2**20}")
PYTHONsupercomputer.json
{
"sku": "gpu_1x_h100",
"image": {
"base": "pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel",
"apt": [
"git",
"ca-certificates",
"build-essential",
"python3-dev"
],
"env": {
"PYTHONUNBUFFERED": "1",
"HF_HOME": "/workspace/.cache/huggingface",
"HF_HUB_CACHE": "/workspace/.cache/huggingface/hub",
"SSL_CERT_FILE": "/etc/ssl/certs/ca-certificates.crt",
"PIP_CERT": "/etc/ssl/certs/ca-certificates.crt",
"REQUESTS_CA_BUNDLE": "/etc/ssl/certs/ca-certificates.crt"
}
},
"volumes": [
{
"name": "qwen-image-weights",
"mount": "/workspace/.cache/huggingface"
}
]
}