diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8ddadbf8d..74cef0ae8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -36,9 +36,13 @@ defaults: shell: bash jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + # Build job build: runs-on: ubuntu-latest + needs: pre-commit steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 940ba0b85..8a01a7a20 100644 --- a/.gitignore +++ b/.gitignore @@ -3,14 +3,11 @@ __pycache__ *.pth UCF-101/ results/ -build/ -fastvideo.egg-info/ wandb/ *.ipynb *.jpg *.safetensors *.mp4 -!fastvideo/v1/tests/ssim/reference_videos/**/*.mp4 *.png *.gif *.pth @@ -26,11 +23,36 @@ outputs_video sbatch.sh *.out env -dist/ *.o **/build/ -**.egg-info **.pyc -**.egg **.txt -**.json \ No newline at end of file +**.json + +# Distribution / packaging +build/ +dist/ +*.egg-info/ +*.egg +eggs/ +.eggs/ + +# Sphinx documentation +docs/_build/ +docs/source/getting_started/examples/ + +# VSCode +.vscode/ + +# DS Store +.DS_Store + +# vim swap files +*.swo +*.swp + +# Python pickle files +*.pkl + +# Reference videos +!fastvideo/v1/tests/ssim/reference_videos/**/*.mp4 \ No newline at end of file diff --git a/README.md b/README.md index df761146e..dc6e6ba67 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ FastVideo is a lightweight framework for accelerating large video diffusion models.

- 🤗 FastHunyuan | 🤗 FastMochi | 🟣💬 Slack + | Documentation | 🤗 FastHunyuan | 🤗 FastMochi | 🟣💬 Slack |

https://github.com/user-attachments/assets/79af5fb8-707c-4263-b153-9ab2a01d3ac1 diff --git a/docs/source/developer_guide/overview.md b/docs/source/developer_guide/overview.md index 3d81f9a6a..1528c3ff9 100644 --- a/docs/source/developer_guide/overview.md +++ b/docs/source/developer_guide/overview.md @@ -1,3 +1,5 @@ +(developer-guide)= + # Contributing to FastVideo Thank you for your interest in contributing to FastVideo. We want to make the process as smooth for you as possible and this is a guide to help get you started! @@ -27,7 +29,7 @@ conda activate fastvideo Clone the FastVideo repository and go to the FastVideo directory: ``` -git clone https://github.com/vllm-project/vllm.git && cd vllm +git clone https://github.com/hao-ai-lab/FastVideo.git && cd FastVideo ``` diff --git a/docs/source/generate_examples.py b/docs/source/generate_examples.py index 22912bc98..8614ca0f4 100644 --- a/docs/source/generate_examples.py +++ b/docs/source/generate_examples.py @@ -1,4 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 +# adapted from vllm: https://github.com/vllm-project/vllm/blob/v0.7.3/docs/source/generate_examples.py import itertools import re @@ -177,28 +178,28 @@ def generate_examples(): # Category indices stored in reverse order because they are inserted into # examples_index.documents at index 0 in order category_indices = { - "other": + # "other": + # Index( + # path=EXAMPLE_DOC_DIR / "examples_other_index.md", + # title="Other", + # description= + # "Other examples that don't strongly fit into the online or offline serving categories.", # noqa: E501 + # caption="Examples", + # ), + # "online_serving": + # Index( + # path=EXAMPLE_DOC_DIR / "examples_online_serving_index.md", + # title="Online Serving", + # description= + # "Online serving examples demonstrate how to use FastVideo in an online setting, where the model is queried for predictions in real-time.", # noqa: E501 + # caption="Examples", + # ), + "inference": Index( - path=EXAMPLE_DOC_DIR / "examples_other_index.md", - title="Other", + path=EXAMPLE_DOC_DIR / "examples_inference_index.md", + title="Inference", description= - "Other examples that don't strongly fit into the online or offline serving categories.", # noqa: E501 - caption="Examples", - ), - "online_serving": - Index( - path=EXAMPLE_DOC_DIR / "examples_online_serving_index.md", - title="Online Serving", - description= - "Online serving examples demonstrate how to use FastVideo in an online setting, where the model is queried for predictions in real-time.", # noqa: E501 - caption="Examples", - ), - "offline_inference": - Index( - path=EXAMPLE_DOC_DIR / "examples_offline_inference_index.md", - title="Offline Inference", - description= - "Offline inference examples demonstrate how to use FastVideo in an offline setting, where the model is queried for predictions in batches. We recommend starting with .", # noqa: E501 + "Inference examples demonstrate how to use FastVideo in an offline setting, where the model is queried for predictions in batches. We recommend starting with .", # noqa: E501 caption="Examples", ), } diff --git a/docs/source/getting_started/examples/examples_index.md b/docs/source/getting_started/examples/examples_index.md deleted file mode 100644 index 3f5b48069..000000000 --- a/docs/source/getting_started/examples/examples_index.md +++ /dev/null @@ -1,10 +0,0 @@ -# Examples - -A collection of examples demonstrating usage of FastVideo. -All documented examples are autogenerated using from examples found in . - -:::{toctree} -:caption: Examples -:maxdepth: 2 - -::: diff --git a/docs/source/getting_started/installation.md b/docs/source/getting_started/installation.md index 52d2ef0b9..ab3d1a9e1 100644 --- a/docs/source/getting_started/installation.md +++ b/docs/source/getting_started/installation.md @@ -1,10 +1,85 @@ (fastvideo-installation)= # 🔧 Installation -The code is tested on Python 3.10.0, CUDA 12.4 and H100. -``` -./env_setup.sh fastvideo +FastVideo currently only supports Linux and CUDA GPUs. The code is tested on Python 3.10.0 and CUDA 12.4, primarily with NVIDIA H100 GPUs. + +## Prerequisites + +- CUDA 12.4 installed and supported +- Linux operating system + +## Installation Options + +### Option 1: Quick Install + +```bash +pip install fastvideo ``` -To try Sliding Tile Attention (optional), please follow the instruction in [here](#sta-installation) to install STA. +### Option 2: Installation from Source + +#### 1. Install Miniconda (if not already installed) + +```bash +wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +bash Miniconda3-latest-Linux-x86_64.sh +source ~/.bashrc +``` + +#### 2. Create and activate a Conda environment for FastVideo + +```bash +conda create -n fastvideo python=3.10 -y +conda activate fastvideo +``` + +#### 3. Clone the FastVideo repository + +```bash +git clone https://github.com/hao-ai-lab/FastVideo.git && cd FastVideo +``` + +#### 4. Install FastVideo + +Basic installation: + +```bash +pip install -e . +``` + +## Optional Dependencies + +### Flash Attention + +```bash +pip install flash-attn==2.7.0.post2 --no-build-isolation +``` + +### Sliding Tile Attention (STA) + +To try Sliding Tile Attention (optional), please follow the instructions in [csrc/sliding_tile_attention/README.md](#sta-installation) to install STA. + +## Development Environment Setup + +If you're planning to contribute to FastVideo please see the following page: +[Contributor Guide](#developer-guide) + +## Hardware Requirements + +### For Basic Inference +- NVIDIA GPU with CUDA support +- Minimum 20GB VRAM for quantized models (e.g., single RTX 4090) + +### For Lora Finetuning +- 40GB GPU memory each for 2 GPUs with lora +- 30GB GPU memory each for 2 GPUs with CPU offload and lora + +### For Full Finetuning/Distillation +- Multiple high-memory GPUs recommended (e.g., H100) + +## Troubleshooting + +If you encounter any issues during installation, please open an issue on our [GitHub repository](https://github.com/hao-ai-lab/FastVideo). + +You can also join our [Slack community](https://join.slack.com/t/fastvideo/shared_invite/zt-2zf6ru791-sRwI9lPIUJQq1mIeB_yjJg) for additional support. diff --git a/examples/inference/basic/README.md b/examples/inference/basic/README.md new file mode 100644 index 000000000..82ae0d88e --- /dev/null +++ b/examples/inference/basic/README.md @@ -0,0 +1,3 @@ +# Basic + +The class provides the main python interface for using FastVideo's inference pipeline. diff --git a/examples/inference/basic/basic.py b/examples/inference/basic/basic.py new file mode 100644 index 000000000..8c854ae3f --- /dev/null +++ b/examples/inference/basic/basic.py @@ -0,0 +1 @@ +print('Hello, world!') \ No newline at end of file