Spaces:
Running on Zero
Running on Zero
A real person as the subject reference (Pexels, Oliver Dohrn)
Browse files19 unmodified lines202122232324252628 unmodified lines55565758595859606162636476 unmodified lines1411421431441451461471481491501511521531541551561571581591601611621631641651661671681691 unmodified line17117217314915017417517617717817919 unmodified linesautoencoders. The 62.14 GiB Qwen3-VL conditioner runs in[`minimax-h3-conditioner`](https://huggingface.co/spaces/diffusers-internal-dev/minimax-h3-conditioner), which thisSpace calls over the gradio API for every request — the same conditioner Space, and the same resident weights, thatthe keyframe half [`minimax-h3-generator`](https://huggingface.co/spaces/diffusers-internal-dev/minimax-h3-generator)the keyframe half [`minimax-h3`](https://huggingface.co/spaces/diffusers-internal-dev/minimax-h3)uses.
## Why split28 unmodified lines
## Example assets
`examples/subject.png` is generated (FLUX.1-schnell), `examples/motion.mp4` is a synthetic clip from the parityfixtures, and `examples/voice.wav` is utterance `1462-170145-0022` of`examples/subject.png` is [a studio portrait by OliverDohrn](https://www.pexels.com/photo/casual-portrait-of-smiling-woman-in-studio-31747504/) cropped to head andshoulders — Pexels licence, free to use. `examples/motion.mp4` is a synthetic clip from the parity fixtures, and`examples/voice.wav` is utterance `1462-170145-0022` of[LibriSpeech](https://www.openslr.org/12) `dev-clean` — CC BY 4.0, read from a public-domain LibriVox recording. Itis 16 kHz mono on purpose: the audio VAE wants 32 kHz, so the example exercises the `torchaudio` resample the`ref2va` path needs.76 unmodified linesstops at 14 s because it is the *snapped* count that has to hold for the ceiling: 15 s is 360 frames, which roundsup to 362, i.e. 15.083 s, and is refused.
## GPU time is reserved per request, not per Space
MiniMax-H3 attends over one packed sequence, so what a step costs is a function of that sequence's length alone —and on this half the references dominate it. A single 1344x768 image reference is ~7168 conditioning rows plus thevision block it puts in front of the prompt; a 2.5 s video reference is another ~17000. The same 960x544, 124-framerequest runs 2.4 s/step with no references and 16 s/step with an image and a video.
`get_duration` prices that before the call instead of reserving a flat ceiling for everything. It takes thearguments of the `@spaces.GPU` function, so it has the conditioner's own `text_token_tags` (exact) and the referencefiles (measured from metadata, no decode), and evaluates
```S = text rows + reference rows + target rowsseconds = placement + reference encode + steps * (LINEAR * S + QUADRATIC * S**2) * SAFETY + decode + pad```
fitted on the `t2va` half and checked against live `ref2va` requests to about 10%. It matters beyond tidiness: thepool reserves whatever number it is given, and a flat 900 s is what makes a busy account fail admission with *"Youhave too many ZeroGPU credits allocated to running tasks."* A typical single-image request now reserves ~460 s.
Every request carries the full placement allowance, because nothing on this side knows whether the worker it landson is cold and a cold one pays the lazy 72.16 GiB `PIPE.to("cuda")` inside its first GPU call.
## Space variables
| Variable | Default | Meaning |1 unmodified line| `H3_CONDITIONER` | `diffusers-internal-dev/minimax-h3-conditioner` | The Space this one asks for embeddings. || `H3_AOTI` | `0` | `1` loads the compiled block package. || `H3_PLACEMENT` | `lazy` | `lazy` moves all 72.16 GiB onto the card on the first GPU call and leaves it there; `offload` hands placement to `ComponentsManager.enable_auto_cpu_offload` instead. || `H3_ATTENTION` | `_native_cudnn` | cuDNN's fused kernel, 10–20% faster than the SDPA default and needs nothing installed. flash-attention 3 is sm90-only and this pool is sm120. || `H3_GPU_DURATION` | `900` | Seconds per request; the pool applies a 1.5 duration factor. || `H3_ATTENTION` | `_native_cudnn` | cuDNN's fused kernel, 10–20% faster than the SDPA default and needs nothing installed. flash-attention 3 is sm90-only and this pool is sm120. The two VAEs are pinned to torch SDPA instead: they are float32, which cuDNN has no kernel for. || `H3_GPU_DURATION_MIN` / `_MAX` | `120` / `1500` | Bounds on what `get_duration` may reserve. || `H3_PLACEMENT_ALLOWANCE` | `90` | Seconds of the reservation set aside for a cold worker's placement. || `H3_GPU_SIZE` | `xlarge` | ZeroGPU allocation size. `large` does not fit. |
## Required secretREADME.md+31-5