2024-10-16 08:58:19 +00:00
---
license: apache-2.0
2024-10-18 07:44:30 +00:00
language:
- en
2024-10-20 19:21:22 +00:00
library_name: diffusers
2024-10-16 08:58:19 +00:00
---
2024-10-19 06:58:43 +00:00
< p align = "center" >
2024-10-21 03:03:09 +00:00
< img src = "https://huggingface.co/rhymes-ai/Allegro/resolve/main/banner.gif" width = "500" height = "400" / >
2024-10-19 06:58:43 +00:00
< / p >
2024-10-18 07:37:15 +00:00
< p align = "center" >
2024-10-18 09:04:14 +00:00
< a href = "https://rhymes.ai/" target = "_blank" > Gallery< / a > · < a href = "https://github.com/rhymes-ai/Aria" target = "_blank" > GitHub< / a > · < a href = "https://www.rhymes.ai/blog-details/" target = "_blank" > Blog< / a > · < a href = "https://arxiv.org/pdf/2410.05993" target = "_blank" > Paper< / a > · < a href = "https://discord" target = "_blank" > Discord< / a >
2024-10-18 07:37:15 +00:00
< / p >
2024-10-17 11:00:11 +00:00
2024-10-18 07:44:30 +00:00
# Gallery
< img src = "https://huggingface.co/rhymes-ai/Allegro/resolve/main/gallery.gif" width = "1000" height = "800" /> For more demos and corresponding prompts, see the [Allegro Gallery ](TBD ).
2024-10-17 11:00:11 +00:00
2024-10-18 07:44:30 +00:00
# Key Feature
2024-10-21 02:30:04 +00:00
- **High-Quality Output**: Generate detailed 6-second videos at 15 FPS with 720x1280 resolution, which can be interpolated to 30 FPS with EMA-VFI.
- **Small and Efficient**: Features a 175M parameter VAE and a 2.8B parameter DiT model. Supports multiple precisions (FP32, BF16, FP16) and uses 9.3 GB of GPU memory in BF16 mode with CPU offloading.
- **Extensive Context Length**: Handles up to 79.2k tokens, providing rich and comprehensive text-to-video generation capabilities.
- **Versatile Content Creation**: Capable of generating a wide range of content, from close-ups of humans and animals to diverse dynamic scenes.
2024-10-18 10:37:53 +00:00
2024-10-16 09:19:11 +00:00
# Model info
2024-10-18 07:51:04 +00:00
2024-10-18 08:47:36 +00:00
< table >
< tr >
< th > Model< / th >
< td > Allegro< / td >
< / tr >
< tr >
< th > Description< / th >
2024-10-21 02:30:04 +00:00
< td > Text-to-Video Generation Model< / td >
2024-10-18 08:47:36 +00:00
< / tr >
< tr >
< th > Download< / th >
< td > < HF link - TBD> < / td >
< / tr >
< tr >
< th rowspan = "2" > Parameter< / th >
< td > VAE: 175M< / td >
< / tr >
< tr >
< td > DiT: 2.8B< / td >
< / tr >
< tr >
< th rowspan = "2" > Inference Precision< / th >
< td > VAE: FP32/TF32/BF16/FP16 (best in FP32/TF32)< / td >
< / tr >
< tr >
< td > DiT/T5: BF16/FP32/TF32< / td >
< / tr >
< tr >
< th > Context Length< / th >
< td > 79.2k< / td >
< / tr >
< tr >
< th > Resolution< / th >
< td > 720 x 1280< / td >
< / tr >
< tr >
< th > Frames< / th >
< td > 88< / td >
< / tr >
< tr >
< th > Video Length< / th >
< td > 6 seconds @ 15 fps< / td >
< / tr >
< tr >
< th > Single GPU Memory Usage< / th >
< td > 9.3G BF16 (with cpu_offload)< / td >
< / tr >
< / table >
2024-10-16 09:19:11 +00:00
# Quick start
2024-10-18 09:04:14 +00:00
You can quickly get started with Allegro using the Hugging Face Diffusers library.
For more tutorials, see Allegro GitHub (link-tbd).
2024-10-21 02:30:04 +00:00
1. Install necessary requirements. Please refer to [requirements.txt ](https://github.com/rhymes-ai ) on Allegro GitHub.
2. Perform inference on a single GPU.
2024-10-18 09:04:14 +00:00
```python
from diffusers import DiffusionPipeline
import torch
allegro_pipeline = DiffusionPipeline.from_pretrained(
2024-10-21 02:30:04 +00:00
"rhymes-ai/Allegro", trust_remote_code=True, torch_dtype=torch.bfloat16
2024-10-18 09:04:14 +00:00
).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)
```
2024-10-21 02:30:04 +00:00
Tip:
- It is highly recommended to use a video frame interpolation model (such as EMA-VFI) to enhance the result to 30 FPS.
- For more tutorials, see [Allegro GitHub ](https://github.com/rhymes-ai ).
2024-10-16 09:19:11 +00:00
# License
2024-10-18 07:44:30 +00:00
This repo is released under the Apache 2.0 License.