Heart / Dockerfile
nexusbert's picture
Fix Triton permission error by setting TRITON_CACHE_DIR
c3287d5
Raw History Blame Contribute Delete
1.22 kB
FROM python:3.11-slim
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
libopenblas-dev \
libomp-dev \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Fix for TabFM: Install from source to avoid PyPI weights compatibility issues
RUN git clone https://github.com/google-research/tabfm.git /tmp/tabfm && \
cd /tmp/tabfm && \
pip install .[pytorch] && \
rm -rf /tmp/tabfm
RUN pip install --no-cache-dir huggingface-hub sentencepiece accelerate fasttext
ENV HF_HOME=/models/huggingface \
TRANSFORMERS_CACHE=/models/huggingface \
HUGGINGFACE_HUB_CACHE=/models/huggingface \
HF_HUB_CACHE=/models/huggingface \
TRITON_CACHE_DIR=/tmp/.triton
RUN mkdir -p /models/huggingface && chmod -R 777 /models/huggingface
COPY . .
RUN python download_models.py
EXPOSE 7860
ENV OMP_NUM_THREADS=4 \
MKL_NUM_THREADS=4 \
NUMEXPR_NUM_THREADS=4
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "30"]