← Open Source
SandAI-org

MAGI-2-preview

MAGI-2-preview: Scaling Video Generation Models Efficiently.

ModelsVision modelsPython
Open on GitHub
Momentum
+0stars in 24 hours0.0%
638
Stars
19
Forks
+5
This week
4
Contributors
Created 2026-08-04 · Updated 2026-10-15 · #15705 today
Top developers
cennnstupidZZjiahy0825

SandAI-org/MAGI-2-preview is ranked 15,705 with 638 stars.

Same-category comparison

SandAI-org/MAGI-2-preview is ranked 15,705 among these 8 peers; UMass-Embodied-AGI/3D-VLA is ranked 15,707.

Same-category comparison
NameRankMetrics
POSTECH-CVLab/point-transformer15,686
Language:
Python
Stars:
639
Forks:
113
Description:
This is an unofficial implementation of the Point Transformer paper.
SalesforceAIResearch/xLAM15,687
Language:
Python
Stars:
639
Forks:
60
Description:
xLAM: A Family of Large Action Models to Empower AI Agent Systems.
google-deepmind/tips15,693
Language:
Jupyter Notebook
Stars:
639
Forks:
41
Description:
TIPSv2 (CVPR'26) and TIPS (ICLR'25).
westlake-repl/SaProt15,701
Language:
Python
Stars:
639
Forks:
74
Description:
Saprot: Protein Language Model with Structural Alphabet (AA+3Di).
UMass-Embodied-AGI/3D-VLA15,707
Language:
Python
Stars:
638
Forks:
25
Description:
[ICML 2024] 3D-VLA: A 3D Vision-Language-Action Generative World Model.
ivcylc/OpenMusic15,710
Language:
Python
Stars:
638
Forks:
73
Description:
OpenMusic: SOTA Text-to-music (TTM) Generation.
xuxw98/ESAM15,732
Language:
Python
Stars:
637
Forks:
34
Description:
[ICLR 2025, Oral] EmbodiedSAM: Online Segment Any 3D Thing in Real Time.
chenxin-dlut/TransT15,742
Language:
Python
Stars:
636
Forks:
108
Description:
Transformer Tracking (CVPR2021).
Key parameters and specifications
Key parameters and specifications
ParameterValue
LanguagePython
CategoryModels
SubcategoryVision models
KeywordsModel architecture, Multimodal, Text-to-video, Video production
Stars638
Forks19
Contributors4
Created date2026-08-04
Updated date2026-10-15
Stars in 1 day0
Stars in 7 days5
Rank15,705
Previous rank6,724
Rank change-8,981
7-day stars rank5,740
Previous 7-day stars rank6,427
7-day stars rank change687
Total stars rank16,015
Previous total stars rank15,985
Total stars rank change-30
README summary

Built on MagiMoE and co-designed across architecture, systems, and data, it explores an efficient path to scaling video generation. The architecture, the training system built around it, and the data pipeline are described in MAGI-2 Preview: Scaling Video Generation Models Efficiently; the weights are on Hugging Face at sand-ai/MAGI-2-preview. It generates video from a text prompt (T2V) or from a prompt plus a still image (I2V), with sound generated alongside the video and muxed

into the output file. Clips are 10 seconds long, which is the only duration the model currently supports. Generation runs in two stages: denoises the clip at low resolution, and takes that result up to 1080p. Requirements NVIDIA Hopper GPUs, 8 of them. Without it the video is still written, just silently. Setup Docker The published image, sandai/magi-2-preview, already has the dependencies built, including the ones that need a compiler: There is a tag per commit as

well, . Name that one when reporting a result, because moves; the image also records what it was built from in . Building it yourself is only necessary to change a dependency version, or to work somewhere the registry is not reachable: From source MAGI-2 also needs MagiAttention and MagiCompiler. The pinned revisions are recorded as build args in the Dockerfile. Checkpoints Neither transformer has been step-distilled, so the denoising step count is where most of the wall-clock time

goes. 5-27B | | | 14 GB | Refiner-stage transformer, released with MAGI-2 | | | 5 GB | Audio VAE, decodes the generated audio latents | | | 3 GB | Video VAE, from Wan-AI/Wan2. 2-TI2V-5B | | | 2 GB | Distilled VAE decoder, used for decoding by default | The configs under reference these as , and that variable defaults to . To keep weights somewhere else, point it at them rather than editing the configs: Prompt enhancement The captions the model was trained on are long and structured

, so a short hand- written prompt underuses it. The pipeline can optionally rewrite the input through a prompt-enhancement (PE) step before encoding: text-to-video uses image-to-video (when a first-frame image is provided) uses Both templates ask an instruction-following LLM for a structured JSON caption of the 10-second clip; the result is then rendered to readable Markdown and passed downstream. Leave empty to skip PE and use the raw prompt as-is. ships example

prompts that are already PE-enhanced ( and ). Running inference launches under on every visible GPU. It generates at 1080p, with seed 42 and the batch in : The script takes , , and from the environment. Videos land in and up, numbered by position in the batch. A samples file is a JSON array with one entry per video. An entry carries its prompt inline as or as a path in , and a first frame in ; leaving out makes it a T2V entry

. The shipped batch runs the three stills in as I2V, the same three prompts again as T2V, and . For a

Frequently asked questions

How many stars and forks are recorded?

SandAI-org/MAGI-2-preview has 638 stars and 19 forks.

What is the repository rank?

SandAI-org/MAGI-2-preview is ranked 15,705.

What language and category are recorded?

SandAI-org/MAGI-2-preview has 638 stars, uses Python and belongs to Models.

Which repository is closest in rank?

SandAI-org/MAGI-2-preview is compared with UMass-Embodied-AGI/3D-VLA, ranked 15,707 with 638 stars.

README


MAGI-2 Preview

Magi-2 Preview is a 114B-parameter unified audio-video generation model that activates just 6B parameters per token. Built on MagiMoE and co-designed across architecture, systems, and data, it explores an efficient path to scaling video generation. The architecture, the training system built around it, and the data pipeline are described in MAGI-2 Preview: Scaling Video Generation Models Efficiently; the weights are on Hugging Face at sand-ai/MAGI-2-preview.

This repository is the inference code. It generates video from a text prompt (T2V) or from a prompt plus a still image (I2V), with sound generated alongside the video and muxed into the output file. Clips are 10 seconds long, which is the only duration the model currently supports. Generation runs in two stages: magi2_preview denoises the clip at low resolution, and magi2_refiner takes that result up to 1080p.

Requirements

  • NVIDIA Hopper GPUs, 8 of them.
  • Python 3.12 and a recent CUDA toolkit.
  • ffmpeg on PATH, to mux the audio track. Without it the video is still written, just silently.

Setup

Docker

The published image, sandai/magi-2-preview, already has the dependencies built, including the ones that need a compiler:

docker pull sandai/magi-2-preview:latest
docker run --gpus all -it -v /path/to/ckpt:/workspace/ckpt sandai/magi-2-preview:latest

There is a tag per commit as well, sandai/magi-2-preview:. Name that one when reporting a result, because latest moves; the image also records what it was built from in /etc/magi2-build-info.

Building it yourself is only necessary to change a dependency version, or to work somewhere the registry is not reachable:

docker build -t magi-2-preview:local .

From source

pip install -r requirements.txt

MAGI-2 also needs MagiAttention and MagiCompiler. The pinned revisions are recorded as build args in the Dockerfile.

Checkpoints

Neither transformer has been step-distilled, so the denoising step count is where most of the wall-clock time goes. That is the difference between the release that exists today and the one that follows:

Release Denoising steps Weights
MAGI-2 Preview, base 100 preview + 5 refiner sand-ai/MAGI-2-preview
MAGI-2 Preview, distilled far fewer Coming soon

Everything the base model loads lives in that one repository, roughly 307 GB in total. Weights are not bundled with the code; download them into ckpt/ in the repository root, which is gitignored:

pip install huggingface_hub
hf download sand-ai/MAGI-2-preview --local-dir ckpt

The directory names in that repository are the ones the configs already expect, so nothing needs renaming afterwards:

ckpt/
├── preview/                            # preview stage: 56 safetensors shards + index
├── refiner/                            # refiner stage: 3 shards + index
├── text_encoder/                       # text encoder
├── vae/                                # video VAE
│   └── Wan2.2_VAE.pth
├── stable-audio-open-1.0/              # audio VAE
└── turbo_vae/                          # fast VAE decoder
    ├── TurboV3-Wan22-TinyShallow_7_7.json
    └── checkpoint.ckpt

Each directory name below links to the folder it comes from in the Hugging Face repository:

Directory Size Contents
preview 228 GB Preview-stage transformer, released with MAGI-2
text_encoder 56 GB Text encoder, Qwen/Qwen3.5-27B
refiner 14 GB Refiner-stage transformer, released with MAGI-2
stable-audio-open-1.0 5 GB Audio VAE, decodes the generated audio latents
vae 3 GB Video VAE, from Wan-AI/Wan2.2-TI2V-5B
turbo_vae 2 GB Distilled VAE decoder, used for decoding by default

The configs under configs/ reference these as ${MAGI2_CKPT_ROOT}/, and that variable defaults to /ckpt. To keep weights somewhere else, point it at them rather than editing the configs:

export MAGI2_CKPT_ROOT=/data/magi2-weights

Prompt enhancement

The captions the model was trained on are long and structured, so a short hand- written prompt underuses it. The pipeline can optionally rewrite the input through a prompt-enhancement (PE) step before encoding:

Both templates ask an instruction-following LLM for a structured JSON caption of the 10-second clip; the result is then rendered to readable Markdown and passed downstream. The reference client in inference/prompt_enhancement/ talks to an OpenAI-compatible endpoint — set API_KEY in enhancer.py to enable it, or subclass LLMClient for your own provider. Leave API_KEY empty to skip PE and use the raw prompt as-is.

assets/ ships example prompts that are already PE-enhanced (sample_000.txt and sample_002.txt). You can still generate without running PE — leave API_KEY empty and pass any prompt you like.

Running inference

scripts/run_demo.sh launches inference/pipeline/entry.py under torchrun on every visible GPU. It generates at 1080p, with seed 42 and the batch in assets/demo_samples.json:

bash scripts/run_demo.sh
SAMPLES=my_samples.json bash scripts/run_demo.sh   # a different batch
OUTPUT_DIR=output/run7 bash scripts/run_demo.sh

The script takes SAMPLES, OUTPUT_DIR, SEED and MASTER_PORT from the environment. Videos land in $OUTPUT_DIR/sample_000.mp4 and up, numbered by position in the batch.

A samples file is a JSON array with one entry per video. An entry carries its prompt inline as prompt or as a path in prompt_file, and a first frame in image; leaving image out makes it a T2V entry. The shipped batch runs the three stills in assets/ as I2V, the same three prompts again as T2V, and assets/sample_enhanced_t2v.json.

For a single clip, call the entry point directly:

torchrun --nproc_per_node=8 inference/pipeline/entry.py \
    --prompt "a red fox in snow" --output output/

It also takes --prompt-file, --image, --seed, --config, --output-width / --output-height, --num-inference-steps, --refiner-num-inference-steps and --deterministic. Of these only --seed, --samples and --output are reachable through run_demo.sh.

1080p runs configs/magi2_refiner.json: the preview stage generates 512x896 and the refiner takes that to 1088x1920. magi2_refiner.json extends magi2_preview.json and carries only what the refiner stage adds, so a shared setting is edited in one place.

1080p is a delivery tier, not the shape that gets generated. The VAE stride constrains every generated dimension to a multiple of 16, so the tier generates 1088 wide rather than 1080, and the video is written at that generated shape. Pass --output-width and --output-height to have the finished video rescaled to an exact size, 1080x1920 the way the reference delivers the tier.

Four environment variables decide where each large component sits between phases: MAGI2_TEXT_ENC_OFFLOAD_MODE, MAGI2_PREVIEW_OFFLOAD_MODE, MAGI2_REFINER_OFFLOAD_MODE and MAGI2_VAE_OFFLOAD_MODE, each one of cpu, gpu or roundtrip. The preview and the refiner default to roundtrip, staged in and out around the stage that needs them, because at 1080p neither fits on an 80GB card next to the other's activations.

Decoding uses the distilled turbo decoder from ckpt/turbo_vae, a temporal sliding window that runs on one rank per video. MAGI2_DETERMINISTIC=1, or --deterministic, makes the MoE scatter and the attention kernels bit-exact at some cost in speed. MAGI2_SAVE_LATENT_PATH writes the post-refiner latent of each sample to that directory.

License

Apache 2.0. See LICENSE.

Nearby in the ranking
Similar items