Skip to content

Introduce Docker CPU support and improve translation process - #14

Open
kevinliddel wants to merge 7 commits into
discus0434:mainfrom
kevinliddel:feat/cpu-support
Open

Introduce Docker CPU support and improve translation process#14
kevinliddel wants to merge 7 commits into
discus0434:mainfrom
kevinliddel:feat/cpu-support

Conversation

@kevinliddel

Copy link
Copy Markdown

This pull request introduces experimental support for running the PDF Translator on Mac and CPU-only environments, in addition to improving the flexibility and robustness of the installation and execution process. The changes include new Docker and local installation options, a CPU-compatible Dockerfile, Makefile enhancements, and code updates to support device and backend selection at runtime.

Key changes:

1. Experimental Mac/CPU Support & Installation Instructions

  • Updated README.md to document three installation modes: Docker with NVIDIA GPU, Docker with CPU (Mac/CPU-only), and local (Mac Intel/Apple Silicon/CPU), including step-by-step instructions for each. The requirements and TODOs sections were also updated to reflect the new support. [1] [2] [3] [4]

2. CPU Docker Support

  • Added docker/Dockerfile.cpu to build a CPU-only Docker image with all necessary dependencies for running on non-GPU hosts.
  • Updated docker/Makefile with commands to build, run, stop, and clean up both GPU and CPU containers, as well as to support local execution and logs for both modes.
  • Added docker/start-cpu.sh to initialize the CPU container, copy model files, and launch both the API and GUI.
  • Added requirements-cpu.txt for local CPU-based installation.

3. Device and Layout Backend Selection

  • Refactored server/main.py to allow dynamic selection of device (cuda, mps, cpu, or auto) and layout backend (detectron2, none, or auto) via environment variables. Added logic to fall back to CPU or a full-page layout analyzer if the requested backend is unavailable. [1] [2] [3] [4] [5] [6] [7] [8] [9]

4. CLI and GUI Improvements

  • Updated gui.py to improve error handling, add file upload validation, and ensure compatibility with local and containerized modes. [1] [2] [3]

5. Proof of Concept

Those changes have been tested on a MacBook 2019 Pro to verify the work:
Screenshot 2026-05-21 at 09 43 18

It successfully ran the translation:
Screenshot 2026-05-21 at 09 42 52

Screenshot 2026-05-21 at 09 44 29 ---

These changes make the PDF Translator more accessible to users without NVIDIA GPUs, improve installation clarity, and enhance robustness across platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant