---
title: MinerU_1.2.2-backup
canonical_url: "https://www.modelscope.cn/models/mscoder/MinerU_1.2.2-backup"
md_url: "https://www.modelscope.cn/models/mscoder/MinerU_1.2.2-backup.md"
repository: mscoder/MinerU_1.2.2-backup
chinese_name: "MinerU_1.2.2(备份)"
last_updated: 2025-10-17
license: "Apache License 2.0"
pipeline_tag: ocr-detection
tasks:
  - ocr-detection
parameters: 938.2M
tensor_type:
  - BF16
library_name:
  - safetensors
  - pytorch
frameworks:
  - Pytorch
downloads: 295
stars: 1
---

# MinerU_1.2.2-backup

> MinerU_1.2.2-backup - mscoder 在 ModelScope 开源的模型。MinerU_1.2.2(备份)

mscoder/MinerU_1.2.2-backup 是 ModelScope 魔搭社区上的 938.2M 参数ocr-detection模型，采用 Apache License 2.0 许可。

- **Repository**: mscoder/MinerU_1.2.2-backup
- **License**: Apache License 2.0
- **Tasks**: ocr-detection
- **Parameters**: 938.2M
- **Downloads**: 295
- **Stars**: 1
- **Last updated**: 2025-10-17

Source: https://www.modelscope.cn/models/mscoder/MinerU_1.2.2-backup

---

# mineru_1.2.2(备份)

mineru模型原始仓库：[PDF-Extract-Kit-1.0 模型仓库 (MinerU使用仓库) · 模型库](https://modelscope.cn/models/OpenDataLab/PDF-Extract-Kit-1.0)

MinerU是一款将PDF转化为机器可读格式的工具（如markdown、json），可以很方便地抽取为任意格式。

尽管miner已经更新到2.x版本了，但由于手上只有cpu服务器，还是1.2.2版本适合。

- 1.3以上版本由于将paddleocr转为pytorch格式，导致cpu解析速度变慢。

- 2.x直接升级为vlm，更加不适合cpu使用了。

## 依赖

```python
pip install -U magic-pdf[full]==1.2.2 --extra-index-url https://wheels.myhloli.com -i https://mirrors.aliyun.com/pypi/simple
```

详细需要下载[Release magic_pdf-1.2.2-released · opendatalab/MinerU](https://github.com/opendatalab/MinerU/releases/tag/magic_pdf-1.2.2-released) 源码查看setup.py文件



## 使用

修改配置文件magic-pdf.json

```json
"models-dir": "MinerU_1.2.2-backup",    # 表格公式等模型目录路径
"layoutreader-model-dir": "MinerU_1.2.2-backup/layoutreader",  # 文档结构模型目录路径
"device-mode": "cpu",  # 运行设备，gpu设置为cuda
```

demo例子

```python
import os

# 设置配置文件路径
os.environ['MINERU_TOOLS_CONFIG_JSON'] = "model_config.json"

from magic_pdf.data.data_reader_writer import FileBasedDataWriter, FileBasedDataReader
from magic_pdf.data.dataset import PymuDocDataset
from magic_pdf.model.doc_analyze_by_custom_model import doc_analyze
from magic_pdf.config.enums import SupportedPdfParseMethod

# args
pdf_file_name = "abc.pdf"  # 替换为测试的pdf文件路径
name_without_suff = pdf_file_name.split(".")[0]

# prepare env
local_image_dir, local_md_dir = "output/images", "output"
image_dir = str(os.path.basename(local_image_dir))

os.makedirs(local_image_dir, exist_ok=True)

image_writer, md_writer = FileBasedDataWriter(local_image_dir), FileBasedDataWriter(
    local_md_dir
)
image_dir = str(os.path.basename(local_image_dir))

# read bytes
reader1 = FileBasedDataReader("")
pdf_bytes = reader1.read(pdf_file_name)  # read the pdf content

# proc
## Create Dataset Instance
ds = PymuDocDataset(pdf_bytes)

## inference
if ds.classify() == SupportedPdfParseMethod.OCR:
    infer_result = ds.apply(doc_analyze, ocr=True)

    ## pipeline
    pipe_result = infer_result.pipe_ocr_mode(image_writer)

else:
    infer_result = ds.apply(doc_analyze, ocr=False)

    ## pipeline
    pipe_result = infer_result.pipe_txt_mode(image_writer)

### dump markdown
pipe_result.dump_md(md_writer, f"{name_without_suff}.md", image_dir)

### dump content list
pipe_result.dump_content_list(md_writer, f"{name_without_suff}_content_list.json", image_dir)

```



## 感谢

[opendatalab/MinerU](https://github.com/opendatalab/MinerU)

[MinerU 本地离线环境整合一键包 使用教程(无需安装部署, 解压即用)](https://zhuanlan.zhihu.com/p/718643934)
