forked from LiveCarta/ContentGeneration
Migrate to uv sync and pytest coverage workflow
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -2,13 +2,13 @@ FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
UV_SYSTEM_PYTHON=1 \
|
||||
UV_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cu121 \
|
||||
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True,max_split_size_mb:128
|
||||
|
||||
# Base OS tools + media stack + Python toolchain.
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3.10 \
|
||||
python3-pip \
|
||||
python3.10-dev \
|
||||
python3.10-venv \
|
||||
ffmpeg \
|
||||
@@ -23,18 +23,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libgl1 \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& ln -sf /usr/bin/python3.10 /usr/bin/python \
|
||||
&& ln -sf /usr/bin/pip3 /usr/bin/pip \
|
||||
&& git lfs install
|
||||
|
||||
# Install uv.
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.6.17 /uv /uvx /usr/local/bin/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install project Python dependencies first for better layer caching.
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
# Install app Python dependencies first for better layer caching.
|
||||
COPY pyproject.toml README.md /app/
|
||||
|
||||
RUN python -m pip install --upgrade pip setuptools wheel \
|
||||
&& pip install --index-url https://download.pytorch.org/whl/cu121 torch torchvision torchaudio \
|
||||
&& pip install -r /app/requirements.txt \
|
||||
&& pip install -U accelerate safetensors
|
||||
RUN uv sync --system --no-dev --no-install-project
|
||||
|
||||
# Ensure HunyuanVideo source exists in the image.
|
||||
ARG HUNYUAN_REPO=https://github.com/Tencent-Hunyuan/HunyuanVideo-1.5.git
|
||||
@@ -44,22 +43,23 @@ RUN if [ ! -f /app/HunyuanVideo-1.5/requirements.txt ]; then \
|
||||
fi
|
||||
|
||||
# Install HunyuanVideo dependencies from upstream README guidance.
|
||||
RUN pip install -r /app/HunyuanVideo-1.5/requirements.txt \
|
||||
&& pip install --upgrade tencentcloud-sdk-python \
|
||||
&& pip install sgl-kernel==0.3.18
|
||||
RUN uv pip install --system -r /app/HunyuanVideo-1.5/requirements.txt \
|
||||
&& uv pip install --system --upgrade tencentcloud-sdk-python \
|
||||
&& uv pip install --system sgl-kernel==0.3.18
|
||||
|
||||
# Optional attention backends from Hunyuan docs.
|
||||
# Build with: --build-arg INSTALL_OPTIONAL_ATTENTION=1
|
||||
ARG INSTALL_OPTIONAL_ATTENTION=0
|
||||
RUN if [ "$INSTALL_OPTIONAL_ATTENTION" = "1" ]; then \
|
||||
pip install flash-attn --no-build-isolation && \
|
||||
uv pip install --system flash-attn --no-build-isolation && \
|
||||
git clone --depth 1 https://github.com/Tencent-Hunyuan/flex-block-attn.git /tmp/flex-block-attn && \
|
||||
cd /tmp/flex-block-attn && git submodule update --init --recursive && python setup.py install && \
|
||||
git clone --depth 1 https://github.com/cooper1637/SageAttention.git /tmp/SageAttention && \
|
||||
cd /tmp/SageAttention && python setup.py install; \
|
||||
fi
|
||||
|
||||
COPY . .
|
||||
# Copy application source after dependencies are installed.
|
||||
COPY . /app
|
||||
|
||||
# Default pipeline entrypoint.
|
||||
CMD ["python", "run_video_pipeline.py"]
|
||||
|
||||
Reference in New Issue
Block a user