Add MAGI-1: Autoregressive Video Generation at Scale - #14760
Open
lavinal712 wants to merge 1 commit into
Open
Conversation
Contributor
Author
Pipeline usageimport torch
from diffusers import ComponentsManager, MagiModularPipeline
from diffusers.utils import export_to_video
manager = ComponentsManager()
manager.enable_auto_cpu_offload(device="cuda:0")
pipe = MagiModularPipeline.from_pretrained(
"/path/to/MAGI-1-diffusers",
components_manager=manager,
)
pipe.load_components(
dtype={
"default": torch.float32,
"transformer": torch.bfloat16,
"vae": torch.bfloat16,
}
)
pipe.transformer.set_attention_backend("flash_varlen")
pipe.vae.set_attention_backend("flash")
pipe.vae.enable_tiling(tile_sample_min_length=12)
video = pipe(
prompt="A golden retriever runs through a sunlit meadow.",
height=512,
width=512,
num_frames=96,
num_inference_steps=64,
cache_device="cpu",
generator=torch.Generator("cuda:0").manual_seed(42),
output_type="np",
output="videos",
)
export_to_video(video[0], "magi.mp4", fps=24) |
Contributor
Author
magi_output.mp4 |
This was referenced Sep 12, 2026
Contributor
|
Hi @lavinal712, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To fix #11519
Thanks to @tolgacangoz and everyone who contributed to or reviewed the earlier work.
This PR adds initial MAGI-1 support to Diffusers, with the non-quantized MAGI-1 4.5B base checkpoint as the primary validated configuration.
It includes:
AutoencoderKLMagifor causal video encoding and tiled decoding.MagiTransformer3DModelwith MAGI attention, rotary embeddings, timestep conditioning, and KV-cache support.MagiTextConditioningModelfor the learned null-caption, quality, and duration features.MagiEulerSchedulerand the MAGI three-way classifier-free guider.Validation
The implementation was checked using the converted official 4.5B base weights.
This PR is still under active development and is expected to require a few more weeks of work before it is ready for final review. The implementation and validation are progressing steadily, and the remaining issues are being addressed.
Thank you for your patience and for any feedback during this process.
@yiyixuxu @dg845 and @asomoza