Spaces:
Paused

File size: 1,221 Bytes
debbbda
929ecd5
 
 
e8b5114
929ecd5
 
 
 
 
 
 
 
 
 
 
 
 
 
4c2f072
 
 
 
 
 
e8b5114
929ecd5
 
e8b5114
929ecd5
c3287d5
 
929ecd5
 
 
 
b076c1a
929ecd5
 
 
e8b5114
 
 
929ecd5
e8b5114
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
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"]