Paddle ocr gpu support. #4

Merged
Seryusjj merged 40 commits from gpu_support into main 2026-01-19 17:35:25 +00:00
2 changed files with 6 additions and 18 deletions
Showing only changes of commit 58bf94bc41 - Show all commits

View File

@@ -34,15 +34,9 @@ ARG REC_MODEL=PP-OCRv5_server_rec
ENV PADDLE_DET_MODEL=${DET_MODEL} ENV PADDLE_DET_MODEL=${DET_MODEL}
ENV PADDLE_REC_MODEL=${REC_MODEL} ENV PADDLE_REC_MODEL=${REC_MODEL}
# Download models during build (not at runtime) # Note: Models download at first runtime
RUN python -c "\ # First container start will take ~30s longer as models are fetched
import os; \ # Use paddlex-cache volume to persist models across container restarts
from paddleocr import PaddleOCR; \
det = os.environ.get('PADDLE_DET_MODEL', 'PP-OCRv5_server_det'); \
rec = os.environ.get('PADDLE_REC_MODEL', 'PP-OCRv5_server_rec'); \
print(f'Downloading models: det={det}, rec={rec}'); \
ocr = PaddleOCR(text_detection_model_name=det, text_recognition_model_name=rec); \
print('Models downloaded successfully!')"
# Volume for dataset and optional additional model cache # Volume for dataset and optional additional model cache
VOLUME ["/app/dataset", "/root/.paddlex"] VOLUME ["/app/dataset", "/root/.paddlex"]

View File

@@ -77,15 +77,9 @@ ARG REC_MODEL=PP-OCRv5_server_rec
ENV PADDLE_DET_MODEL=${DET_MODEL} ENV PADDLE_DET_MODEL=${DET_MODEL}
ENV PADDLE_REC_MODEL=${REC_MODEL} ENV PADDLE_REC_MODEL=${REC_MODEL}
# Download models during build (not at runtime) # Note: Models download at first runtime (CI runner has no GPU for build-time download)
RUN python -c "\ # First container start will take ~30s longer as models are fetched
import os; \ # Use paddlex-cache volume to persist models across container restarts
from paddleocr import PaddleOCR; \
det = os.environ.get('PADDLE_DET_MODEL', 'PP-OCRv5_server_det'); \
rec = os.environ.get('PADDLE_REC_MODEL', 'PP-OCRv5_server_rec'); \
print(f'Downloading models: det={det}, rec={rec}'); \
ocr = PaddleOCR(text_detection_model_name=det, text_recognition_model_name=rec); \
print('Models downloaded successfully!')"
# Volume for dataset and optional additional model cache # Volume for dataset and optional additional model cache
VOLUME ["/app/dataset", "/root/.paddlex"] VOLUME ["/app/dataset", "/root/.paddlex"]