Allegro / README.md
RhymesAI's picture
Update README.md
28b340a verified
|
raw
history blame
3.27 kB
metadata
license: apache-2.0
language:
  - en

GalleryGitHubBlogPaperDiscord

Gallery

For more demos and corresponding prompts, see the Allegro Gallery.

Key Feature

Allegro is capable of producing high-quality, 6-second videos at 30 frames per second and 720p resolution from simple text prompts.

Model info

Model Allegro
Description Text-to-Video Diffusion Transformer
Download <HF link - TBD>
Parameter VAE: 175M
DiT: 2.8B
Inference Precision VAE: FP32/TF32/BF16/FP16 (best in FP32/TF32)
DiT/T5: BF16/FP32/TF32
Context Length 79.2k
Resolution 720 x 1280
Frames 88
Video Length 6 seconds @ 15 fps
Single GPU Memory Usage 9.3G BF16 (with cpu_offload)

Quick start

You can quickly get started with Allegro using the Hugging Face Diffusers library. For more tutorials, see Allegro GitHub (link-tbd).

Install necessary requirements:

pip install diffusers transformers imageio

Inference on single gpu:

from diffusers import DiffusionPipeline
import torch

allegro_pipeline = DiffusionPipeline.from_pretrained(
    "rhythms-ai/allegro", trust_remote_code=True, torch_dtype=torch.bfloat16
).to("cuda")

allegro_pipeline.vae = allegro_pipeline.vae.to(torch.float32)

prompt = "a video of an astronaut riding a horse on mars"

positive_prompt = """
(masterpiece), (best quality), (ultra-detailed), (unwatermarked), 
{} 
emotional, harmonious, vignette, 4k epic detailed, shot on kodak, 35mm photo, 
sharp focus, high budget, cinemascope, moody, epic, gorgeous
"""

negative_prompt = """
nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, 
low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry.
"""

num_sampling_steps, guidance_scale, seed = 100, 7.5, 42

user_prompt = positive_prompt.format(args.user_prompt.lower().strip())
out_video = allegro_pipeline(
    user_prompt, 
    negative_prompt=negative_prompt, 
    num_frames=88,
    height=720,
    width=1280,
    num_inference_steps=num_sampling_steps,
    guidance_scale=guidance_scale,
    max_sequence_length=512,
    generator = torch.Generator(device="cuda:0").manual_seed(seed)
).video[0]

imageio.mimwrite("test_video.mp4", out_video, fps=15, quality=8)

License

This repo is released under the Apache 2.0 License.