Compare commits
1
Commits
main
...
will/docker_demo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5931a65da8 |
@@ -0,0 +1,80 @@
|
|||||||
|
FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
|
WORKDIR /FastVideo
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
wget \
|
||||||
|
git \
|
||||||
|
ca-certificates \
|
||||||
|
openssh-server \
|
||||||
|
zsh \
|
||||||
|
vim \
|
||||||
|
curl \
|
||||||
|
gcc-11 \
|
||||||
|
g++-11 \
|
||||||
|
clang-11 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set up C++20 compilers for ThunderKittens
|
||||||
|
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11
|
||||||
|
|
||||||
|
# Set CUDA environment variables
|
||||||
|
ENV CUDA_HOME=/usr/local/cuda-12.8
|
||||||
|
ENV PATH=${CUDA_HOME}/bin:${PATH}
|
||||||
|
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
# Install Miniconda and create conda environment
|
||||||
|
COPY Miniconda3-latest-Linux-x86_64.sh /tmp/miniconda.sh
|
||||||
|
RUN bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh
|
||||||
|
ENV PATH=/opt/conda/bin:${PATH}
|
||||||
|
RUN /opt/conda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
|
||||||
|
RUN /opt/conda/bin/conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
||||||
|
RUN /opt/conda/bin/conda update -y -n base conda && \
|
||||||
|
/opt/conda/bin/conda create -y -n fastvideo python=3.12 && \
|
||||||
|
/opt/conda/bin/conda clean -afy
|
||||||
|
ENV PATH=/opt/conda/envs/fastvideo/bin:/opt/conda/bin:${PATH}
|
||||||
|
|
||||||
|
# Copy just the pyproject.toml first to leverage Docker cache
|
||||||
|
COPY pyproject.toml ./
|
||||||
|
|
||||||
|
# Create a dummy README to satisfy the installation
|
||||||
|
RUN echo "# Placeholder" > README.md
|
||||||
|
|
||||||
|
# Install project dependencies inside the conda environment
|
||||||
|
RUN source /opt/conda/etc/profile.d/conda.sh && \
|
||||||
|
conda activate fastvideo && \
|
||||||
|
pip install --no-cache-dir --upgrade pip && \
|
||||||
|
pip install --no-cache-dir .[dev] && \
|
||||||
|
pip install --no-cache-dir flash-attn==2.8.3 --no-build-isolation
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Install dependencies using pip inside conda env and set up shell configuration
|
||||||
|
RUN source /opt/conda/etc/profile.d/conda.sh && \
|
||||||
|
conda activate fastvideo && \
|
||||||
|
pip install --no-cache-dir -e .[dev] && \
|
||||||
|
git config --unset-all http.https://github.com/.extraheader || true && \
|
||||||
|
echo 'source /opt/conda/etc/profile.d/conda.sh && conda activate fastvideo' >> /root/.bashrc && \
|
||||||
|
echo 'if [ -n "$ZSH_VERSION" ] && [ -f ~/.zshrc ]; then . ~/.zshrc; elif [ -f ~/.bashrc ]; then . ~/.bashrc; fi' > /root/.profile
|
||||||
|
|
||||||
|
# Install STA (Sliding Tile Attention)
|
||||||
|
RUN source /opt/conda/etc/profile.d/conda.sh && \
|
||||||
|
conda activate fastvideo && \
|
||||||
|
cd csrc/attn/sliding_tile_attn && \
|
||||||
|
git submodule update --init --recursive && \
|
||||||
|
python setup.py install
|
||||||
|
|
||||||
|
# Install VSA
|
||||||
|
RUN source /opt/conda/etc/profile.d/conda.sh && \
|
||||||
|
conda activate fastvideo && \
|
||||||
|
cd csrc/attn/video_sparse_attn && \
|
||||||
|
git submodule update --init --recursive && \
|
||||||
|
python setup.py install
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/bash", "-lc", "source /opt/conda/etc/profile.d/conda.sh && conda activate fastvideo && exec /FastVideo/examples/inference/gradio/start.sh"]
|
||||||
@@ -200,7 +200,7 @@ class BaseModelDeployment:
|
|||||||
|
|
||||||
|
|
||||||
@serve.deployment(
|
@serve.deployment(
|
||||||
ray_actor_options={"num_cpus": 2, "num_gpus": 1, "runtime_env": {"conda": "fv"}},
|
ray_actor_options={"num_cpus": 15, "num_gpus": 1, "runtime_env": {"conda": "fastvideo"}},
|
||||||
)
|
)
|
||||||
class T2VModelDeployment(BaseModelDeployment):
|
class T2VModelDeployment(BaseModelDeployment):
|
||||||
def __init__(self, t2v_model_path: str, output_path: str = "outputs"):
|
def __init__(self, t2v_model_path: str, output_path: str = "outputs"):
|
||||||
@@ -210,7 +210,7 @@ class T2VModelDeployment(BaseModelDeployment):
|
|||||||
|
|
||||||
|
|
||||||
@serve.deployment(
|
@serve.deployment(
|
||||||
ray_actor_options={"num_cpus": 16, "num_gpus": 1, "runtime_env": {"conda": "fv"}},
|
ray_actor_options={"num_cpus": 16, "num_gpus": 1, "runtime_env": {"conda": "fastvideo"}},
|
||||||
)
|
)
|
||||||
class T2V14BModelDeployment(BaseModelDeployment):
|
class T2V14BModelDeployment(BaseModelDeployment):
|
||||||
def __init__(self, t2v_14b_model_path: str, output_path: str = "outputs"):
|
def __init__(self, t2v_14b_model_path: str, output_path: str = "outputs"):
|
||||||
@@ -227,7 +227,7 @@ app.state.limiter = limiter
|
|||||||
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
|
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
|
||||||
|
|
||||||
|
|
||||||
@serve.deployment(num_replicas=50, ray_actor_options={"num_cpus": 2})
|
@serve.deployment(num_replicas=1, ray_actor_options={"num_cpus": 2})
|
||||||
@serve.ingress(app)
|
@serve.ingress(app)
|
||||||
class FastVideoAPI:
|
class FastVideoAPI:
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
python examples/inference/gradio/start_ray_serve_app.py \
|
python examples/inference/gradio/serving/start_ray_serve_app.py \
|
||||||
--t2v_model_paths "FastVideo/FastWan2.1-T2V-1.3B-Diffusers,FastVideo/FastWan2.2-TI2V-5B-FullAttn-Diffusers" \
|
--t2v_model_paths "FastVideo/FastWan2.1-T2V-1.3B-Diffusers" \
|
||||||
--t2v_model_replicas "4,4"
|
--t2v_model_replicas "1"
|
||||||
Reference in New Issue
Block a user