Spaces:
Paused
Paused
File size: 5,902 Bytes
5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c bffb26a e15b45c 5f7901d e15b45c 5f7901d bffb26a 5f7901d e15b45c 5f7901d e15b45c 5f7901d 03c32c6 5f7901d e15b45c bffb26a 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 03c32c6 5f7901d e15b45c bffb26a 5f7901d b31d58c e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c 5f7901d e15b45c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# =============================================================================
# ADUC-SDR Video Suite — Dockerfile Otimizado
# Preserva a estrutura de instalação original para alta performance.
# CUDA 12.8 | PyTorch 2.8.0+cu128 | Ubuntu 22.04
# =============================================================================
FROM nvidia/cuda:12.8.0-devel-ubuntu22.04
LABEL maintainer="Carlos Rodrigues dos Santos"
LABEL description="ADUC-SDR: High-performance Diffusers stack for 8x NVIDIA L40S with LTX-Video and SeedVR"
LABEL version="5.0.0"
LABEL cuda_version="12.8.0"
LABEL python_version="3.10"
LABEL pytorch_version="2.8.0+cu128"
LABEL gpu_optimized_for="8x_NVIDIA_L40S"
# =============================================================================
# 1. Variáveis de Ambiente e Configuração de Paths
# =============================================================================
ENV DEBIAN_FRONTEND=noninteractive TZ=UTC LANG=C.UTF-8 LC_ALL=C.UTF-8 \
PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=0 PIP_DISABLE_PIP_VERSION_CHECK=1
# --- Configurações de GPU e Computação ---
ENV NVIDIA_VISIBLE_DEVICES=all \
TORCH_CUDA_ARCH_LIST="8.9" \
CUDA_DEVICE_ORDER=PCI_BUS_ID \
CUDA_DEVICE_MAX_CONNECTIONS=32
# --- Configurações de Threads ---
ENV OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 MAX_JOBS=160
# --- Configurações de Alocador de Memória e Caches de GPU ---
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8 \
CUDA_LAUNCH_BLOCKING=0 CUDA_CACHE_MAXSIZE=2147483648 CUDA_CACHE_DISABLE=0
# --- Paths da Aplicação e Dados Persistentes ---
ENV APP_HOME=/app \
HF_HOME=/data/.cache/huggingface \
TORCH_HOME=/data/.cache/torch \
HF_DATASETS_CACHE=/data/.cache/datasets \
TRANSFORMERS_CACHE=/data/.cache/transformers \
DIFFUSERS_CACHE=/data/.cache/diffusers \
HF_HUB_ENABLE_HF_TRANSFER=1 \
TOKENIZERS_PARALLELISM=false
WORKDIR $APP_HOME
# =============================================================================
# 2. Setup de Usuário e Sistema
# =============================================================================
# Cria usuário não-root e diretórios de dados/app.
# As permissões finais serão aplicadas no final.
RUN useradd -m -u 1000 -s /bin/bash appuser && \
mkdir -p /data $APP_HOME /app/output
# --- Instalação de Pacotes de Sistema e Python ---
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gosu tree cmake git git-lfs curl wget ffmpeg ninja-build \
python3.10 python3.10-dev python3.10-distutils python3-pip \
ca-certificates libglib2.0-0 libgl1 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \
python3 -m pip install --upgrade pip
# =============================================================================
# 3. Instalação da Toolchain de Machine Learning (Mantida 100% Original)
# =============================================================================
# --- PyTorch para CUDA 12.8 ---
RUN pip install --index-url https://download.pytorch.org/whl/cu128 \
torch>=2.8.0+cu128 torchvision>=0.23.0+cu128 torchaudio>=2.8.0+cu128
# --- Ferramentas de Compilação, Triton e FlashAttention ---
RUN pip install packaging ninja cmake pybind11 scikit-build cython hf_transfer "numpy>=1.24.4"
# --- Triton 3.x ---
RUN pip uninstall -y triton || true && \
pip install -v --no-build-isolation triton==3.4.0
# --- FlashAttention 2.8.x ---
RUN pip install flash-attn==2.8.3 --no-build-isolation || \
pip install flash-attn==2.8.2 --no-build-isolation || \
pip install flash-attn==2.8.1 --no-build-isolation || \
pip install flash-attn==2.8.0.post2 --no-build-isolation
# =============================================================================
# 4. Instalação das Dependências da Aplicação
# =============================================================================
# Copia e instala requirements.txt primeiro para otimizar o cache de camadas do Docker.
COPY --chown=appuser:appuser requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# --- Instalação de bitsandbytes e Wheels Customizados (Mantido 100% Original) ---
RUN pip install --upgrade bitsandbytes
# Instala wheels customizados (Apex, etc.)
# Instala q8_kernels
RUN pip install --no-cache-dir \
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/q8_kernels-0.0.5-cp310-cp310-linux_x86_64.whl"
RUN echo "Installing custom wheels..." && \
pip install --no-cache-dir \
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/apex-0.1-cp310-cp310-linux_x86_64.whl" \
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/dropout_layer_norm-0.1-cp310-cp310-linux_x86_64.whl"
# =============================================================================
# 5. Cópia do Código-Fonte e Configuração Final
# =============================================================================
# Copia o restante do código-fonte da aplicação por último.
COPY --chown=appuser:appuser . .
# Garante que todos os scripts de inicialização sejam executáveis
# e que o usuário 'appuser' seja o dono de todos os arquivos.
RUN chown -R appuser:appuser $APP_HOME /data && \
chmod +x /app/entrypoint.sh /app/start.sh /app/info.sh /app/builder.sh
# =============================================================================
# 6. Ponto de Entrada
# =============================================================================
# Expõe o diretório /data para ser montado como um volume persistente.
VOLUME /data
# Define o usuário padrão para a execução do contêiner.
USER appuser
# Define o script que será executado na inicialização do contêiner.
ENTRYPOINT ["/app/entrypoint.sh"]
# Define o comando padrão a ser executado pelo entrypoint.
CMD ["/app/start.sh"] |