Instructions to use stabilityai/stable-video-diffusion-img2vid-xt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use stabilityai/stable-video-diffusion-img2vid-xt with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image, export_to_video # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt", dtype=torch.bfloat16, device_map="cuda") pipe.to("cuda") prompt = "A man with short gray hair plays a red electric guitar." image = load_image( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/guitar-man.png" ) output = pipe(image=image, prompt=prompt).frames[0] export_to_video(output, "output.mp4") - Notebooks
- Google Colab
- Kaggle
Why its taking so much time while running, I would be able to get video or not
arpitagnihotri@Shobhit-MacBook-Air image_to_3d % /usr/local/bin/python3 /Users/
arpitagnihotri/image_to_3d/app2.py
The token has not been saved to the git credentials helper. Pass add_to_git_credential=True in this function directly or --add-to-git-credential if using via huggingface-cli if you want to set the git credential as well.
Token is valid (permission: read).
Your token has been saved to /Users/arpitagnihotri/.cache/huggingface/token
Login successful
INFO:main:Loading the pipeline...
Loading pipeline components...: 100%|ββββββββββββ| 5/5 [00:00<00:00, 8.17it/s]
INFO:main:Pipeline moved to cpu
INFO:main:Using CPU
INFO:main:Generating video...
0%| | 0/25 [00:00<?, ?it/s]
@shobhitagnihotri It will take forever since you are using cpu. You have to move it to your mps(mac) by doing
Pipe.to(βmpsβ)
Thanks YAThar , Yeah I have moved .