feat: refactor code and finetune OOM fix

This commit is contained in:
zin
2026-06-03 09:34:34 +00:00
parent e3a2eb3289
commit 8648e52106
8 changed files with 26 additions and 52 deletions
-5
View File
@@ -3,22 +3,17 @@ FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-runtime
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 1. Системные зависимости
RUN apt-get update && apt-get install -y \
libglib2.0-0 libsm6 libxext6 libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# 2. Python пакеты
RUN pip install --no-cache-dir fastapi uvicorn timm scikit-learn pandas joblib python-multipart transformers==4.38.2 tokenizers==0.15.2 accelerate
# 3. Копируем код в контейнер
WORKDIR /app
COPY src/ /app/src/
# 4. МАГИЯ ЗДЕСЬ: Переходим внутрь папки src
WORKDIR /app/src
EXPOSE 8000
# 5. Запускаем локально (без префикса src.)
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
-2
View File
@@ -8,10 +8,8 @@ RUN pip install --no-cache-dir streamlit==1.32.0 requests pandas pillow
COPY src/ /app/src/
# МАГИЯ ЗДЕСЬ: Переходим внутрь папки src
WORKDIR /app/src
EXPOSE 8080
# Запускаем локально
CMD ["streamlit", "run", "main.py", "--server.port", "8080", "--server.address", "0.0.0.0"]