feat(paddleocr-vl): add PaddleOCR-VL GPU Dockerfile, pin vllm, update CPU image deps, and improve entrypoint and tests
This commit is contained in:
71
Dockerfile_paddleocr_vl_gpu
Normal file
71
Dockerfile_paddleocr_vl_gpu
Normal file
@@ -0,0 +1,71 @@
|
||||
# PaddleOCR-VL GPU Variant (Transformers-based, not vLLM)
|
||||
# Vision-Language Model for document parsing using transformers with CUDA
|
||||
FROM nvidia/cuda:12.4.0-runtime-ubuntu22.04
|
||||
|
||||
LABEL maintainer="Task Venture Capital GmbH <hello@task.vc>"
|
||||
LABEL description="PaddleOCR-VL 0.9B GPU - Vision-Language Model using transformers"
|
||||
LABEL org.opencontainers.image.source="https://code.foss.global/host.today/ht-docker-ai"
|
||||
|
||||
# Environment configuration
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV HF_HOME=/root/.cache/huggingface
|
||||
ENV SERVER_PORT=8000
|
||||
ENV SERVER_HOST=0.0.0.0
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3.11 \
|
||||
python3.11-venv \
|
||||
python3.11-dev \
|
||||
python3-pip \
|
||||
libgl1-mesa-glx \
|
||||
libglib2.0-0 \
|
||||
libgomp1 \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 \
|
||||
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
||||
|
||||
# Create and activate virtual environment
|
||||
RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
# Install PyTorch with CUDA support
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir \
|
||||
torch==2.5.1 \
|
||||
torchvision \
|
||||
--index-url https://download.pytorch.org/whl/cu124
|
||||
|
||||
# Install Python dependencies (transformers-based, not vLLM)
|
||||
RUN pip install --no-cache-dir \
|
||||
transformers \
|
||||
accelerate \
|
||||
safetensors \
|
||||
pillow \
|
||||
fastapi \
|
||||
uvicorn[standard] \
|
||||
python-multipart \
|
||||
httpx \
|
||||
protobuf \
|
||||
sentencepiece \
|
||||
einops
|
||||
|
||||
# Copy server files (same as CPU variant - it auto-detects CUDA)
|
||||
COPY image_support_files/paddleocr_vl_server.py /app/paddleocr_vl_server.py
|
||||
COPY image_support_files/paddleocr-vl-cpu-entrypoint.sh /usr/local/bin/paddleocr-vl-entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/paddleocr-vl-entrypoint.sh
|
||||
|
||||
# Expose API port
|
||||
EXPOSE 8000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/paddleocr-vl-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user