no model download on imaeg build
All checks were successful
All checks were successful
This commit is contained in:
@@ -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"]
|
||||||
|
|||||||
@@ -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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user