fix(ocr): align torch/transformers with native venv (0.17.1 호환 확인된 조합)

이전 base image (pytorch/pytorch:2.5.1-cuda12.4) 가 surya-ocr 0.17.1 설치 시
torch 2.11.0 (PyPI CPU wheel) 로 업그레이드되지만 torchvision 0.20.1+cu124 는
유지돼 ABI 불일치 (torchvision::nms does not exist) → OCR 전체 실패.

native /opt/surya-ocr/venv 에서 검증된 조합으로 복제:
- python:3.12-slim base
- torch 2.11.0+cu126 / torchvision 0.26.0+cu126 (PyTorch cu126 index 고정)
- transformers 4.57.6 (5.x 는 surya detection.processor import 에서 실패)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-04-23 13:59:15 +09:00
parent f8f72ceae2
commit e861784c86
2 changed files with 10 additions and 3 deletions
+7 -3
View File
@@ -1,14 +1,18 @@
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime
FROM python:3.12-slim
WORKDIR /app
# PyMuPDF/Pillow 시스템 의존성
# PyMuPDF/Pillow 시스템 의존성 + CUDA wheel 의 런타임 로더
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 && \
apt-get clean && rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# torch / torchvision 는 PyTorch 인덱스의 cu126 wheel 고정.
# native /opt/surya-ocr/venv 검증된 조합 (torch 2.11.0+cu126, transformers 4.57.x).
RUN pip install --no-cache-dir \
--extra-index-url https://download.pytorch.org/whl/cu126 \
-r requirements.txt
COPY server.py .
+3
View File
@@ -1,3 +1,6 @@
torch==2.11.0+cu126
torchvision==0.26.0+cu126
transformers==4.57.6
surya-ocr==0.17.1
pymupdf>=1.24.0,<2.0.0
fastapi>=0.110.0,<1.0.0