Spaces:
Paused
Paused
fix: compilar llama-cpp con CUDA limitando paralelismo (evita OOM)
Browse files- Dockerfile +13 -11
Dockerfile
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
-
# Imagen base CUDA 12.1 *
|
| 2 |
-
#
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04
|
| 6 |
|
| 7 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 8 |
|
| 9 |
-
# Python + Stockfish + libs de OpenCV
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
-
python3 python3-pip \
|
| 12 |
stockfish \
|
| 13 |
libgl1 libglib2.0-0 \
|
|
|
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
WORKDIR /app
|
|
@@ -26,10 +26,12 @@ RUN pip3 install --no-cache-dir --upgrade pip \
|
|
| 26 |
RUN pip3 install --no-cache-dir torch torchvision \
|
| 27 |
--index-url https://download.pytorch.org/whl/cu121
|
| 28 |
|
| 29 |
-
# llama-cpp-python
|
| 30 |
-
#
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Resto de dependencias de la app
|
| 35 |
RUN pip3 install --no-cache-dir -r requirements.txt
|
|
|
|
| 1 |
+
# Imagen base CUDA 12.1 *devel*: trae nvcc + compilador para construir
|
| 2 |
+
# llama-cpp-python CON soporte GPU (no existe wheel precompilado cu121 para
|
| 3 |
+
# Python 3.10, así que hay que compilar desde fuente).
|
| 4 |
+
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
|
|
|
| 5 |
|
| 6 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 7 |
|
| 8 |
+
# Python + Stockfish + libs de OpenCV + toolchain de compilación
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
python3 python3-pip python3-dev \
|
| 11 |
stockfish \
|
| 12 |
libgl1 libglib2.0-0 \
|
| 13 |
+
build-essential cmake git \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
WORKDIR /app
|
|
|
|
| 26 |
RUN pip3 install --no-cache-dir torch torchvision \
|
| 27 |
--index-url https://download.pytorch.org/whl/cu121
|
| 28 |
|
| 29 |
+
# llama-cpp-python COMPILADO desde fuente con CUDA (arch 75 = Tesla T4).
|
| 30 |
+
# CMAKE_BUILD_PARALLEL_LEVEL=2 limita los nvcc en paralelo para NO agotar la RAM
|
| 31 |
+
# del builder de HF (con el paralelismo por defecto el build moría por OOM).
|
| 32 |
+
RUN CMAKE_ARGS="-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES=75" \
|
| 33 |
+
CMAKE_BUILD_PARALLEL_LEVEL=2 FORCE_CMAKE=1 \
|
| 34 |
+
pip3 install --no-cache-dir llama-cpp-python==0.3.2
|
| 35 |
|
| 36 |
# Resto de dependencias de la app
|
| 37 |
RUN pip3 install --no-cache-dir -r requirements.txt
|