--- library_name: custom pipeline_tag: image-text-to-video base_model: - sand-ai/MAGI-2-preview --- This is a randomly initialized tiny model based on [sand-ai/MAGI-2-preview](https://huggingface.co/sand-ai/MAGI-2-preview) for testing and debugging. | Feature | Source | This repo | |---|---|---| | Checkpoint tensor elements | 141.60B BF16, 1.33B F32 | 8.92M BF16, 386.96K F32 | | Safetensors weight files | 288.52 GB (68 files) | 19.46 MB (3 files) | | Preview DiT layers / width / Q (KV) heads / head dim | 40 / 3,072 / 24 (24) / 128 | 6 / 64 / 1 (1) / 64 | | Preview DiT MoE | 36 layers, 256 experts, top-6, width 1,280, 12 heads | 2 layers, 256 experts, top-6, width 32, 1 head of 64 | | Multi-head residual streams | 4 | Same | | Attention gating / sinks | Enabled / 1 sink token | Same | | Text encoder | Qwen3.5-27B: 64 layers, 5,120, 24 (4) heads, head dim 256 | 4 layers (3:1 linear/full), 16, 1 (1) heads, head dim 16 | | Text vocabulary | 248,320 | Same | | Audio VAE latent / downsampling / sample rate | 64 / 2,048 / 44,100 | Same, encoder/decoder width 4 | | Turbo VAE decoder widths | 512, 512, 512, 512 | 8, 16, 32, 64 | | Wan2.2 VAE dim / decoder dim / latent z | 160 / 256 / 48 | 4 / 4 / 48 | | Video / audio latent channels | 48 / 64 | Same | | Serialized precision | BF16 DiT and text; F32 audio VAE | Same | MAGI-2-preview is a native video/audio generation package, not a Transformers or Diffusers pipeline. This repo ships the pinned upstream runtime under `inference/` together with the tiny component checkpoints, so the documented entry point loads the checkpoint without a separate checkout. Architecture contracts are preserved: the 3:1 linear/full Qwen3.5 attention cadence (four layers so the runtime's default `skip_layer=2` reads a transformer layer output), 4 MHC streams, attention gating and sinks, the 256-expert top-6 MoE, and the 48-channel video / 64-channel audio latents. The preview DiT keeps `head_dim=64` because its attention runs through FA3, whose smallest kernel head dim is 64, and `hidden_size` must be a multiple of it; the tiny config therefore uses a single 64-wide head. The MoE runs through a Triton kernel whose fixed tiles require `hidden_size / num_heads` to be a multiple of 64 and the expert width to be a multiple of 32, so the MoE head is 64-wide and the experts are 32-wide. The Wan VAE is not width-configurable upstream, so the shipped `vae2_2.py` reads `vae/config.json` (the only runtime change, marked with a comment) and keeps the upstream defaults when the file is absent. Preview-only: the 1080p refiner weights are not included. | File path | Size | |------|------| | preview/model.safetensors | 8.2MB | | stable-audio-open-1.0/model.safetensors | 0.9MB | | text_encoder/model.safetensors | 10.4MB | ### Example usage #### MAGI-2 preview text-to-video (272p) (✅ verified) Download `tiny-random/magi-2-preview` and run the bundled runtime on one Hopper GPU. The checkpoint root is also the runtime root: it ships the pinned `SandAI-org/MAGI-2-preview` `inference/` sources and the tiny `configs/magi2_preview.json`. Build the compiled stack from the pinned commits first (FA3 hopper `b613d9e`, MagiAttention `2c64135` plus its `extensions/`, MagiCompiler `5950612`; see the upstream Dockerfile, whose MagiAttention requirements pin `nvidia-cutlass-dsl==4.4.2`; the extensions import also needs the torch test extra `expecttest`) and install `requirements.txt`; this checkpoint was validated with a forward-only bf16 / head_dim 64 / varlen FA3 build (with softcap enabled because the upstream config passes `attn_softcap=-1.0`). `MAGI2_TEXT_ENC_OFFLOAD_MODE=gpu` keeps the Qwen3.5 hybrid linear-attention layers on CUDA (their kernels are CUDA-only in the pinned stack) instead of the default CPU offload. `--seconds 1 --num-inference-steps 1` is a smoke setting; production runs use 10 seconds and the configured 100 steps. The audio track is muxed with the system `ffmpeg`, and `pip install imageio-ffmpeg` provides a binary when the system has none. Preview-only: the 1080p refiner component is not part of this checkpoint. ```bash huggingface-cli download tiny-random/magi-2-preview --local-dir magi2-tiny cd magi2-tiny MAGI2_CKPT_ROOT=$PWD \ MAGI2_TEXT_ENC_OFFLOAD_MODE=gpu \ python -m torch.distributed.run --nproc_per_node=1 --master_port=29577 \ inference/pipeline/entry.py \ --resolution 272p \ --prompt "A tiny red cube on a white background." \ --seconds 1 \ --num-inference-steps 1 \ --output outputs/tiny ``` ### Creating this repo - Code: [.meta/create_model.py](.meta/create_model.py) - Model structure: [.meta/model.log](.meta/model.log) - Environment: [.meta/env.json](.meta/env.json) ### Change log - 2026-11-30: Initial tiny MAGI-2-preview checkpoint with the pinned MAGI-2 runtime, a reduced preview DiT, Qwen3.5 text tower, Stable Audio VAE, Wan2.2 VAE and turbo VAE. *This repo is generated by DeepSeek-V4.1-Flash.*