Open-Sora: Democratizing Efficient Video Production for All
Python
format
Shen-Chenhui1254d8d53eb4
diff --git a/docs/installation.md b/docs/installation.mdindex 96fc8bf..5bd2900 100644--- a/docs/installation.md+++ b/docs/installation.md@@ -80,15 +80,16 @@ cd PLLaVAgit checkout fd9194a # since there is no version tag, we use this commitpython python_scripts/hf.py # download the PLLaVA weights-# create new environment because pllava only works well in its own environments:+# IMPORTANT: create new environment for reliable pllava performances:conda create -n pllava python=3.10# You need to manually install `torch`, `torchvision` and `xformers` for different CUDA versions, the following works for CUDA 12.1:conda activate pllavapip install -r ../../../requirements/requirements-cu121.txtpip install packaging ninjapip install flash-attn --no-build-isolation-# then manually remove any lines in requirements.txt that contains `cu11`, before installing:-pip install -r requirements.txt+# You may manually remove any lines in requirements.txt that contains `cu11`, then run `pip install -r requirements.txt`+# Alternatively, use our prepared pllava environment:+pip install -r ../../../../requirements/requirements-pllava.txt```### Frame Interpolation@@ -102,6 +103,16 @@ We use [`PySceneDetect`](https://github.com/Breakthrough/PySceneDetect) for thispip install scenedetect[opencv] --upgrade```+### OCR+We need to manualy create new environment for torch==2.0.1 in order to install [MMOCR](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html).+For reference, we install packages of these versions.+```+torch==2.0.1+mmcv==2.0.1+mmdet==3.1.0+mmocr==1.0.1+```+## Evaluation Dependencies@@ -116,6 +127,10 @@ Next, you need to manually install the packages listed in the following sectionsYou need to manually install apex from source by:```bash+# use latest pip, setuptools, and wheel; else may run into weird issues with apex+pip install -U pip+pip install -U setuptools+pip install -U wheel# set enable_layernorm_kernel=False in config to disable apexpip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.gitdiff --git a/requirements/requirements-pllava.txt b/requirements/requirements-pllava.txtnew file mode 100644index 0000000..238dcc4--- /dev/null+++ b/requirements/requirements-pllava.txt@@ -0,0 +1,248 @@+absl-py==2.1.0+accelerate==0.26.1+addict==2.4.0+aiofiles==23.2.1+aliyun-python-sdk-core==2.15.0+aliyun-python-sdk-kms==2.16.2+altair==5.2.0+annotated-types==0.6.0+antlr4-python3-runtime==4.9.3+anyio==4.3.0+anykeystore==0.2+apex==0.9.10.dev0+appdirs==1.4.4+argcomplete==3.2.3+attrs==23.2.0+av==10.0.0+beautifulsoup4==4.12.3+blessed==1.20.0+blessings==1.7+boto3==1.34.63+botocore==1.34.63+Brotli==1.1.0+cachetools==5.3.3+certifi==2024.2.2+cffi==1.16.0+charset-normalizer==3.3.2+click==8.1.7+colorama==0.4.6+contourpy==1.2.0+crcmod==1.7+cryptacular==1.6.2+cryptography==42.0.5+cycler==0.12.1+dacite==1.7.0+decorator==4.4.2+decord==0.6.0+deepspeed==0.14.0+defusedxml==0.7.1+Deprecated==1.2.14+dill==0.3.8+distro==1.9.0+dnspython==2.6.1+docker-pycreds==0.4.0+einops==0.6.1+exceptiongroup==1.2.0+fastapi==0.110.0+ffmpeg==1.4+ffmpy==0.3.2+fiftyone==0.23.6+fiftyone-brain==0.16.1+fiftyone_db==1.1.2+filelock==3.9.0+fonttools==4.49.0+fsspec==2024.2.0+ftfy==6.1.3+future==1.0.0+fvcore==0.1.5.post20221221+gdown==5.1.0+gitdb==4.0.11+GitPython==3.1.42+glob2==0.7+google-auth==2.28.2+google-auth-oauthlib==1.2.0+gpustat==1.1.1+gradio==4.21.0+gradio_client==0.12.0+graphql-core==3.2.3+greenlet==3.0.3+grpcio==1.62.1+h11==0.14.0+h2==4.1.0+hjson==3.1.0+hpack==4.0.0+httpcore==1.0.4+httpx==0.27.0+huggingface-hub==0.21.4+humanize==4.9.0+hupper==1.12.1+Hypercorn==0.16.0+hyperframe==6.0.1+idna==3.6+idscheck==2.3.0+imageio==2.27.0+imageio-ffmpeg==0.4.9+importlib_metadata==7.0.2+importlib_resources==6.3.0+inflate64==1.0.0+iopath==0.1.10+Jinja2==3.1.2+jmespath==0.10.0+joblib==1.3.2+jsonlines==4.0.0+jsonschema==4.21.1+jsonschema-specifications==2023.12.1+kaleido==0.2.1+kiwisolver==1.4.5+lazy_loader==0.3+Markdown==3.6+markdown-it-py==3.0.0+MarkupSafe==2.1.3+matplotlib==3.8.3+mdurl==0.1.2+mmcv-full==1.7.2+model-index==0.1.11+mongoengine==0.24.2+motor==3.3.2+moviepy==1.0.3+mpmath==1.3.0+multivolumefile==0.2.3+networkx==3.2.1+ninja==1.11.1.1+numpy==1.23.5+nvidia-ml-py==12.535.133+nvidia-ml-py3==7.352.0+oauthlib==3.2.2+omegaconf==2.3.0+openai==1.14.0+opencv-python==4.9.0.80+opencv-python-headless==4.9.0.80+opendatalab==0.0.10+openmim==0.3.9+openxlab==0.0.36+ordered-set==4.1.0+orjson==3.9.15+oss2==2.17.0+packaging==24.0+pandas==1.5.3+PasteDeploy==3.1.0+pathtools==0.1.2+pbkdf2==1.3+peft==0.10.0+pillow==10.2.0+plaster==1.1.2+plaster-pastedeploy==1.0.1+platformdirs==4.2.0+plotly==5.20.0+portalocker==2.8.2+pprintpp==0.4.0+priority==2.0.0+proglog==0.1.10+protobuf==4.23.4+psutil==5.9.4+py-cpuinfo==9.0.0+py7zr==0.21.0+pyasn1==0.5.1+pyasn1-modules==0.3.0+pybcj==1.0.2+pycparser==2.21+pycryptodome==3.20.0+pycryptodomex==3.20.0+pydantic==2.6.4+pydantic_core==2.16.3+pydub==0.25.1+Pygments==2.17.2+pymongo==4.6.2+pynvml==11.5.0+pyparsing==3.1.2+pyppmd==1.1.0+pyramid==2.0.2+pyramid-mailer==0.15.1+PySocks==1.7.1+python-dateutil==2.9.0.post0+python-multipart==0.0.9+python3-openid==3.2.0+pytz==2023.4+PyYAML==6.0+pyzstd==0.15.9+rarfile==4.1+referencing==0.33.0+regex==2023.12.25+repoze.sendmail==4.4.1+requests==2.28.2+requests-oauthlib==1.4.0+retrying==1.3.4+rich==13.4.2+rpds-py==0.18.0+rsa==4.9+ruff==0.3.2+s3transfer==0.10.1+safetensors==0.4.2+scikit-image==0.22.0+scikit-learn==1.4.1.post1+scipy==1.10.1+semantic-version==2.10.0+sentencepiece==0.2.0+sentry-sdk==1.42.0+setproctitle==1.3.3+shellingham==1.5.4+six==1.16.0+smmap==5.0.1+sniffio==1.3.1+sortedcontainers==2.4.0+soupsieve==2.5+SQLAlchemy==2.0.28+sse-starlette==0.10.3+sseclient-py==1.8.0+starlette==0.36.3+strawberry-graphql==0.138.1+sympy==1.12+tabulate==0.9.0+taskgroup==0.0.0a4+tenacity==8.2.3+tensorboard==2.15.1+tensorboard-data-server==0.7.2+tensorboardX==2.6.2.2+termcolor==2.3.0+texttable==1.7.0+threadpoolctl==3.3.0+tifffile==2024.2.12+timm==0.6.12+tokenizers==0.15.2+tomli==2.0.1+tomlkit==0.12.0+toolz==0.12.1+torch==2.2.2+torchaudio+torchvision==0.17.2+tqdm==4.65.2+transaction==4.0+transformers==4.37.1+translationstring==1.4+triton==2.2.0+typer==0.9.0+typing_extensions==4.8.0+tzdata==2024.1+tzlocal==5.2+universal-analytics-python3==1.1.1+urllib3==1.26.18+uvicorn==0.28.0+velruse==1.1.1+venusian==3.1.0+voxel51-eta==0.12.6+wandb==0.14.0+wcwidth==0.2.13+WebOb==1.8.7+websockets==11.0.3+Werkzeug==3.0.1+wrapt==1.16.0+wsproto==1.2.0+WTForms==3.1.2+wtforms-recaptcha==0.3.2+xmltodict==0.13.0+yacs==0.1.8+yapf==0.40.2+zipp==3.18.1+zope.deprecation==5.0+zope.interface==6.2+zope.sqlalchemy==3.1diff --git a/tools/frame_interpolation/interpolation.py b/tools/frame_interpolation/interpolation.pyindex 0cd822b..c9d8d1d 100644--- a/tools/frame_interpolation/interpolation.py+++ b/tools/frame_interpolation/interpolation.py@@ -147,7 +147,7 @@ def write(outputs, input_path, output_path, fps=30):file_name, _ = os.path.splitext(file_name_with_extension)save_video_path = f"{output_path}/fps{fps}_{file_name}.mp4"- fourcc = cv2.VideoWriter_fourcc(*"avc1")+ fourcc = cv2.VideoWriter_fourcc(*"mp4v")writer = cv2.VideoWriter(save_video_path, fourcc, fps, size)for i, imgt_pred in enumerate(outputs):diff --git a/tools/scoring/README.md b/tools/scoring/README.mdindex 7c5ea2e..bdf74c7 100644--- a/tools/scoring/README.md+++ b/tools/scoring/README.md@@ -45,7 +45,9 @@ This will generate multiple part files, each corresponding to a node . Run `pythOptical flow scores are used to assess the motion of a video. Higher optical flow scores indicate larger movement.We use the [UniMatch](https://github.com/autonomousvision/unimatch) model for this task.-First, download the pretrained model to `./pretrained_model/unimatch/`+First, install the required packages following our [installation instructions](../../docs/installation.md)'s "Data Dependencies".++Next, download the pretrained model to `./pretrained_model/unimatch/````bashwget https://s3.eu-central-1.amazonaws.com/avg-projects/unimatch/pretrained/gmflow-scale2-regrefine6-mixdata-train320x576-4e7b215d.pth -P ./pretrained_models/unimatch/```@@ -62,14 +64,16 @@ Some videos are of dense text scenes like news broadcast and advertisement, whicWe apply Optical Character Recognition (OCR) to detect texts and drop samples with dense texts. Here, we usethe [DBNet++](https://arxiv.org/abs/2202.10304) model implemented by [MMOCR](https://github.com/open-mmlab/mmocr/).-First, install [MMOCR](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html).+First, install the required packages following our [installation instructions](../../docs/installation.md)'s "OCR" section.++<!-- First, install [MMOCR](https://mmocr.readthedocs.io/en/dev-1.x/get_started/install.html).For reference, we install packages of these versions.```torch==2.0.1mmcv==2.0.1mmdet==3.1.0mmocr==1.0.1-```+``` -->Then, run the following command. **Make sure** the meta file has column `path` (path to the sample).```bashdiff --git a/tools/scoring/optical_flow/inference.py b/tools/scoring/optical_flow/inference.pyindex 499ff06..ff5dd21 100644--- a/tools/scoring/optical_flow/inference.py+++ b/tools/scoring/optical_flow/inference.py@@ -13,7 +13,7 @@ from torchvision.transforms.functional import pil_to_tensorfrom tqdm import tqdmfrom tools.datasets.utils import extract_frames-from .unimatch import UniMatch+from tools.scoring.optical_flow.unimatch import UniMatchdef merge_scores(gathered_list: list, meta: pd.DataFrame, column):@@ -146,7 +146,7 @@ def main():gathered_list = [None] * dist.get_world_size()dist.all_gather_object(gathered_list, (indices_list, scores_list))if dist.get_rank() == 0:- meta_new = merge_scores(gathered_list, dataset.meta, column='flow')+ meta_new = merge_scores(gathered_list, dataset.meta, column="flow")meta_new.to_csv(out_path, index=False)print(f"New meta with optical flow scores saved to '{out_path}'.")