Ubuntu 24.04 ships Python 3.12 by default.
python3.10-venv/dev/distutils are not in standard repos.
Must add ppa:deadsnakes/ppa in both builder and runtime stages.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
COPY does not support shell operators (||, 2>/dev/null).
Keep wheels/ for paddlepaddle whl installation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove VOLUME directive that was creating anonymous volumes
- Keep directory creation (mkdir) for runtime mount points
- Users must explicitly mount volumes with -v flags
- This prevents hidden volume bloat in docker exec
Usage:
docker run --gpus all -p 8053:8053 \
-v /home/yoge/.cache/modelscope:/root/.cache/modelscope:ro \
-v /home/yoge/.cache/huggingface:/root/.cache/huggingface:ro \
-v /home/yoge/.paddlex:/root/.paddlex:ro \
doc_processer:latest
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Use multi-stage build to exclude build dependencies from final image
- Separate builder stage using devel image from runtime stage using smaller base image
- Clean venv: remove __pycache__, .pyc files, and test directories
- Remove embedded model files (243MB) from app/model/ - mount at runtime instead
- Expected size reduction: 18.9GB → 2-3GB (80-90% reduction)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Three targeted fixes for layout processing issues:
1. formula_number type mapping (layout_detector.py)
- Changed formula_number region type from "formula" to "text"
- Ensures Text Recognition prompt, preventing $$-wrapped output
- Prevents malformed \tag{$$...\n$$} in merged formulas
2. Reading order (ocr_service.py)
- Sort layout regions by (y1, x1) after detection
- Ensures top-to-bottom, left-to-right processing order
- Fixes paragraph ordering issues in output
3. Formula number cleaning (glm_postprocess.py)
- clean_formula_number() now strips $$, $, \[...\] delimiters
- Handles edge case where vLLM still returns math-mode wrapped content
- Prevents delimiter leakage into \tag{} placeholders
Also adds logging:
- Warning when empty formula content is skipped
- Warning when region crop is too small (< 10×10 px)
- Warning when vLLM parallel call fails
- Warning when format conversion fails
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>