### Setting Up Magi-1 from Source Code Source: https://github.com/sandai-org/magi-1/blob/main/README.md This snippet outlines the steps to prepare the environment for Magi-1 from source code. It involves creating a Conda environment, installing PyTorch, other dependencies via `requirements.txt`, FFmpeg, and optionally MagiAttention for Hopper architecture GPUs to enhance performance. ```bash # Create a new environment conda create -n magi python==3.10.12 # Install pytorch conda install pytorch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 pytorch-cuda=12.4 -c pytorch -c nvidia # Install other dependencies pip install -r requirements.txt # Install ffmpeg conda install -c conda-forge ffmpeg=4.4 # For GPUs based on the Hopper architecture (e.g., H100/H800), it is recommended to install MagiAttention(https://github.com/SandAI-org/MagiAttention) for acceleration. For non-Hopper GPUs, installing MagiAttention is not necessary. git clone git@github.com:SandAI-org/MagiAttention.git cd MagiAttention git submodule update --init --recursive pip install --no-build-isolation . ``` -------------------------------- ### Executing Magi-1 Inference Scripts Source: https://github.com/sandai-org/magi-1/blob/main/README.md This snippet provides a basic Bash script to run the Magi-1 inference pipeline. It demonstrates how to execute the `run.sh` scripts for both the 24B and 4.5B Magi-1 models, which can be customized by modifying parameters within those scripts. ```bash #!/bin/bash # Run 24B MAGI-1 model bash example/24B/run.sh # Run 4.5B MAGI-1 model bash example/4.5B/run.sh ``` -------------------------------- ### Setting Up Magi-1 with Docker Source: https://github.com/sandai-org/magi-1/blob/main/README.md This snippet provides commands to set up the Magi-1 environment using Docker. It includes pulling the latest Magi-1 Docker image and running a container with GPU access, shared memory, host networking, and specific ulimits for optimal performance. ```bash 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 ``` -------------------------------- ### Citing MAGI-1 Project (BibTeX) Source: https://github.com/sandai-org/magi-1/blob/main/README.md This BibTeX entry provides the citation details for the MAGI-1 project, including authors, title, year, eprint, and URL. It should be used when referencing the MAGI-1 code or model in research. ```bibtex @misc{ai2025magi1autoregressivevideogeneration, title={MAGI-1: Autoregressive Video Generation at Scale}, author={Sand. ai and Hansi Teng and Hongyu Jia and Lei Sun and Lingzhi Li and Maolin Li and Mingqiu Tang and Shuai Han and Tianning Zhang and W. Q. Zhang and Weifeng Luo and Xiaoyang Kang and Yuchen Sun and Yue Cao and Yunpeng Huang and Yutong Lin and Yuxin Fang and Zewei Tao and Zheng Zhang and Zhongshu Wang and Zixun Liu and Dai Shi and Guoli Su and Hanwen Sun and Hong Pan and Jie Wang and Jiexin Sheng and Min Cui and Min Hu and Ming Yan and Shucheng Yin and Siran Zhang and Tingting Liu and Xianping Yin and Xiaoyu Yang and Xin Song and Xuan Hu and Yankai Zhang and Yuqiao Li}, year={2025}, eprint={2505.13211}, archivePrefix={arXiv}, primaryClass={cs.CV}, url={https://arxiv.org/abs/2505.13211}, } ``` -------------------------------- ### Customizing Magi-1 for Video-to-Video Inference Source: https://github.com/sandai-org/magi-1/blob/main/README.md This snippet demonstrates how to configure the Magi-1 inference script for Video-to-Video (v2v) mode. It requires setting `--mode` to `v2v` and providing the path to the prefix video using `--prefix_video_path`. ```bash --mode v2v \ --prefix_video_path example/assets/prefix_video.mp4 \ ``` -------------------------------- ### Customizing Magi-1 for Image-to-Video Inference Source: https://github.com/sandai-org/magi-1/blob/main/README.md This snippet illustrates how to configure the Magi-1 inference script for Image-to-Video (i2v) mode. It shows the necessary command-line arguments: setting `--mode` to `i2v` and specifying the input image path using `--image_path`. ```bash --mode i2v \ --image_path example/assets/image.jpeg \ ``` -------------------------------- ### Project Dependencies (requirements.txt) Source: https://github.com/sandai-org/magi-1/blob/main/requirements.txt This snippet lists the Python packages and their exact versions required to run the project. It includes standard packages, deep learning frameworks like `diffusers` and `transformers`, and optimized libraries such as `flash-attn` and `flashinfer-python` with a custom index URL. This file is typically used with `pip install -r` to set up the development environment. ```Python accelerate==0.32.1 beautifulsoup4==4.13.4 debugpy==1.8.14 diffusers==0.29.2 einops>=0.6.0 ffmpeg-python flash-attn==2.4.2 flashinfer-python==0.2.0.post2 --extra-index-url https://flashinfer.ai/whl/cu124/torch2.4/ ftfy==6.2.0 gpustat==1.1.1 imageio==2.34.0 imageio[ffmpeg] matplotlib==3.10.1 numpy==1.26.4 protobuf==5.28.3 rich==14.0.0 sentencepiece==0.2.0 timm==1.0.15 torchdiffeq==0.2.4 transformers==4.42.3 ``` -------------------------------- ### Launching ComfyUI with MAGI-1 Custom Nodes (Shell) Source: https://github.com/sandai-org/magi-1/blob/main/comfyui/README.md This shell snippet provides commands to navigate into the ComfyUI directory and launch the application. It offers two methods: using 'comfy launch' if 'comfy-cli' is installed, or 'python main.py' otherwise, enabling the use of MAGI-1 custom nodes. ```shell cd ComfyUI # If comfy-cli is installed comfy launch # Otherwise python main.py ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.