MAGI-1 Documentation

repository·main·Indexed 26 days ago

https://github.com/sandai-org/magi-1

MAGI-1 is an autoregressive video generation model utilizing a Diffusion Transformer (DiT) and a transformer-based VAE to enable streaming generation and long-horizon synthesis. It supports text-to-video, image-to-video, and video continuation tasks. The project provides model weights in 24B and 4.5B versions (including distilled and quantized variants), a MagiPipeline for inference, and custom node integration for ComfyUI.

Tokens
4.1K
Snippets
7
Records
24
Agent score
86%

What's inside MAGI-1

  1. Overview of MAGI-1

    main

    MAGI-1 is an autoregressive world model designed for large-scale video generation. It generates videos by predicting a sequence of video chunks (fixed-length segments of consecutive frames) autoregressively. This approach enables causal temporal modeling and supports streaming generation.

    Key capabilities include:

    • Image-to-Video (I2V): High-performance generation conditioned on text instructions.
    • Controllable Generation: Supports chunk-wise prompting for smooth scene transitions, long-horizon synthesis, and fine-grained text-driven control.
    • Efficient Inference: Uses an autoregressive denoising pipeline that allows concurrent processing of up to four chunks.
  2. Import MAGI-1 Workflow Examples

    main

    MAGI-1 provides pre-configured workflows for different tasks. You can import them via the Load button in the ComfyUI menu or by placing them in ComfyUI/user/default/workflows/.

    Available Workflows:

    • Text-to-Video: workflow/magi_text_to_video_example.json
    • Image-to-Video: workflow/magi_image_to_video_example.json
    • Video Continuation: workflow/magi_video_continuation_example.json

    Important: After importing a workflow, you must manually reassign all file paths to match your local environment.

  3. Run ComfyUI with MAGI-1

    main

    Start ComfyUI from the ComfyUI directory using either comfy-cli or standard Python execution:

    If using comfy-cli:

    cd ComfyUI
    comfy launch

    Otherwise:

    cd ComfyUI
    python main.py

    MAGI-1 nodes can be found under Add Node - Magi or in the NODE LIBRARY.

    cd ComfyUI
    comfy launch
  4. Install MAGI-1 nodes in ComfyUI

    main

    You can install the MAGI-1 custom nodes using either comfy-cli (recommended) or by manual source installation.

    After installing comfy-cli, run the following commands in your terminal:

    cd ComfyUI
    comfy node registry-install MAGI-1

    Method 2: Manual Source Installation

    1. Download the MAGI-1 repository into the ComfyUI/custom_nodes/MAGI-1 directory.
    2. Install the required dependencies.
    3. Critical Step: To ensure ComfyUI recognizes the custom nodes, you must move comfyui/__init__.py from the MAGI-1 project into the root directory of the MAGI-1 project.
    cd ComfyUI
    comfy node registry-install MAGI-1
  5. Download MAGI-1 Model Weights

    main

    Pre-trained weights for various MAGI-1 models (24B, 4.5B, distilled, and quantized versions) are available on Hugging Face. Choose a model based on your hardware capabilities:

    • MAGI-1-24B (Base/Distill): Requires H100/H800 × 8.
    • MAGI-1-24B-distill+fp8_quant: Requires H100/H800 × 4 or RTX 4090 × 8.
    • MAGI-1-4.5B (Base/Distill/Quant): Requires RTX 4090 × 1 (or any machine with ≥24GB GPU memory).

    Low Memory Tip for 4.5B Models: If you have constrained GPU memory (at least 12GB), use the MAGI-1-4.5B-distill+fp8_quant model and set the window_size parameter to 1 in the 4.5B_distill_quant_config.json file.

  6. Install MAGI-1 in ComfyUI

    main

    To use MAGI-1, you must first manually install ComfyUI. Once ComfyUI is installed, you can add MAGI-1 using one of two methods:

    If you have comfy-cli installed, run:

    cd ComfyUI
    comfy node registry-install MAGI-1

    Method 2: Manual Installation from Source

    1. Download the MAGI-1 repository.
    2. Place it in ComfyUI/custom_nodes/MAGI-1.
    3. Install the required dependencies.

    CRITICAL: For ComfyUI to recognize the custom node, you must move comfyui/__init__.py to the root directory of the MAGI-1 folder.

    cd ComfyUI
    comfy node registry-install MAGI-1
  7. Run MAGI-1 using Docker (Recommended)

    main

    The recommended way to run MAGI-1 is via the official Docker container. This ensures all dependencies and environments are correctly configured.

    docker pull sandai/magi:latest
    
    docker run -it --gpus all --privileged --shm-size=32g --name magi --net=host --ipc=host --ulimit memlock=-1 --ulimit stack=6710886 sandai/magi:latest /bin/bash
  8. Import MAGI-1 Workflows

    main

    MAGI-1 provides pre-configured workflows for different tasks. Workflows are located in the comfyui/workflow/ directory.

    Available Workflows:

    • Text-to-Video: magi_text_to_video_example.json
    • Image-to-Video: magi_image_to_video_example.json
    • Video Continuation: magi_video_continuation_example.json

    How to load:

    1. Use the Load button in the ComfyUI menu.
    2. Or, use Workflow - Open in the top-left menu.
    3. Or, copy the JSON files to ComfyUI/user/default/workflows/ and refresh the workflow panel.

    Note: After importing, you must manually re-specify the file paths for your local models and assets.

  9. Launch ComfyUI with MAGI-1

    main

    Once installed and configured, start ComfyUI from the ComfyUI directory.

    If you have comfy-cli installed:

    comfy launch

    Otherwise, use standard Python:

    python main.py

    You can find the nodes under the Add Node - Magi menu or in the NODE LIBRARY on the left side of the interface.

    cd ComfyUI
    comfy launch
  10. Run Inference with MagiPipeline

    main

    Inference is managed via the MagiPipeline. You can execute the provided bash scripts for the 24B or 4.5B models, or customize them by modifying the following parameters:

    CLI Parameters

    • --config_file: Path to the JSON configuration file (e.g., example/24B/24B_config.json).
    • --mode: Operation mode: t2v (Text-to-Video), i2v (Image-to-Video), or v2v (Video-to-Video).
    • --prompt: Text prompt for generation.
    • --image_path: Path to image (required for i2v).
    • --prefix_video_path: Path to prefix video (required for v2v).
    • --output_path: Destination for the generated video.

    Execution Examples

    # Run 24B MAGI-1 model
    bash example/24B/run.sh
    
    # Run 4.5B MAGI-1 model
    bash example/4.5B/run.sh
    # Example: Customizing for Image-to-Video (i2v)
    --mode i2v \
    --image_path example/assets/image.jpeg
    
    # Example: Customizing for Video-to-Video (v2v)
    --mode v2v \
    --prefix_video_path example/assets/prefix_video.mp4
  11. MAGI-1 Latest News and Releases

    main

    Recent Updates

    • Jun 17, 2026: Open-sourced weights for MAGI-1.1 24B (pre-distillation, post-distillation, and quantized versions).
    • May 30, 2025: Added support for ComfyUI via custom nodes.
    • May 26, 2025: Released MAGI-1 4.5B distill and distill+quant models.
    • May 14, 2025: Added Dify DSL for prompt enhancement.
    • Apr 30, 2025: Released MAGI-1 4.5B model weights.
    • Apr 21, 2025: Initial release of MAGI-1 model weights and inference code.