Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README-FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ A: Use [**VBench**](https://github.com/Vchitect/VBench?tab=readme-ov-file#usage)
Use [**VBench-Long**](https://github.com/Vchitect/VBench/tree/master/vbench2_beta_long) for evaluating videos 5.0 seconds or longer (≥ 5.0s).
Each benchmark is optimized for its respective video length to ensure fair and consistent evaluation.

**Q: Does VBench support running on Huawei Ascend NPU?**<br>
A: Yes. [Ascend Extension for PyTorch](https://github.com/Ascend/pytorch) develops `torch_npu` to adapt Ascend NPU to PyTorch so that developers who use the PyTorch can obtain powerful compute capabilities of Ascend AI Processors. Please install `torch` and `torch_npu` before installing vbench if you are using Ascend NPU devices. For more details, please refer to the official [installation guide](https://github.com/Ascend/pytorch#installation).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ vbench evaluate --videos_path "sampled_videos/lavie/human_action" --dimension "h
##### Python
```python
from vbench import VBench
my_VBench = VBench(device, <path/to/VBench_full_info.json>, <path/to/save/dir>)
my_VBench = VBench(<your_device: cpu/cuda/npu>, <path/to/VBench_full_info.json>, <path/to/save/dir>)
my_VBench.evaluate(
videos_path = <video_path>,
name = <name>,
Expand Down
22 changes: 21 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import os

def check_torch_version():
use_cuda = False

try:
import torch
if not torch.cuda.is_available():
Expand All @@ -13,6 +15,8 @@ def check_torch_version():
print(cuda_version)
if cuda_version not in ["11.6", "11.7", "11.8", "12.1"]:
raise RuntimeError(f"\033[91mUnsupported CUDA version: {cuda_version}. Please install PyTorch with 11.6<=CUDA<=12.1.\033[0m")

use_cuda = True
except:
print("\033[93mPlease install torch and torchvision compiled with cuda 11.8 before installing vbench\033[0m")
print("\033[93mFor CUDA 11.8, run:\033[0m")
Expand All @@ -21,7 +25,23 @@ def check_torch_version():
print("\033[93m pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121\033[0m")
print("\033[93mFor CUDA 11 with PyTorch < 2.0 run:\033[0m")
print("\033[93m pip install torch==1.13.1 torchvision==0.14.1\033[0m")
raise
print("\033[93mTry to use Ascend NPU.\033[0m")

if use_cuda:
return

try:
import torch
import torch_npu

if not torch.npu.is_available():
raise RuntimeError("\033[91mAscend NPU is not available.\033[0m")

print("\033[92mUsing Ascend NPU to accelerate the process.\033[0m")
except:
print("\033[93mPlease install torch torch_npu and torchvision before installing vbench if you are using Ascend NPU devices.\033[0m")
print("\033[93mFor more details, please refer to the official installation guide: https://github.com/Ascend/pytorch#installation\033[0m")


def fetch_readme():
with open('README-pypi.md', encoding='utf-8') as f:
Expand Down
1 change: 1 addition & 0 deletions vbench/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, device, full_info_dir, output_path):
self.full_info_dir = full_info_dir # full json file that VBench originally provides
self.output_path = output_path # output directory to save VBench results
os.makedirs(self.output_path, exist_ok=True)
print0(f"Use device: {self.device}")

def build_full_dimension_list(self, ):
return ["subject_consistency", "background_consistency", "aesthetic_quality", "imaging_quality", "object_class", "multiple_objects", "color", "spatial_relationship", "scene", "temporal_style", 'overall_consistency', "human_action", "temporal_flickering", "motion_smoothness", "dynamic_degree", "appearance_style"]
Expand Down