docs: fix stale comments (20GB→1.2GB, startup merge→on-demand), update codemap.md with turbo
721686d verified |
Download codemap.md from Napol3/Test3lora: direct link, hf CLI and curl.
- Browser
- Download file 4.55 kB
-
https://huggingface.co/spaces/Napol3/Test3lora/resolve/main/codemap.md
- Command line
-
hf download hf://spaces/Napol3/Test3lora/codemap.md
-
curl -L -o codemap.md https://huggingface.co/spaces/Napol3/Test3lora/resolve/main/codemap.md
4.55 kB
A newer version of the Gradio SDK is available: 6.31.0
Repository Atlas: minimax-h3-repo
Project Responsibility
The denoising half of a two-Space MiniMax-H3 deployment on Hugging Face ZeroGPU: joint video + synchronized soundtrack generation, unquantized bf16. The 195.9 GiB checkpoint cannot fit one ZeroGPU Space (150 GB storage cap), so MiniMaxH3Blocks is cut at its text_encoder step. This repo holds the transformer + two autoencoders; the 62 GiB Qwen3-VL conditioner runs in the sibling multimodalart/qwen3vl-conditioner Space and is called over the gradio API on every request.
System Entry Points
app.py— Gradio UI + request orchestration. Runsload_models()at import (77.3 GB startup load on CPU). Entrypoint per README frontmatter (app_file: app.py).requirements.txt— Dependency manifest.diffuserscomes from a pinned WIP PR commit (refs/pull/14371/head@665f5782), not PyPI.README.md— Space config (frontmattersdk_versionmust matchgradio==6.20.0) + design rationale and measured performance.
File Map
| File | Responsibility | Detailed Notes |
|---|---|---|
app.py |
Request flow + Gradio UI | generate → remote /encode → @spaces.GPU _generate → encode_video mux. Owns CANVASES (cross-Space contract), snap_frames (17n+5), placement modes (pack/lazy/offload), get_duration GPU budget estimator. Turbo LoRA: A/B factors stored on CPU (~1.2 GB), merged on-the-fly via B @ A inside @spaces.GPU. |
h3_split_blocks.py |
Split pipeline definition | SequentialPipelineBlocks subclasses for both halves (Conditioner/Generator) and both partitions (t2va/ref2va). Defines the wire-format outputs (prompt_embeds + text_token_tags + resolved height/width/num_frames). |
h3_aoti.py |
AoTI acceleration | maybe_load/patch_blocks = runtime path (strict key bf16/torch2.11/sm120/dynamic, else eager). export_block/compile_and_save/upload = build path for the separate multimodalart/minimax-h3-aoti repo (never called by the Space). |
spaces_constant_binding_patch.py |
AoTI constant binding | Compile-side (register_loose_tensors, write_constant_aliases) + load-side (apply_spaces_constant_binding_patch) glue preventing SIGSEGV from anonymously-lifted export constants. |
requirements.txt |
Pip dependencies | All pins deliberate — see notes in file. |
packages.txt |
Space apt packages | ffmpeg (ZeroGPU system-level, not pip). |
.gitattributes |
HF LFS rules | Standard Space LFS filters for model artifacts. |
AGENTS.md |
Agent instructions | Critical rules, dependency pins, verification steps. |
Data & Control Flow
- Browser/client calls
generate(prompt, image?, last_image?, canvas, duration, steps, seed, upsample, turbo). snap_framesaligns the duration to17*n + 5frames at 24 fps; ifturbo, steps forced to 7.encode_remotecalls the conditioner's/encodeovergradio_client(forwarding the caller's own ZeroGPU token).- Conditioner returns one safetensors file carrying
prompt_embeds(1, num_text_tokens, 5120)bf16 +text_token_tagsint64, with resolvedheight/width/num_framesin metadata + the plan. _generate(decorated@spaces.GPU(duration=get_duration, size=xlarge)) runs the packed-sequence denoise loop + two decoders on GPU. If turbo, A/B factors are moved to CUDA (~1.2 GB) and LoRA is merged/unmerged around the pipeline call. Returns only(video frames, audio, sampling_rate)— a@spaces.GPUreturn crosses a process boundary by pickling, so pipeline state stays on the card.encode_video(PyAV) muxes h264 frames + stereo AAC soundtrack into an MP4 in temp storage.
Integration Points
- Cross-Space wire contract:
CANVASESlabel strings inapp.pygo over the wire and must stay identical to the conditioner's table; the wire format (two tensors + metadata) must stay in lockstep. Changing either breaks the split. - AoTI package repo:
multimodalart/minimax-h3-aoti— consumed at runtime viasnapshot_downloadwhenH3_AOTI=1; produced by this repo's build path (requiresHF_TOKEN+ same-arch GPU). - Model repo:
MiniMaxAI/MiniMax-H3(public diffusers checkpoint, subfolderstransformer/+vae/+audio_vae/). - Conditioner Space:
multimodalart/qwen3vl-conditioner— remote/encodeendpoint, billed to the requesting user's token. - diffusers upstream:
huggingface/diffusersPR #14371 — the pinned WIP commit whose block classesh3_split_blocks.pysubclasses.