【GPT入门】DeepSeek OCR 私有化部署指南
1. 概述
DeepSeek OCR 是一款开源高效的文档智能识别工具,凭借创新视觉压缩技术与 3B 参数 MoE 架构,实现 97% 高识别精度与 10 倍 Token 压缩效率。它支持 100 + 种语言及印刷体、手写体识别,能精准提取文档文字、表格、公式等元素,还原版式结构。
工具适配 JPG、PDF 等多种格式,支持批量处理与 HTML、Markdown 等结构化输出,内置图像预处理功能优化识别效果。部署极为便捷,可通过 Docker 或 Helm 快速实现私有化部署,单卡日处理 20 万页文档,兼顾数据安全与高吞吐需求,适用于企业数字化、科研文献处理等多场景。
github地址:https://github.com/deepseek-ai/DeepSeek-OCR

2. deepseek ocr环境安装部署
服务器: 3090服务器,在autodl 或优云智算购买。
2.1 conda 环境
conda create -n deepseek-ocr python=3.12.9 -y
conda activate deepseek-ocr
下面是基于autodl服务器,做的改动,避免系统盘数据多大
mkdir /root/autodl-tmp/xxzhenv
conda create --prefix /root/autodl-tmp/xxzhenv/deepseek-ocr python=3.12.9 -y
conda config --add envs_dirs /root/autodl-tmp/xxzhenv
conda activate deepseek-ocr
2.2 下载模型
设置国内镜像
export HF_ENDPOINT=https://hf-mirror.com
autodl的学术加速
source /etc/network_turbo
mkdir /root/autodl-tmp/models_xxzh
pip install modelscope
modelscope download --model deepseek-ai/DeepSeek-OCR --local_dir /root/autodl-tmp/models_xxzh/deepseek-ai/DeepSeek-OCR
2.3 下载测试代码
下载代码
git clone https://github.com/deepseek-ai/DeepSeek-OCR.git
2.4 安装环境
wget https://github.com/vllm-project/vllm/releases/download/v0.8.5/vllm-0.8.5+cu118-cp38-abi3-manylinux1_x86_64.whl
pip install torch2.6.0 torchvision0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu118
pip install vllm-0.8.5+cu118-cp38-abi3-manylinux1_x86_64.whl
cd DeepSeek-OCR ( github源码的: git clone https://github.com/deepseek-ai/DeepSeek-OCR.git)
pip install -r requirements.txt
pip install flash-attn==2.7.3 --no-build-isolation
安装警告:不理会
Uninstalling transformers-4.57.1:
Successfully uninstalled transformers-4.57.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
vllm 0.8.5+cu118 requires tokenizers>=0.21.1, but you have tokenizers 0.20.3 which is incompatible.
vllm 0.8.5+cu118 requires transformers>=4.51.1, but you have transformers 4.46.3 which is incompatible.
3. huggingface代码测试
3.1 测试图片
- 代码修改点

- 执行命令:
(deepseek-ocr) root@autodl-container-9d764ea661-58b67c2a:~/DeepSeek-OCR/DeepSeek-OCR-master/DeepSeek-OCR-hf# time python run_dpsk_ocr.py - 输入文件:

- 输出目录





3.2 基于报纸图片测试
原图地址: https://paper.xinmin.cn/html/home/2025-11-12/02/26191.html

测试效果:


4. vllm引擎测试
- 代码修改

- 运行命令:
(deepseek-ocr) root@autodl-container-9d764ea661-58b67c2a:~/DeepSeek-OCR/DeepSeek-OCR-master/DeepSeek-OCR-vllm# time python run_dpsk_ocr_image.py
耗时:
real 0m52.340s
user 0m56.079s
sys 0m7.935s
huggingface耗时:
real 2m3.393s
user 2m26.174s
sys 0m12.697s
- vllm版本比huggingface快很多,
5.在线体验版
https://deepseek-ocr-compshare.modelverse.cn/



1782

被折叠的 条评论
为什么被折叠?



