Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

format

Shen-Chenhui1c2d62e37dd4
diff --git a/docs/installation.md b/docs/installation.md
index 9c41d0d..6229105 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -4,7 +4,7 @@ Requirements are listed in `requirements` folder.
## Different CUDA versions
-You need to mannually install `torch`, `torchvision` and `xformers` for different CUDA versions.
+You need to manually install `torch`, `torchvision` and `xformers` for different CUDA versions.
```bash
# install torch (>=2.1 is recommended)
@@ -24,5 +24,35 @@ The default installation is for inference only. Other optional dependencies are
```bash
pip install -v .[data] # for data preprocessing
-pip install -v .[eval] # for evaluation
+pip install -v .[eval] # for evaluation, need to manually install some packages detailed below
+```
+
+
+## Evaluation Dependencies
+
+```bash
+pip install -v .[eval]
+```
+
+#### VBench
+You need to manually install [VBench](https://github.com/Vchitect/VBench):
+```bash
+pip install --no-deps vbench==0.1.1
+# If the installation shows a warning about the intalled vbench not in PATH, you need to add it by:
+export PATH="/path/to/vbench:$PATH"
+```
+
+
+#### VAE
+
+You need to mannually install [cupy](https://docs.cupy.dev/en/stable/install.html).
+* For CUDA v11.2~11.8 (x86_64 / aarch64), `pip install cupy-cuda11x`
+* For CUDA v12.x (x86_64 / aarch64), `pip install cupy-cuda12x`
+
+Note that for VAE evaluation, you may run into error with `ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'`, in this case, you need to go to the corresponding file (`.../pytorchvideo/transforms/augmentations.py`) reporting this error, then change as following:
+```yaml
+# find the original line:
+import torchvision.transforms.functional_tensor as F_t
+# change to:
+import torchvision.transforms._functional_tensor as F_t
```
diff --git a/eval/README.md b/eval/README.md
index 891fd87..bf349b9 100644
--- a/eval/README.md
+++ b/eval/README.md
@@ -6,11 +6,11 @@ To conduct human evaluation, we need to generate various samples. We provide man
```bash
# image (1)
-bash eval/sample.sh /path/to/ckpt -1
+bash eval/sample.sh /path/to/ckpt num_frames model_name_for_log -1
# video (2a 2b 2c ...)
-bash eval/sample.sh /path/to/ckpt -2a
+bash eval/sample.sh /path/to/ckpt num_frames model_name_for_log -2a
# launch 8 jobs at once (you must read the script to understand the details)
-bash eval/launch.sh /path/to/ckpt
+bash eval/human_eval/launch.sh /path/to/ckpt /path/to/ckpt num_frames model_name_for_log
```
## Rectified Flow Loss
@@ -38,14 +38,16 @@ bash eval/loss/launch.sh /path/to/ckpt
[VBench](https://github.com/Vchitect/VBench) is a benchmark for short text to video generation. We provide a script for easily generating samples required by VBench.
+First, generate the relevant videos with the following commands:
+
```bash
# vbench tasks (4a 4b 4c ...)
-bash eval/sample.sh /path/to/ckpt -4a
+bash eval/sample.sh /path/to/ckpt -4a
# launch 8 jobs at once (you must read the script to understand the details)
-bash eval/launch.sh /path/to/ckpt
+bash eval/vbench/launch.sh /path/to/ckpt
```
-After generation, install the VBench package according to their [instructions](https://github.com/Vchitect/VBench?tab=readme-ov-file#hammer-installation). Then, run the following commands to evaluate the generated samples.
+After generation, install the VBench package following our [installation](../docs/installation.md)'s sections of "Evaluation Dependencies". Then, run the following commands to evaluate the generated samples.
```bash
bash eval/vbench/vbench.sh /path/to/video_folder
@@ -59,24 +61,9 @@ TBD
## VAE
-### Dependencies
-
-- Install cupy: follow https://docs.cupy.dev/en/stable/install.html
-
-- To use flolpips model, download from https://github.com/danier97/flolpips/blob/main/weights/v0.1/alex.pth and place it under: `eval/vae/flolpips/weights/v0.1/alex.pth`
-
-``` bash
-pip install decord
-pip install pytorchvideo
-pip install lpips
-pip install scipy
-# Also, if torchvision.transforms.augentation still use `functional_tensor` and cause error,change to use `_functional_tensor`, follow https://blog.csdn.net/lanxing147/article/details/136625264
-```
-
-
-### Commands: carefule to change the setting to training setting
+Install the dependencies package following our [installation](../docs/installation.md)'s s sections of "Evaluation Dependencies". Then, run the following evaluation command:
```bash
# metric can any one or list of: ssim, psnr, lpips, flolpips
-python eval/vae/eval_common_metric.py --batch_size 2 --real_video_dir <path/to/original/videos> --generated_video_dir <path/to/generated/videos> --device cuda --sample_fps 24 --crop_size 256 --resolution 256 --num_frames 17 --sample_rate 1 --metric ssim psnr lpips flolpips
+python eval/vae/eval_common_metric.py --batch_size 2 --real_video_dir path/to/original/videos --generated_video_dir path/to/generated/videos --device cuda --sample_fps 24 --crop_size 256 --resolution 256 --num_frames 17 --sample_rate 1 --metric ssim psnr lpips flolpips
```
diff --git a/eval/sample.sh b/eval/sample.sh
index dc29e4b..3ae760d 100644
--- a/eval/sample.sh
+++ b/eval/sample.sh
@@ -7,9 +7,11 @@ CKPT=$1
NUM_FRAMES=$2
MODEL_NAME=$3
-let DOUBLE_FRAMES=$2*2
-let QUAD_FRAMES=$2*4
-let OCT_FRAMES=$2*8
+if [ -z "${NUM_FRAMES}" ]; then
+ let DOUBLE_FRAMES=$2*2
+ let QUAD_FRAMES=$2*4
+ let OCT_FRAMES=$2*8
+fi
CMD="python scripts/inference.py configs/opensora-v1-2/inference/sample.py"
CMD_REF="python scripts/inference-long.py configs/opensora-v1-2/inference/sample.py"
diff --git a/requirements/requirements-eval.txt b/requirements/requirements-eval.txt
index e69de29..33c693f 100644
--- a/requirements/requirements-eval.txt
+++ b/requirements/requirements-eval.txt
@@ -0,0 +1,9 @@
+# [vbench]
+detectron2 @ git+https://github.com/facebookresearch/[email protected]
+
+
+# [vae]
+decord==0.6.0
+pytorchvideo==0.1.5
+lpips==0.1.4
+scipy==1.13.0
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index 8a7b440..a04c9b5 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -9,18 +9,18 @@ accelerate==0.29.2 # for t5
av>=12.0.0
# [gradio]
-gradio
-spaces
+gradio==4.31.3
+spaces==0.28.3
# [notebook]
-ipykernel
-ipywidgets
+ipykernel==6.29.4
+ipywidgets==8.1.2
# [training]
-wandb
-tensorboard
-pandarallel
-pyarrow # for parquet
+wandb==0.17.0
+tensorboard==2.16.2
+pandarallel==1.6.5
+pyarrow==16.1.0 # for parquet
# [dev]
-pre-commit
+pre-commit==3.7.1