Home

Awesome

<div align="center" xmlns="http://www.w3.org/1999/html"> <!-- logo --> <p align="center"> <img src="docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;"> </p> <!-- icon -->

stars forks open issues issue resolution PyPI version Downloads Downloads

OpenDataLab HuggingFace ModelScope Colab Paper

<a href="https://trendshift.io/repositories/11174" target="_blank"><img src="https://trendshift.io/api/badge/repositories/11174" alt="opendatalab%2FMinerU | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>

<!-- language -->

English | 简体中文

<!-- hot link --> <p align="center"> <a href="https://github.com/opendatalab/PDF-Extract-Kit">PDF-Extract-Kit: High-Quality PDF Extraction Toolkit</a>🔥🔥🔥 </p> <!-- join us --> <p align="center"> 👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://cdn.vansin.top/internlm/mineru.jpg" target="_blank">WeChat</a> </p> </div>

Changelog

<!-- TABLE OF CONTENT --> <details open="open"> <summary><h2 style="display: inline-block">Table of Contents</h2></summary> <ol> <li> <a href="#mineru">MinerU</a> <ul> <li><a href="#project-introduction">Project Introduction</a></li> <li><a href="#key-features">Key Features</a></li> <li><a href="#quick-start">Quick Start</a> <ul> <li><a href="#online-demo">Online Demo</a></li> <li><a href="#quick-cpu-demo">Quick CPU Demo</a></li> <li><a href="#using-gpu">Using GPU</a></li> </ul> </li> <li><a href="#usage">Usage</a> <ul> <li><a href="#command-line">Command Line</a></li> <li><a href="#api">API</a></li> <li><a href="#deploy-derived-projects">Deploy Derived Projects</a></li> <li><a href="#development-guide">Development Guide</a></li> </ul> </li> </ul> </li> <li><a href="#todo">TODO</a></li> <li><a href="#known-issues">Known Issues</a></li> <li><a href="#faq">FAQ</a></li> <li><a href="#all-thanks-to-our-contributors">All Thanks To Our Contributors</a></li> <li><a href="#license-information">License Information</a></li> <li><a href="#acknowledgments">Acknowledgments</a></li> <li><a href="#citation">Citation</a></li> <li><a href="#star-history">Star History</a></li> <li><a href="#magic-doc">Magic-doc</a></li> <li><a href="#magic-html">Magic-html</a></li> <li><a href="#links">Links</a></li> </ol> </details>

MinerU

Project Introduction

MinerU is a tool that converts PDFs into machine-readable formats (e.g., markdown, JSON), allowing for easy extraction into any format. MinerU was born during the pre-training process of InternLM. We focus on solving symbol conversion issues in scientific literature and hope to contribute to technological development in the era of large models. Compared to well-known commercial products, MinerU is still young. If you encounter any issues or if the results are not as expected, please submit an issue on issue and attach the relevant PDF.

https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c

Key Features

Quick Start

If you encounter any installation issues, please first consult the <a href="#faq">FAQ</a>. </br> If the parsing results are not as expected, refer to the <a href="#known-issues">Known Issues</a>. </br> There are three different ways to experience MinerU:

[!WARNING] Pre-installation Notice—Hardware and Software Environment Support

To ensure the stability and reliability of the project, we only optimize and test for specific hardware and software environments during development. This ensures that users deploying and running the project on recommended system configurations will get the best performance with the fewest compatibility issues.

By focusing resources on the mainline environment, our team can more efficiently resolve potential bugs and develop new features.

In non-mainline environments, due to the diversity of hardware and software configurations, as well as third-party dependency compatibility issues, we cannot guarantee 100% project availability. Therefore, for users who wish to use this project in non-recommended environments, we suggest carefully reading the documentation and FAQ first. Most issues already have corresponding solutions in the FAQ. We also encourage community feedback to help us gradually expand support.

<table> <tr> <td colspan="3" rowspan="2">Operating System</td> </tr> <tr> <td>Ubuntu 22.04 LTS</td> <td>Windows 10 / 11</td> <td>macOS 11+</td> </tr> <tr> <td colspan="3">CPU</td> <td>x86_64(unsupported ARM Linux)</td> <td>x86_64(unsupported ARM Windows)</td> <td>x86_64 / arm64</td> </tr> <tr> <td colspan="3">Memory</td> <td colspan="3">16GB or more, recommended 32GB+</td> </tr> <tr> <td colspan="3">Python Version</td> <td colspan="3">3.10(Please make sure to create a Python 3.10 virtual environment using conda)</td> </tr> <tr> <td colspan="3">Nvidia Driver Version</td> <td>latest (Proprietary Driver)</td> <td>latest</td> <td>None</td> </tr> <tr> <td colspan="3">CUDA Environment</td> <td>Automatic installation [12.1 (pytorch) + 11.8 (paddle)]</td> <td>11.8 (manual installation) + cuDNN v8.7.0 (manual installation)</td> <td>None</td> </tr> <tr> <td rowspan="2">GPU Hardware Support List</td> <td colspan="2">GPU VRAM 8GB or more</td> <td colspan="2">2080~2080Ti / 3060Ti~3090Ti / 4060~4090<br> 8G VRAM can enable all acceleration features</td> <td rowspan="2">None</td> </tr> </table>

Online Demo

Stable Version (Stable version verified by QA):
OpenDataLab

Test Version (Synced with dev branch updates, testing new features):
HuggingFace ModelScope

Quick CPU Demo

1. Install magic-pdf

conda create -n MinerU python=3.10
conda activate MinerU
pip install -U magic-pdf[full] --extra-index-url https://wheels.myhloli.com

2. Download model weight files

Refer to How to Download Model Files for detailed instructions.

3. Modify the Configuration File for Additional Configuration

After completing the 2. Download model weight files step, the script will automatically generate a magic-pdf.json file in the user directory and configure the default model path. You can find the magic-pdf.json file in your 【user directory】.

[!TIP] The user directory for Windows is "C:\Users\username", for Linux it is "/home/username", and for macOS it is "/Users/username".

You can modify certain configurations in this file to enable or disable features, such as table recognition:

[!NOTE] If the following items are not present in the JSON, please manually add the required items and remove the comment content (standard JSON does not support comments).

{
    // other config
    "layout-config": {
        "model": "layoutlmv3" // Please change to "doclayout_yolo" when using doclayout_yolo.
    },
    "formula-config": {
        "mfd_model": "yolo_v8_mfd",
        "mfr_model": "unimernet_small",
        "enable": true  // The formula recognition feature is enabled by default. If you need to disable it, please change the value here to "false".
    },
    "table-config": {
        "model": "rapid_table",  // Default to using "rapid_table", can be switched to "tablemaster" or "struct_eqtable".
        "enable": false, // The table recognition feature is disabled by default. If you need to enable it, please change the value here to "true".
        "max_time": 400
    }
}

Using GPU

If your device supports CUDA and meets the GPU requirements of the mainline environment, you can use GPU acceleration. Please select the appropriate guide based on your system:

[!IMPORTANT] Docker requires a GPU with at least 8GB of VRAM, and all acceleration features are enabled by default.

Before running this Docker, you can use the following command to check if your device supports CUDA acceleration on Docker.

docker run --rm --gpus=all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi
wget https://github.com/opendatalab/MinerU/raw/master/Dockerfile
docker build -t mineru:latest .
docker run --rm -it --gpus=all mineru:latest /bin/bash
magic-pdf --help

Usage

Command Line

Using MinerU via Command Line

[!TIP] For more information about the output files, please refer to the Output File Description.

API

Using MinerU via Python API

Deploy Derived Projects

Derived projects include secondary development projects based on MinerU by project developers and community developers,
such as application interfaces based on Gradio, RAG based on llama, web demos similar to the official website, lightweight multi-GPU load balancing client/server ends, etc. These projects may offer more features and a better user experience.
For specific deployment methods, please refer to the Derived Project README

Development Guide

TODO

TODO

Known Issues

FAQ

FAQ in Chinese

FAQ in English

All Thanks To Our Contributors

<a href="https://github.com/opendatalab/MinerU/graphs/contributors"> <img src="https://contrib.rocks/image?repo=opendatalab/MinerU" /> </a>

License Information

LICENSE.md

This project currently uses PyMuPDF to achieve advanced functionality. However, since it adheres to the AGPL license, it may impose restrictions on certain usage scenarios. In future iterations, we plan to explore and replace it with a more permissive PDF processing library to enhance user-friendliness and flexibility.

Acknowledgments

Citation

@misc{wang2024mineruopensourcesolutionprecise,
      title={MinerU: An Open-Source Solution for Precise Document Content Extraction}, 
      author={Bin Wang and Chao Xu and Xiaomeng Zhao and Linke Ouyang and Fan Wu and Zhiyuan Zhao and Rui Xu and Kaiwen Liu and Yuan Qu and Fukai Shang and Bo Zhang and Liqun Wei and Zhihao Sui and Wei Li and Botian Shi and Yu Qiao and Dahua Lin and Conghui He},
      year={2024},
      eprint={2409.18839},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2409.18839}, 
}

@article{he2024opendatalab,
  title={Opendatalab: Empowering general artificial intelligence with open datasets},
  author={He, Conghui and Li, Wei and Jin, Zhenjiang and Xu, Chao and Wang, Bin and Lin, Dahua},
  journal={arXiv preprint arXiv:2407.13773},
  year={2024}
}

Star History

<a> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date&theme=dark" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" /> <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=opendatalab/MinerU&type=Date" /> </picture> </a>

Magic-doc

Magic-Doc Fast speed ppt/pptx/doc/docx/pdf extraction tool

Magic-html

Magic-HTML Mixed web page extraction tool

Links