Feature Request: Add PaddleOCR GPU support to Docker image
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- docker, python
- Área
- devops, infrastructure, machine-learning
Línea de trabajo
Comienza revisando el Dockerfile existente y la configuración de publicación de imágenes; después, lee unstructured/partition/utils/ocr_models/paddle_ocr.py y OCR_AGENT_BUG_ISSUE.md. Determina si las etiquetas de imagen GPU o los argumentos de compilación están dentro del alcance, y verifica que la imagen seleccionada se compile con las dependencias de PaddleOCR requeridas y admita la ejecución en GPU.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Feature Request: Add PaddleOCR GPU support to unstructured-api Docker image
Summary
The official unstructured-api Docker image includes Tesseract but not PaddleOCR. Users who want to use PaddleOCR with GPU acceleration must build a custom image. It would be valuable to have an official GPU-enabled image with PaddleOCR pre-installed.
Current Behavior
- The
unstructured-api:latestimage only includes Tesseract OCR - PaddleOCR must be manually installed via
pip install paddlepaddle unstructured-paddleocr - There is no GPU-enabled variant of the image
- The
OCR_AGENTenvironment variable is ignored (see related issue: OCR_AGENT_BUG_ISSUE.md)
Proposed Solution
Option 1: Provide GPU-enabled image tags
Publish additional Docker image variants:
unstructured-api:latest-gpu-cu118 # CUDA 11.8
unstructured-api:latest-gpu-cu126 # CUDA 12.6
These images would include:
paddlepaddle-gpufrom the appropriate CUDA indexunstructured-paddleocr- NVIDIA CUDA runtime
Option 2: Add build args to existing Dockerfile
Add build arguments to allow users to build GPU-enabled images:
ARG USE_GPU=false
ARG CUDA_VERSION=cu118
RUN if [ "$USE_GPU" = "true" ]; then \
pip install --no-cache-dir \
paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/stable/${CUDA_VERSION}/ \
unstructured-paddleocr; \
fi
Implementation Details
The unstructured library already supports GPU acceleration for PaddleOCR. In unstructured/partition/utils/ocr_models/paddle_ocr.py:
gpu_available = paddle.device.cuda.device_count() > 0
if gpu_available:
logger.info(f"Loading paddle with GPU on language={language}...")
paddle_ocr = PaddleOCR(
use_angle_cls=True,
use_gpu=gpu_available, # Auto-detects GPU
lang=language,
enable_mkldnn=True,
show_log=False,
)
This means the library automatically uses GPU when available - the only requirement is installing paddlepaddle-gpu instead of paddlepaddle.
Workaround
Users can extend the official image:
FROM downloads.unstructured.io/unstructured-io/unstructured-api:latest
USER root
ARG USE_GPU=false
RUN if [ "$USE_GPU" = "true" ]; then \
pip install --no-cache-dir \
paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/stable/cu118/ \
unstructured-paddleocr; \
else \
pip install --no-cache-dir \
paddlepaddle \
unstructured-paddleocr; \
fi
USER notebook-user
ENV OCR_AGENT=unstructured.partition.utils.ocr_models.paddle_ocr.OCRAgentPaddle
Note: This also requires patching general.py to pass ocr_agent to partition() - see OCR_AGENT_BUG_ISSUE.md.
Benefits
- Performance: PaddleOCR with GPU is significantly faster than Tesseract for batch processing
- Accuracy: PaddleOCR (especially PP-OCRv4) provides better accuracy on many document types
- Ease of use: Official GPU images eliminate the need for custom Dockerfiles
Environment
- unstructured-api: latest
- unstructured: 0.18.18+
- PaddlePaddle: 3.2.2
- CUDA: 11.8 / 12.6
Related Issues
- OCR_AGENT environment variable is ignored (see OCR_AGENT_BUG_ISSUE.md)
References
- Lenguaje dominante
- Python
- Estrellas
- 953
- Forks
- 192
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Unstructured-IO/unstructured-api
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 39/100
-
Dependency DashboardAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 15/100
Todos los issues de Unstructured-IO/unstructured-api
Issues similares
-
wr.dynamodb.read_items returns [{}] for a single partition value that does not existPosiblemente ocupada @auraseb la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
aws/aws-sdk-pandas#3520 ·
Los mantenedores suelen responder en 2 días
-
requires triage typing
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sqlalchemy/sqlalchemy#13704 ·
Los mantenedores suelen responder en 1 día
-
Edit tool converts CRLF files to LFPosiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
huggingface/tau#774 ·
Los mantenedores suelen responder en 1 día
-
show ignores the row limit when a column or table name contains "limit"Posiblemente ocupada @RaphaelFakhri la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
What happened to `check.py`?Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
linebender/resvg#1179 · 1 comentario ·
Los mantenedores suelen responder en 2 días