Update Dockerfile
Browse files- Dockerfile +45 -60
Dockerfile
CHANGED
|
@@ -30,36 +30,49 @@ ENV OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 MAX_JOBS=160
|
|
| 30 |
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8
|
| 31 |
ENV CUDA_LAUNCH_BLOCKING=0 CUDA_CACHE_MAXSIZE=2147483648 CUDA_CACHE_DISABLE=0
|
| 32 |
|
| 33 |
-
#
|
| 34 |
ENV APP_HOME=/app
|
| 35 |
WORKDIR $APP_HOME
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
-
RUN
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
# ----------------
|
| 45 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 46 |
build-essential gosu tree cmake git git-lfs curl wget ffmpeg ninja-build \
|
| 47 |
-
python3.10 python3.10-dev python3.10-distutils python3-pip
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 && \
|
| 51 |
-
ln -sf /usr/bin/python3.10 /usr/bin/python
|
| 52 |
python3 -m pip install --upgrade pip
|
| 53 |
|
| 54 |
-
|
| 55 |
-
# ---------------- PyTorch cu128 (pinado) ----------------
|
| 56 |
RUN pip install --index-url https://download.pytorch.org/whl/cu128 \
|
| 57 |
torch==2.8.0+cu128 torchvision==0.23.0+cu128 torchaudio==2.8.0+cu128
|
| 58 |
|
| 59 |
-
# ---------------- Toolchain, Triton, FA2 (
|
| 60 |
-
RUN pip install packaging ninja cmake pybind11 scikit-build cython hf_transfer numpy>=1.24.4
|
| 61 |
|
| 62 |
-
# Triton 3.x (
|
| 63 |
RUN pip uninstall -y triton || true && \
|
| 64 |
pip install -v --no-build-isolation triton==3.4.0
|
| 65 |
|
|
@@ -69,72 +82,44 @@ RUN pip install flash-attn==2.8.3 --no-build-isolation || \
|
|
| 69 |
pip install flash-attn==2.8.1 --no-build-isolation || \
|
| 70 |
pip install flash-attn==2.8.0.post2 --no-build-isolation
|
| 71 |
|
| 72 |
-
#
|
| 73 |
-
#RUN pip install --no-cache-dir diffusers>=0.31.0 transformers>=4.44.2 accelerate>=0.34.2 omegaconf>=2.3.0
|
| 74 |
-
|
| 75 |
-
# Opcional: seu fork de otimizações
|
| 76 |
-
#RUN pip install -U git+https://github.com/carlex22/diffusers-aduc-sdr
|
| 77 |
-
|
| 78 |
-
# ---------------- Dependências da aplicação ----------------
|
| 79 |
COPY requirements.txt ./requirements.txt
|
| 80 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
pip install --no-cache-dir \
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
|
| 91 |
-
|
| 92 |
|
| 93 |
# ====================================================================
|
| 94 |
-
#
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
# 2. Instala a biblioteca LTX-Video a partir do fork (esta parte permanece igual)
|
| 100 |
-
#git clone https://github.com/Lightricks/LTX-Video.git /data/LTX-Video && \
|
| 101 |
-
#cd /data/LTX-Video && \
|
| 102 |
-
#python -m venv env && \
|
| 103 |
-
#source env/bin/activate && \
|
| 104 |
-
#python -m pip install -e .\[inference\] && \
|
| 105 |
-
#cd ..
|
| 106 |
# ====================================================================
|
| 107 |
|
| 108 |
-
# Scripts
|
| 109 |
COPY info.sh ./app/info.sh
|
| 110 |
COPY builder.sh ./app/builder.sh
|
| 111 |
COPY start.sh ./app/start.sh
|
| 112 |
COPY entrypoint.sh ./app/entrypoint.sh
|
| 113 |
|
|
|
|
| 114 |
COPY . .
|
| 115 |
-
RUN useradd -m -u 1000 -s /bin/bash appuser
|
| 116 |
-
RUN chown -R appuser:appuser /app && \
|
| 117 |
-
chmod 0755 /app/entrypoint.sh /app/start.sh /app/info.sh /app/builder.sh
|
| 118 |
-
|
| 119 |
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
-
# Declara volume persistente para HF Spaces
|
| 122 |
VOLUME /data
|
| 123 |
|
| 124 |
-
# Env vars para caches em /data
|
| 125 |
-
ENV HF_HOME=/data/.cache/huggingface
|
| 126 |
-
ENV TORCH_HOME=/data/.cache/torch
|
| 127 |
-
ENV HF_DATASETS_CACHE=/data/.cache/datasets
|
| 128 |
-
ENV TRANSFORMERS_CACHE=/data/.cache/transformers
|
| 129 |
-
ENV DIFFUSERS_CACHE=/data/.cache/diffusers
|
| 130 |
-
ENV HF_HUB_ENABLE_HF_TRANSFER=1
|
| 131 |
-
ENV TOKENIZERS_PARALLELISM=false
|
| 132 |
-
|
| 133 |
-
|
| 134 |
ENTRYPOINT ["/app/entrypoint.sh"]
|
| 135 |
-
|
| 136 |
USER appuser
|
| 137 |
|
| 138 |
# ---------------- Entry ----------------
|
| 139 |
-
|
| 140 |
-
CMD ["/app/start.sh"]
|
|
|
|
| 30 |
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8
|
| 31 |
ENV CUDA_LAUNCH_BLOCKING=0 CUDA_CACHE_MAXSIZE=2147483648 CUDA_CACHE_DISABLE=0
|
| 32 |
|
| 33 |
+
# App paths
|
| 34 |
ENV APP_HOME=/app
|
| 35 |
WORKDIR $APP_HOME
|
| 36 |
|
| 37 |
+
# Persistent data and caches in /data
|
| 38 |
+
ENV HF_HOME=/data/.cache/huggingface
|
| 39 |
+
ENV TORCH_HOME=/data/.cache/torch
|
| 40 |
+
ENV HF_DATASETS_CACHE=/data/.cache/datasets
|
| 41 |
+
ENV TRANSFORMERS_CACHE=/data/.cache/transformers
|
| 42 |
+
ENV DIFFUSERS_CACHE=/data/.cache/diffusers
|
| 43 |
+
ENV HF_HUB_ENABLE_HF_TRANSFER=1
|
| 44 |
+
ENV TOKENIZERS_PARALLELISM=false
|
| 45 |
|
| 46 |
+
# Create non-root user and data dirs early, fix ownership
|
| 47 |
+
RUN useradd -m -u 1000 -s /bin/bash appuser && \
|
| 48 |
+
mkdir -p /data /data/models \
|
| 49 |
+
/data/.cache/huggingface /data/.cache/torch \
|
| 50 |
+
/data/.cache/datasets /data/.cache/transformers /data/.cache/diffusers && \
|
| 51 |
+
chown -R appuser:appuser /data
|
| 52 |
|
| 53 |
+
# Models live in /data/models and are visible at /app/models
|
| 54 |
+
ENV MODELS_DIR=/data/models
|
| 55 |
+
RUN ln -sf /data/models /app/models
|
| 56 |
|
| 57 |
+
# ---------------- System & Python ----------------
|
| 58 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 59 |
build-essential gosu tree cmake git git-lfs curl wget ffmpeg ninja-build \
|
| 60 |
+
python3.10 python3.10-dev python3.10-distutils python3-pip \
|
| 61 |
+
ca-certificates libglib2.0-0 libgl1 \
|
| 62 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 63 |
|
| 64 |
RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 && \
|
| 65 |
+
ln -sf /usr/bin/python3.10 /usr/bin/python && \
|
| 66 |
python3 -m pip install --upgrade pip
|
| 67 |
|
| 68 |
+
# ---------------- PyTorch cu128 (pinned) ----------------
|
|
|
|
| 69 |
RUN pip install --index-url https://download.pytorch.org/whl/cu128 \
|
| 70 |
torch==2.8.0+cu128 torchvision==0.23.0+cu128 torchaudio==2.8.0+cu128
|
| 71 |
|
| 72 |
+
# ---------------- Toolchain, Triton, FA2 (no bnb build) ----------------
|
| 73 |
+
RUN pip install packaging ninja cmake pybind11 scikit-build cython hf_transfer "numpy>=1.24.4"
|
| 74 |
|
| 75 |
+
# Triton 3.x (no triton.ops)
|
| 76 |
RUN pip uninstall -y triton || true && \
|
| 77 |
pip install -v --no-build-isolation triton==3.4.0
|
| 78 |
|
|
|
|
| 82 |
pip install flash-attn==2.8.1 --no-build-isolation || \
|
| 83 |
pip install flash-attn==2.8.0.post2 --no-build-isolation
|
| 84 |
|
| 85 |
+
# ---------------- App dependencies ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
COPY requirements.txt ./requirements.txt
|
| 87 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 88 |
|
| 89 |
+
# Pin bnb to avoid surprise CUDA/PTX mismatches (adjust as needed)
|
| 90 |
+
RUN pip install --upgrade "bitsandbytes==0.44.1" || pip install --upgrade "bitsandbytes==0.43.3"
|
| 91 |
|
| 92 |
+
# Custom .whl (Apex + dropout_layer_norm)
|
| 93 |
+
RUN echo "Installing custom wheels..." && \
|
| 94 |
pip install --no-cache-dir \
|
| 95 |
+
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/apex-0.1-cp310-cp310-linux_x86_64.whl" \
|
| 96 |
+
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/dropout_layer_norm-0.1-cp310-cp310-linux_x86_64.whl"
|
|
|
|
|
|
|
| 97 |
|
| 98 |
# ====================================================================
|
| 99 |
+
# Optional: q8_kernels + LTX-Video (enable if needed; ensure wheel ABI)
|
| 100 |
+
RUN pip install --no-cache-dir \
|
| 101 |
+
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/q8_kernels-0.0.5-cp310-cp310-linux_x86_64.whl"
|
| 102 |
+
# RUN git clone https://github.com/Lightricks/LTX-Video.git /data/LTX-Video && \
|
| 103 |
+
# cd /data/LTX-Video && python -m pip install -e .[inference]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
# ====================================================================
|
| 105 |
|
| 106 |
+
# Scripts and app
|
| 107 |
COPY info.sh ./app/info.sh
|
| 108 |
COPY builder.sh ./app/builder.sh
|
| 109 |
COPY start.sh ./app/start.sh
|
| 110 |
COPY entrypoint.sh ./app/entrypoint.sh
|
| 111 |
|
| 112 |
+
# Copy the rest of the source last for better caching
|
| 113 |
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
# Permissions on app tree
|
| 116 |
+
RUN chown -R appuser:appuser /app /data && \
|
| 117 |
+
chmod 0755 /app/entrypoint.sh /app/start.sh /app/info.sh /app/builder.sh
|
| 118 |
|
|
|
|
| 119 |
VOLUME /data
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
|
| 122 |
USER appuser
|
| 123 |
|
| 124 |
# ---------------- Entry ----------------
|
| 125 |
+
CMD ["/app/start.sh"]
|
|
|