Instructions to use zguo0525/animatediff with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use zguo0525/animatediff with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("zguo0525/animatediff", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download scripts/test_persistent.py from zguo0525/animatediff: direct link, hf CLI and curl.
- Browser
- Download file 928 Bytes
-
https://huggingface.co/zguo0525/animatediff/resolve/main/scripts/test_persistent.py
- Command line
-
hf download hf://zguo0525/animatediff/scripts/test_persistent.py
-
curl -L -o test_persistent.py https://huggingface.co/zguo0525/animatediff/resolve/main/scripts/test_persistent.py
928 Bytes
| from rich import print | |
| from animatediff import get_dir | |
| from animatediff.cli import generate, logger | |
| config_dir = get_dir("config") | |
| config_path = config_dir.joinpath("prompts/test.json") | |
| width = 512 | |
| height = 512 | |
| length = 32 | |
| context = 16 | |
| stride = 4 | |
| logger.warn("Running first-round generation test, this should load the full model.\n\n") | |
| out_dir = generate( | |
| config_path=config_path, | |
| width=width, | |
| height=height, | |
| length=length, | |
| context=context, | |
| stride=stride, | |
| ) | |
| logger.warn(f"Generated animation to {out_dir}") | |
| logger.warn("\n\nRunning second-round generation test, this should reuse the already loaded model.\n\n") | |
| out_dir = generate( | |
| config_path=config_path, | |
| width=width, | |
| height=height, | |
| length=length, | |
| context=context, | |
| stride=stride, | |
| ) | |
| logger.warn(f"Generated animation to {out_dir}") | |
| logger.error("If the second round didn't talk about reloading the model, it worked! yay!") | |