Open-Sora: Democratizing Efficient Video Production for All
Python
update readme (#6)
Zheng Zangwei (Alex Zheng)2679bad9a01a
diff --git a/tools/caption/README.md b/tools/caption/README.mdindex e0aff58..fc1ae31 100644--- a/tools/caption/README.md+++ b/tools/caption/README.md@@ -1,9 +1,11 @@# Video Captioning-Human labeling of videos is expensive and time-consuming. We adopt powerful image captioning models to generate captions for videos. Although GPT-4V achieves a better performance, its 20s/sample speed is too slow for us. With batch inference, we can achieve a speed of 3s/sample with LLaVA, and the quality is comparable. LLaVA is the second best open-source model in [MMMU](https://mmmu-benchmark.github.io/) and accepts any resolution.+Human labeling of videos is expensive and time-consuming. We adopt powerful image captioning models to generate captions for videos. Although GPT-4V achieves a better performance, its 20s/sample speed is too slow for us. LLaVA is the second best open-source model in [MMMU](https://mmmu-benchmark.github.io/) and accepts any resolution. We find the quality of 34B model is comparable.+We extract three frames from the video for captioning. With batch inference, we can achieve 10 times speedup, with 2.4 videos/s on 8 GPUs.+## GPT-4V CaptioningRun the following command to generate captions for videos with GPT-4V:@@ -16,11 +18,34 @@ The cost is approximately $0.01 per video (3 frames per video). The output is a## LLaVA Captioning-First, install LLaVA according to their [official instructions](https://github.com/haotian-liu/LLaVA?tab=readme-ov-file#install). We use the `liuhaotian/llava-v1.6-34b` model for captioning, which can be download [here](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-7b). Then, run the following command to generate captions for videos with LLaVA:+### Requirement++```bash+# create conda env+conda create -n llava python=3.10 -y+conda activate llava++# install llava+git clone https://github.com/haotian-liu/LLaVA.git+cd LLaVA+pip install --upgrade pip # enable PEP 660 support+pip install -e .++# 如果你在英博机器上,需要重新安装torch+pip uninstall torch torchvision torchaudio+conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia++# install flash attention+pip install flash-attn --no-build-isolation+```++First, install LLaVA according to their [official instructions](https://github.com/haotian-liu/LLaVA?tab=readme-ov-file#install). We use the `liuhaotian/llava-v1.6-34b` model for captioning, which can be download [here](https://huggingface.co/liuhaotian/llava-v1.6-vicuna-7b).++### Usage++Then, run the following command to generate captions for videos with LLaVA:```bash# we run this on 8xH800 GPUstorchrun --nproc_per_node 8 --standalone -m tools.caption.caption_llava samples output.csv --tp-size 2 --dp-size 4 --bs 16```--The Yi-34B requires 2 80GB GPUs and 3s/sample. The output is a CSV file with path and caption.