carlex3321 commited on
Commit
010a7cc
·
verified ·
1 Parent(s): dc205a6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +78 -16
Dockerfile CHANGED
@@ -1,12 +1,55 @@
1
- # Base image otimizada para NVIDIA L40S com CUDA 12.2 (compatível com HF Spaces e multi-GPU)
2
- FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04
 
 
 
3
 
4
- # Labels para Hugging Face Spaces
5
- LABEL maintainer="Seu Nome <[email protected]>"
6
- LABEL description="VINCIE Service com persistência e multi-GPU"
 
 
 
 
7
 
8
- # Argumentos de build (ajuste se necessário)
9
- ARG DEBIAN_FRONTEND=noninteractive
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  # Diretórios persistentes (usados em HF Spaces)
12
  ENV REPOS_DIR=/data/repos
@@ -14,18 +57,42 @@ ENV MODELS_DIR=/data/models
14
 
15
  # ---------------- Sistema & Python ----------------
16
  RUN apt-get update && apt-get install -y --no-install-recommends \
17
- python3.10 python3-pip python3-dev git wget curl build-essential libgl1-mesa-glx libglib2.0-0 \
 
18
  && apt-get clean && rm -rf /var/lib/apt/lists/*
19
 
20
- # Atualiza pip e instala wheel para pacotes
21
- RUN pip3 install --upgrade pip wheel setuptools
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  # Cria usuário não-root para segurança (HF recomenda)
24
  RUN useradd -m appuser && mkdir -p /app
25
  WORKDIR /app
26
  USER appuser
27
 
28
- # ---------------- Dependências da aplicação ----------------
29
 
30
  # Copia arquivos necessários
31
  COPY . .
@@ -33,11 +100,6 @@ COPY . .
33
  COPY requirements.txt ./requirements.txt
34
  RUN pip install --no-cache-dir -r requirements.txt
35
 
36
- # Instala dependências do requirements.txt
37
- #RUN pip3 install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu122/ \
38
- # && pip3 install --no-cache-dir huggingface-hub transformers gradio # Adicione se não estiver em requirements.txt
39
-
40
-
41
  # Permissões para scripts
42
  RUN chmod +x /app/start.sh /app/builder.sh /app/info.sh
43
 
 
1
+ # =============================================================================
2
+ # ADUC-SDR Video Suite — High-Perf Diffusers for 8× L40S (SM 8.9)
3
+ # CUDA 12.8 | PyTorch 2.8.0+cu128 | Ubuntu 22.04
4
+ # =============================================================================
5
+ FROM nvidia/cuda:12.8.0-devel-ubuntu22.04
6
 
7
+ LABEL maintainer="Carlos Rodrigues dos Santos & Development Partner"
8
+ LABEL description="High-performance Diffusers stack with FA2/SDPA, 8×L40S"
9
+ LABEL version="4.4.0"
10
+ LABEL cuda_version="12.8.0"
11
+ LABEL python_version="3.10"
12
+ LABEL pytorch_version="2.8.0+cu128"
13
+ LABEL gpu_optimized_for="8x_NVIDIA_L40S"
14
 
15
+ # ---------------- Core env & caches ----------------
16
+ ENV DEBIAN_FRONTEND=noninteractive TZ=UTC LANG=C.UTF-8 LC_ALL=C.UTF-8 \
17
+ PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 \
18
+ PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
19
+
20
+ # GPU/Compute
21
+ ENV NVIDIA_VISIBLE_DEVICES=all
22
+ ENV CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
23
+ ENV TORCH_CUDA_ARCH_LIST="8.9"
24
+ ENV CUDA_DEVICE_ORDER=PCI_BUS_ID
25
+ ENV CUDA_DEVICE_MAX_CONNECTIONS=32
26
+ ENV CUDA_MODULE_LOADING=LAZY
27
+
28
+ # Threads
29
+ ENV OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 MAX_JOBS=48
30
+
31
+ # Alloc/caches
32
+ ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8
33
+ ENV CUDA_LAUNCH_BLOCKING=0 CUDA_CACHE_MAXSIZE=2147483648 CUDA_CACHE_DISABLE=0
34
+
35
+ # NCCL single-node sane defaults (use IB=1/IFNAME em clusters com IB)
36
+ ENV NCCL_DEBUG=INFO NCCL_ASYNC_ERROR_HANDLING=1 NCCL_P2P_DISABLE=0 NCCL_IB_DISABLE=1 \
37
+ NCCL_MIN_NCHANNELS=8 NCCL_NTHREADS=256 NCCL_SOCKET_IFNAME=lo
38
+
39
+ ENV HF_HUB_ENABLE_HF_TRANSFER=1
40
+ ENV TOKENIZERS_PARALLELISM=false
41
+
42
+ # FlashAttention / SDPA defaults
43
+ ENV FLASH_ATTENTION_DISABLE=0 \
44
+ FLASH_ATTENTION_FORCE_FP16=1 \
45
+ ATTN_FORCE_F16=1 \
46
+ ENABLE_FLASH_SDP=1 \
47
+ ENABLE_MEMORY_EFFICIENT_SDP=1 \
48
+ ENABLE_MATH_SDP=0 \
49
+ XFORMERS_FORCE_DISABLE=1 \
50
+ TORCH_DTYPE=bfloat16 \
51
+ NVIDIA_TF32_OVERRIDE=0 \
52
+ FA_LOG_LEVEL=WARNING
53
 
54
  # Diretórios persistentes (usados em HF Spaces)
55
  ENV REPOS_DIR=/data/repos
 
57
 
58
  # ---------------- Sistema & Python ----------------
59
  RUN apt-get update && apt-get install -y --no-install-recommends \
60
+ build-essential cmake git git-lfs curl wget ffmpeg ninja-build \
61
+ python3.10 python3.10-dev python3.10-distutils python3-pip \
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 (pinado) ----------------
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 (sem bnb) ----------------
73
+ RUN pip install packaging ninja cmake pybind11 scikit-build cython hf_transfer numpy==1.24.4
74
+
75
+ # Triton 3.x (sem triton.ops)
76
+ RUN pip uninstall -y triton || true && \
77
+ pip install -v --no-build-isolation triton==3.4.0
78
+
79
+ # FlashAttention 2.8.x
80
+ RUN pip install flash-attn==2.8.3 --no-build-isolation || \
81
+ pip install flash-attn==2.8.2 --no-build-isolation || \
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
+ # Diffusers/Transformers estáveis (sem dev)
86
+ RUN pip install --no-cache-dir diffusers==0.31.0 transformers==4.44.2 accelerate==0.34.2 omegaconf==2.3.0
87
+
88
+ # Opcional: seu fork de otimizações
89
+ RUN pip install -U git+https://github.com/carlex22/diffusers-aduc-sdr
90
 
91
  # Cria usuário não-root para segurança (HF recomenda)
92
  RUN useradd -m appuser && mkdir -p /app
93
  WORKDIR /app
94
  USER appuser
95
 
 
96
 
97
  # Copia arquivos necessários
98
  COPY . .
 
100
  COPY requirements.txt ./requirements.txt
101
  RUN pip install --no-cache-dir -r requirements.txt
102
 
 
 
 
 
 
103
  # Permissões para scripts
104
  RUN chmod +x /app/start.sh /app/builder.sh /app/info.sh
105