
Reference:
How to run Stable Video Diffusion img2vid - Stable Diffusion Art (stable-diffusion-art.com)
https://video-stable-diffusion.com/install-svd-on-linux/
This tutorial uses the SVD XT model.
SVD – trained to generate 14 frames at resolution 576×1024.
SVD XT – trained to generate 25 frames at resolution 576×1024.
This tutorial works on Ubuntu 22.04.3 x86_64.
Preparation
Create a folder to isolate your project.
1 | mkdir ./xxx |
Enter the folder you just created.
1 | cd xxx |
Cloning
Pull the remote repository.
1 | git clone https://github.com/Stability-AI/generative-models |
Downloading the Model
(Since huggingface.co is blocked, we use a mirror here.)
stabilityai/stable-video-diffusion-img2vid at main (huggingface.co)
stabilityai/stable-video-diffusion-img2vid-xt at main (huggingface.co)
First, download the svd.safetensors model.
1 | mkdir checkpoints |
After downloading, return to the project root directory.
1 | cd .. |
Installing Dependencies
conda and Python
First install Anaconda (skip this if you already have it).
1 | wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh |
Note: during installation, you need to accept the license agreement first, type yes, and then continue.
After installation, you can delete the installer script.
1 | rm Anaconda3-2023.09-0-Linux-x86_64.sh |
Check whether the installation was successful.
1 | conda --v |
You should see a version number.
If it didn’t work, you can manually configure the environment variables.
1 | echo ". ~/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc |
Use conda to create a Python environment with Python 3.10.
1 | conda create --name svd python=3.10 -y |
Project Dependencies
1 | conda activate svd |
At this point, you should be in the virtual environment.
You can configure a domestic mirror source.
1 | pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/ |
Run the following command in the project root directory to install dependencies:
1 | pip3 install -r requirements/pt2.txt |
Launching
First set the environment variables, otherwise you’ll get an error.
1 | echo 'export PYTHONPATH=/generative-models:$PYTHONPATH' >> ~/.bashrc |
(If) it’s blocked and you need to manually download files, you don’t need to run the code below.
1 | # [Deprecated] If manually downloading files: |
Or try the code below to replace the mirror site. Just add the parameter on the first run; you won’t need it afterward.
1 | HF_ENDPOINT=https://hf-mirror.com streamlit run scripts/demo/video_sampling.py --server.address 0.0.0.0 --server.port 4801 |
You can change the -server.port parameter to set the access port.
Usage
Visit http://<ip>:4801