MAGI-2-preview logo

MAGI-2-preview

MAGI-2-preview: Scaling Video Generation Models Efficiently

Developer ToolsPythonApache-2.0 372 5Health 78
Sand.ai HomepageTech Blog MAGI  2 Preview🤗 Hugging Face MAGI  2 PreviewTwitter Sand.ai
Website GitHub

What is it?

What it is

MAGI-2 Preview is an 114B-parameter unified audio-video generation model that activates 6B parameters per token, enabling efficient video generation through a two-stage process (denoising and refinement).

Why it exists

To explore an efficient path for scaling video generation models by optimizing parameter usage and co-designing architecture, systems, and data pipelines.

Who should use it

AI researchers working on video generationMachine learning engineers developing MoE architecturesDevelopers building high-fidelity audio-visual generation pipelinesUsers with high-end NVIDIA Hopper GPU infrastructure

Who should avoid it

Users without NVIDIA Hopper GPUs (8x required for standard inference)Users with limited storage (requires ~307 GB for weights)Users with low VRAM (models require significant offloading/multi-GPU)Users looking for lightweight or mobile-friendly models

How it works

A quick walkthrough in plain English

How MAGI-2-preview works

Step 1 of 3

You interact with it

Open MAGI-2-preview, send a request, or connect it to your stack.

Features

114B-parameter unified audio-video generation model
Activates 6B parameters per token for efficiency
Two-stage generation process (denoising + refining)
Supports text-to-video (T2V) and image-to-video (I2V) generation
Generates synchronized audio and video with muxed output
Prompt enhancement via LLM for improved output quality
Docker image and Hugging Face checkpoints available
MoE (Mixture of Experts) architecture for scalable video generation
Turbo VAE decoder for faster decoding
Configurable output resolution (e.g., 1080p)

Advantages

  • High efficiency with 6B parameters per token despite 114B total
  • Unified audio-video generation with synchronized output
  • Prompt enhancement improves coherence and quality of generated content
  • Open-source under Apache 2.0 license
  • Docker and Hugging Face integration simplifies deployment
  • Two-stage process enables high-resolution 1080p output
  • Supports both text and image prompts for flexible use cases
  • Turbo VAE decoder reduces computational overhead during decoding

Disadvantages

  • Requires 8 NVIDIA Hopper GPUs for full functionality
  • Large model size (114B parameters) demands significant resources
  • Currently limited to 10-second video clips
  • Prompt enhancement requires API key or custom LLM setup
  • Dependency on ffmpeg for audio muxing may limit accessibility
  • Large checkpoint size (307 GB total) poses storage challenges
  • Preview stage and refiner require separate processing steps
  • Hardware-specific (Hopper GPUs) may restrict broader adoption

Installation

docker

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

native

pip install -r requirements.txt

FAQ

What hardware and software are required to run MAGI‑2 Preview inference?

MAGI‑2 Preview needs NVIDIA Hopper GPUs (8 of them are recommended for full 1080p runs). It requires Python 3.12, a recent CUDA toolkit, and `ffmpeg` on the PATH for audio muxing. The Docker image `sandai/magi-2-preview` bundles all dependencies, including those that need a compiler.

How do I set up MAGI‑2 Preview using Docker versus building from source?

With Docker, pull the image `sandai/magi-2-preview:latest` and run it with GPU access, mounting your checkpoint directory: ``` docker pull sandai/magi-2-preview:latest docker run --gpus all -it -v /path/to/ckpt:/workspace/ckpt sandai/magi-2-preview:latest ``` If you need to change a dependency version or cannot reach the registry, build locally: ``` docker build -t magi-2-preview:local . ``` From source, install the Python requirements: ``` pip install -r requirements.txt ``` and ensure the `MagiAttention` and `MagiCompiler` repos are available at the pinned revisions.

Where are the model weights and how do I download them?

The weights are not bundled with the code. Download them into a `ckpt/` directory at the repository root: ``` pip install huggingface_hub hf download sand-ai/MAGI-2-preview --local-dir ckpt ``` The directory structure matches the config expectations, so no renaming is needed. You can point to a different location by setting `MAGI2_CKPT_ROOT`.

How can I run a single video generation from the command line?

Use `torchrun` with the entry script and provide the prompt, output directory, and optional image: ``` torchrun --nproc_per_node=8 inference/pipeline/entry.py \ --prompt "a red fox in snow" \ --output output/ ``` Add `--prompt-file`, `--image`, `--seed`, `--config`, `--output-width`, `--output-height`, `--num-inference-steps`, `--refiner-num-inference-steps`, or `--deterministic` as needed. The script writes the MP4 to `output/`.

What is prompt enhancement and how do I enable it?

Prompt enhancement rewrites a short user prompt into a structured, long caption using an LLM, improving model performance. It uses templates in `inference/prompt_enhancement/prompts/`. To enable it, set an OpenAI‑compatible `API_KEY` in `enhancer.py` or subclass `LLMClient`. If `API_KEY` is empty, the raw prompt is used. Example: ``` export API_KEY=sk-... python inference/prompt_enhancement/enhancer.py ```

Loading documentation…
View on GitHub

Featured in Videos

YouTube tutorials and walkthroughs for MAGI-2-preview

Alternatives

Similar projects ranked by category, topics, and text overlap.

Compare
MAGI-2-preview | MushyBook