Dosu LogoDosu Logo
Ask
Join our Discord
ragflowPublic
InfiniFlow
Documentsragflow
DeepDoc Model Distribution
DeepDoc Model Distribution
Type
Topic
Status
Published
Created
Jul 30, 2026
Updated
Jul 30, 2026

DeepDoc Model Distribution#

DeepDoc's ONNX models and native dependency artifacts are pre-packaged into a dedicated ragflow_deps Docker image and downloaded at build time — not fetched lazily at runtime. Two separate download scripts serve two different distribution paths: one for baking artifacts into the full deps image, and one for the lightweight standalone DeepDoc OSS container. In embedded mode, the Recognizer base class will fall back to auto-downloading missing models from HuggingFace Hub at runtime.


Artifacts and Their Sources#

ArtifactSourceDestination
InfiniFlow/deepdoc ONNX models (layout.onnx, det.onnx, rec.onnx, tsr.onnx, ocr.res)HuggingFace Hubrag/res/deepdoc/
InfiniFlow/text_concat_xgb_v1.0 modelsHuggingFace Hubragflow_deps/huggingface.co/
Apache Tika JAR (tika-server-standard-3.3.0.jar)Maven Central / Huawei Cloud mirrorragflow_deps/
NLTK data (wordnet, punkt, punkt_tab)NLTK downloadragflow_deps/nltk_data/
libssl1.1 .deb packages (amd64 + arm64)Ubuntu archive / Tsinghua mirrorragflow_deps/
Chrome for Testing + ChromeDriver 121Google Storage / npmmirrorragflow_deps/
uv toolchain (x86_64 + aarch64)GitHub Releasesragflow_deps/
Stagehand server binaries (x64 + arm64)GitHub Releasesragflow_deps/
Native Go libs: pdfium, pdf_oxide, office_oxideGitHub Releases~/ragflow-native-libs/
tiktoken cl100k_base.tiktokenOpenAI public blobragflow_deps/

Two Download Scripts#

ragflow_deps/download_deps.py — Full Deps Image#

ragflow_deps/download_deps.py downloads every artifact that the infiniflow/ragflow_deps Docker image bakes in. It must be run before building that image :

uv run ragflow_deps/download_deps.py [--china-mirrors]
cd ragflow_deps && docker build -f Dockerfile -t infiniflow/ragflow_deps .

The script anchors its CWD to its own directory so all outputs land under ragflow_deps/, matching the paths expected by ragflow_deps/Dockerfile .

It calls huggingface_hub.snapshot_download for two HuggingFace repos :

  • InfiniFlow/deepdoc
  • InfiniFlow/text_concat_xgb_v1.0

After downloading archives, it extracts the three native Go libraries (pdfium, pdf_oxide, office_oxide) into ~/ragflow-native-libs/ for use by build.sh during Go compilation . The --china-mirrors flag switches all download URLs to Tsinghua/Huawei Cloud/npmmirror alternatives .

deepdoc/server/download_deps.py — DeepDoc OSS Container#

deepdoc/server/download_deps.py is a minimal counterpart used only inside Dockerfile_deepdoc_oss. It downloads only the five ONNX files needed for standalone inference :

  • layout.onnx, det.onnx, rec.onnx, tsr.onnx, ocr.res

It respects the HF_ENDPOINT environment variable to redirect to https://hf-mirror.com for China builds, and skips files that already exist .


The ragflow_deps Image#

ragflow_deps/Dockerfile is built FROM scratch — it contains only the artifacts copied from the ragflow_deps/ directory after download_deps.py runs . The main Dockerfile mounts this image at build time via --mount=type=bind,from=infiniflow/ragflow_deps:latest,... to copy models, NLTK data, Tika, Chrome, and arch-specific binaries without any network access during the main image build .


DeepDoc OSS Container (Dockerfile_deepdoc_oss)#

Dockerfile_deepdoc_oss is a single-stage Ubuntu 24.04 image that:

  1. Installs python3.12, onnxruntime, opencv-python-headless, and minimal dependencies via pip
  2. Runs deepdoc/server/download_deps.py to pull the five ONNX models from HuggingFace into /app/rag/res/deepdoc
  3. Runs docker_stubs.py to generate stub packages so vision modules load without torch, pdfplumber, or Ascend imports
  4. Exposes port 9390 and starts deepdoc_server.py --model-dir /app/rag/res/deepdoc

Pass --build-arg NEED_MIRROR=1 to switch both pip and HuggingFace downloads to China-accessible mirrors .


China Mirror Support#

Both scripts and both Dockerfiles support NEED_MIRROR=1 / --china-mirrors:

LocationDefaultWith mirror
HuggingFacehuggingface.cohf-mirror.com (via HF_ENDPOINT)
PyPIpypi.orgmirrors.aliyun.com/pypi/simple
Ubuntu debsarchive.ubuntu.commirrors.tuna.tsinghua.edu.cn
Maven (Tika)repo1.maven.orgrepo.huaweicloud.com
Chrome/ChromeDriverGoogle Storageregistry.npmmirror.com

Related Files#

FileRole
ragflow_deps/download_deps.pyFull artifact download for ragflow_deps image
ragflow_deps/DockerfileScratch image packaging all downloaded artifacts
deepdoc/server/download_deps.pyONNX-only download for standalone OSS container
Dockerfile_deepdoc_ossStandalone DeepDoc microservice image
deepdoc/vision/recognizer.pyBase class; triggers runtime HF download if models absent
build.shUses ~/ragflow-native-libs/ extracted by download_deps.py
Documents
Agent Import and DSL Compatibility
Agent Prompt Processing
Agent Retrieval
API Authorization
API Error Codes
Ascend Inference Pipeline
Authentication
Azure OpenAI Integration
Canvas Architecture
Chat Assistant Configuration
Chat Completion API
Chrome for Testing ARM64 Support
Chunk Metadata Extraction
Chunker Pipeline
Compilation Template Management
Component Variable Propagation
Connection and Resource Management
Connector Architecture
Connector Document Sync
Conversation Session Management
What is the complete API flow for building a frontend UI with RAGFlow, covering dialogs, conversations, message history, streaming responses, and deletion?
Database Migrations
Dataflow Pipeline Execution
Dataset Access Control
Dataset Configuration UI
Dataset Parsing Mode
DeepDoc Model Distribution
DeepDoc Model Path Resolution
DeepDoc Module
Dify External Knowledge Integration
Docker Build Configuration
Document Parsing Pipeline
Elasticsearch Index Management
Embedding Pipeline
Embedding Vector Validation
Encrypted Storage
Figure Description Language Propagation
Frontend Build and Deployment
GPU and Accelerator Support
Hybrid Search and Retrieval
Infinity Database Stability
Internal Compilation Artifact Indexing
Keyword Extraction
Knowledge Compilation Pipeline
Knowledge Graph
Knowledge Graph Retrieval
Knowledge Graph Visualization
Layout Element Overlap Detection
LLM Configuration and Selection
LLM Driver Integration
LLM Provider Integration
MCP Server Integration
Media Context Configuration
Metadata Filtering
MinerU Configuration and Provider Resolution
MinerU PDF Parsing
Model Provider Architecture
Model Selection UI
Model Thinking and Reasoning
Multi-Architecture Docker Support
Multi-Backend Object Storage
Multi-Page Table and Element Handling
Multilingual Search Tokenization
Native Library Build and Linking
OCR Backend and Model Loading
Parser Configuration
Parser Output Lifecycle
Parser-Chunk Contract
PDF Chunk Position Rendering
Picture Chunker Media Processing
Pipeline Canvas Architecture
Provider Configuration Persistence
Provider Model Discovery
Python Dependency Management
RAGFlow Python SDK
Redis Cache Architecture
Retrieval API
Retrieval Pipeline
SSRF Protection
Table Column Field Normalization
Table Structure Parsing
Task Cancellation
Tenant Model Resolution
Text2SQL
TSR Coordinate System Alignment