Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce2063a8d0 | ||
|
|
e7b2a48485 | ||
|
|
bb5d403577 | ||
|
|
aff8d17655 | ||
|
|
637dba5d8d | ||
|
|
9d2f5f3012 | ||
|
|
238c1ef3a1 | ||
|
|
515e95c74c | ||
|
|
6342de27ad | ||
|
|
087d3686c5 | ||
|
|
a000190a1a | ||
|
|
ecb7b47ab3 | ||
|
|
3220550815 | ||
|
|
3276bf7250 | ||
|
|
3a4a3d0dc4 | ||
|
|
f77efcfcf6 | ||
|
|
49fc6cbcfa | ||
|
|
b8402ab270 | ||
|
|
fc10b91d79 | ||
|
|
699f8de099 | ||
|
|
6c84107965 | ||
|
|
2f19ce5d57 | ||
|
|
4f7f438c49 | ||
|
|
2df51f5f83 | ||
|
|
c0ef6ec4e6 | ||
|
|
ba19e3b26c | ||
|
|
3a136c583f | ||
|
|
402b5cb0da | ||
|
|
71feff8231 | ||
|
|
a59e659eee | ||
|
|
ca813cdc87 | ||
|
|
d7d57e3639 |
16
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -122,21 +122,7 @@ body:
|
||||
#multiple: false
|
||||
options:
|
||||
-
|
||||
- "`<2.2.0`"
|
||||
- "`2.2.x`"
|
||||
- "`>=2.5`"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: backend_name
|
||||
attributes:
|
||||
label: Backend name | 解析后端
|
||||
#multiple: false
|
||||
options:
|
||||
-
|
||||
- "vlm"
|
||||
- "pipeline"
|
||||
- "2.0.x"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
6
.github/workflows/cla.yml
vendored
@@ -18,9 +18,9 @@ jobs:
|
||||
steps:
|
||||
- name: "CLA Assistant"
|
||||
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
|
||||
uses: contributor-assistant/github-action@v2.6.1
|
||||
uses: contributor-assistant/github-action@v2.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# the below token should have repo scope and must be manually added by you in the repository's secret
|
||||
# This token is required only if you have configured to store the signatures in a remote repository/organization
|
||||
PERSONAL_ACCESS_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
path-to-signatures: 'signatures/version1/cla.json'
|
||||
path-to-document: 'https://github.com/opendatalab/MinerU/blob/master/MinerU_CLA.md' # e.g. a CLA or a DCO document
|
||||
# branch should not be protected
|
||||
branch: 'cla'
|
||||
branch: 'master'
|
||||
allowlist: myhloli,dt-yy,Focusshang,renpengli01,icecraft,drunkpig,wangbinDL,qiangqiang199,GDDGCZ518,papayalove,conghui,quyuan,LollipopsAndWine,Sidney233
|
||||
|
||||
# the followings are the optional inputs - If the optional inputs are not given, then default values will be taken
|
||||
|
||||
20
.github/workflows/cli.yml
vendored
@@ -20,13 +20,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: PDF cli
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: dev
|
||||
fetch-depth: 2
|
||||
|
||||
- name: install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: install&test
|
||||
run: |
|
||||
@@ -38,11 +38,11 @@ jobs:
|
||||
cd $GITHUB_WORKSPACE && coverage run
|
||||
cd $GITHUB_WORKSPACE && python tests/get_coverage.py
|
||||
|
||||
# notify_to_feishu:
|
||||
# if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure')}}
|
||||
# needs: cli-test
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: notify
|
||||
# run: |
|
||||
# curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"'${{ github.repository }}' GitHubAction Failed","content":[[{"tag":"text","text":""},{"tag":"a","text":"Please click here for details ","href":"https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"}]]}}}}' ${{ secrets.FEISHU_WEBHOOK_URL }}
|
||||
notify_to_feishu:
|
||||
if: ${{ always() && !cancelled() && contains(needs.*.result, 'failure')}}
|
||||
needs: cli-test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: notify
|
||||
run: |
|
||||
curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"post","content":{"post":{"zh_cn":{"title":"'${{ github.repository }}' GitHubAction Failed","content":[[{"tag":"text","text":""},{"tag":"a","text":"Please click here for details ","href":"https://github.com/'${{ github.repository }}'/actions/runs/'${GITHUB_RUN_ID}'"}]]}}}}' ${{ secrets.FEISHU_WEBHOOK_URL }}
|
||||
|
||||
2
.github/workflows/mkdocs.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout master
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: dev
|
||||
- name: Deploy docs
|
||||
|
||||
16
.github/workflows/python-package.yml
vendored
@@ -16,13 +16,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.10"
|
||||
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
@@ -75,7 +75,7 @@ jobs:
|
||||
cat mineru/version.py
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v6
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
@@ -110,7 +110,7 @@ jobs:
|
||||
python -m build --wheel
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wheel-file
|
||||
path: dist/*.whl
|
||||
@@ -121,10 +121,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v7
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: wheel-file
|
||||
path: dist
|
||||
|
||||
6
.gitignore
vendored
@@ -16,12 +16,6 @@ debug/
|
||||
*.ipynb
|
||||
.idea
|
||||
|
||||
# Python build artifacts
|
||||
*.egg-info/
|
||||
build/
|
||||
dist/
|
||||
*.egg
|
||||
|
||||
# vscode history
|
||||
.history
|
||||
|
||||
|
||||
799
LICENSE.md
@@ -1,201 +1,662 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
1. Definitions.
|
||||
Preamble
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
0. Definitions.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
1. Source Code.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
2. Basic Permissions.
|
||||
|
||||
Copyright [2024-2026] [Opendatalab & MinerU Team]
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
522
README.md
@@ -1,7 +1,7 @@
|
||||
<div align="center" xmlns="http://www.w3.org/1999/html">
|
||||
<!-- logo -->
|
||||
<p align="center">
|
||||
<img src="https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">
|
||||
<img src="docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">
|
||||
</p>
|
||||
|
||||
<!-- icon -->
|
||||
@@ -17,9 +17,8 @@
|
||||
[](https://mineru.net/OpenSourceTools/Extractor?source=github)
|
||||
[](https://huggingface.co/spaces/opendatalab/MinerU)
|
||||
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
|
||||
[](https://colab.research.google.com/gist/myhloli/a3cb16570ab3cfeadf9d8f0ac91b4fca/mineru_demo.ipynb)
|
||||
[](https://arxiv.org/abs/2409.18839)
|
||||
[](https://arxiv.org/abs/2509.22186)
|
||||
[](https://colab.research.google.com/gist/myhloli/3b3a00a4a0a61577b6c30f989092d20d/mineru_demo.ipynb)
|
||||
[](https://arxiv.org/abs/2409.18839)
|
||||
[](https://deepwiki.com/opendatalab/MinerU)
|
||||
|
||||
|
||||
@@ -38,51 +37,371 @@
|
||||
<!-- join us -->
|
||||
|
||||
<p align="center">
|
||||
👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://mineru.net/community-portal/?aliasId=3c430f94" target="_blank">WeChat</a>
|
||||
👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="http://mineru.space/s/V85Yl" target="_blank">WeChat</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
# Changelog
|
||||
|
||||
- 2026/02/06 2.7.6 Release
|
||||
- Added support for the domestic computing platforms Kunlunxin and Tecorigin; currently, the domestic computing platforms that have been adapted and supported by the official team and vendors include:
|
||||
- [Ascend](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Ascend)
|
||||
- [T-Head](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/THead)
|
||||
- [METAX](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/METAX)
|
||||
- [Hygon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Hygon/)
|
||||
- [Enflame](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Enflame/)
|
||||
- [MooreThreads](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/MooreThreads/)
|
||||
- [IluvatarCorex](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/IluvatarCorex/)
|
||||
- [Cambricon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Cambricon/)
|
||||
- [Kunlunxin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Kunlunxin/)
|
||||
- [Tecorigin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Tecorigin/)
|
||||
- [Biren](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Biren/)
|
||||
- MinerU continues to support domestic hardware platforms and mainstream chip architectures. With secure and reliable technology, it helps research, government, and enterprise users reach new heights in document digitization!
|
||||
- 2025/07/16 2.1.1 Released
|
||||
- Bug fixes
|
||||
- Fixed text block content loss issue that could occur in certain `pipeline` scenarios #3005
|
||||
- Fixed issue where `sglang-client` required unnecessary packages like `torch` #2968
|
||||
- Updated `dockerfile` to fix incomplete text content parsing due to missing fonts in Linux #2915
|
||||
- Usability improvements
|
||||
- Updated `compose.yaml` to facilitate direct startup of `sglang-server`, `mineru-api`, and `mineru-gradio` services
|
||||
- Launched brand new [online documentation site](https://opendatalab.github.io/MinerU/), simplified readme, providing better documentation experience
|
||||
- 2025/07/05 Version 2.1.0 Released
|
||||
- This is the first major update of MinerU 2, which includes a large number of new features and improvements, covering significant performance optimizations, user experience enhancements, and bug fixes. The detailed update contents are as follows:
|
||||
- **Performance Optimizations:**
|
||||
- Significantly improved preprocessing speed for documents with specific resolutions (around 2000 pixels on the long side).
|
||||
- Greatly enhanced post-processing speed when the `pipeline` backend handles batch processing of documents with fewer pages (<10 pages).
|
||||
- Layout analysis speed of the `pipeline` backend has been increased by approximately 20%.
|
||||
- **Experience Enhancements:**
|
||||
- Built-in ready-to-use `fastapi service` and `gradio webui`. For detailed usage instructions, please refer to [Documentation](https://opendatalab.github.io/MinerU/usage/quick_usage/#advanced-usage-via-api-webui-sglang-clientserver).
|
||||
- Adapted to `sglang` version `0.4.8`, significantly reducing the GPU memory requirements for the `vlm-sglang` backend. It can now run on graphics cards with as little as `8GB GPU memory` (Turing architecture or newer).
|
||||
- Added transparent parameter passing for all commands related to `sglang`, allowing the `sglang-engine` backend to receive all `sglang` parameters consistently with the `sglang-server`.
|
||||
- Supports feature extensions based on configuration files, including `custom formula delimiters`, `enabling heading classification`, and `customizing local model directories`. For detailed usage instructions, please refer to [Documentation](https://opendatalab.github.io/MinerU/usage/quick_usage/#extending-mineru-functionality-with-configuration-files).
|
||||
- **New Features:**
|
||||
- Updated the `pipeline` backend with the PP-OCRv5 multilingual text recognition model, supporting text recognition in 37 languages such as French, Spanish, Portuguese, Russian, and Korean, with an average accuracy improvement of over 30%. [Details](https://paddlepaddle.github.io/PaddleOCR/latest/en/version3.x/algorithm/PP-OCRv5/PP-OCRv5_multi_languages.html)
|
||||
- Introduced limited support for vertical text layout in the `pipeline` backend.
|
||||
|
||||
- 2026/01/30 2.7.4 Release
|
||||
- Added support for domestic computing platforms IluvatarCorex and Cambricon.
|
||||
|
||||
- 2026/01/23 2.7.2 Release
|
||||
- Added support for domestic computing platforms Hygon, Enflame, and Moore Threads.
|
||||
- Cross-page table merging optimization, improving merge success rate and merge quality.
|
||||
|
||||
- 2026/01/06 2.7.1 Release
|
||||
- fix bug: #4300
|
||||
- Updated pdfminer.six dependency version to resolve [CVE-2025-64512](https://github.com/advisories/GHSA-wf5f-4jwr-ppcp)
|
||||
- Support automatic correction of input image exif orientation to improve OCR recognition accuracy #4283
|
||||
|
||||
- 2025/12/30 2.7.0 Release
|
||||
- Simplified installation process. No need to separately install `vlm` acceleration engine dependencies. Using `uv pip install mineru[all]` during installation will install all optional backend dependencies.
|
||||
- Added new `hybrid` backend, which combines the advantages of `pipeline` and `vlm` backends. Built on vlm, it integrates some capabilities of pipeline, adding extra extensibility on top of high accuracy:
|
||||
- Directly extracts text from text PDFs, natively supports multi-language recognition in text PDF scenarios, and greatly reduces parsing hallucinations;
|
||||
- Supports text recognition in 109 languages for scanned PDF scenarios by specifying OCR language;
|
||||
- Independent inline formula recognition switch, which can be disabled separately when inline formula recognition is not needed, improving the visual effect of parsing results.
|
||||
- Simplified engine selection logic for `vlm/hybrid` backends. Users only need to specify the backend as `*-auto-engine`, and the system will automatically select the appropriate engine for inference acceleration based on the current environment, improving usability.
|
||||
- Switched default parsing backend from `pipeline` to `hybrid-auto-engine`, improving out-of-the-box result consistency for new users and avoiding cognitive differences in parsing results.
|
||||
- Added i18n support to gradio application, supporting switching between Chinese and English languages.
|
||||
<details>
|
||||
<summary>History Log</summary>
|
||||
<details>
|
||||
<summary>2025/06/20 2.0.6 Released</summary>
|
||||
<ul>
|
||||
<li>Fixed occasional parsing interruptions caused by invalid block content in <code>vlm</code> mode</li>
|
||||
<li>Fixed parsing interruptions caused by incomplete table structures in <code>vlm</code> mode</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
> 📝 View the complete [Changelog](https://opendatalab.github.io/MinerU/reference/changelog/) for more historical version information
|
||||
<details>
|
||||
<summary>2025/06/17 2.0.5 Released</summary>
|
||||
<ul>
|
||||
<li>Fixed the issue where models were still required to be downloaded in the <code>sglang-client</code> mode</li>
|
||||
<li>Fixed the issue where the <code>sglang-client</code> mode unnecessarily depended on packages like <code>torch</code> during runtime.</li>
|
||||
<li>Fixed the issue where only the first instance would take effect when attempting to launch multiple <code>sglang-client</code> instances via multiple URLs within the same process</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/06/15 2.0.3 released</summary>
|
||||
<ul>
|
||||
<li>Fixed a configuration file key-value update error that occurred when downloading model type was set to <code>all</code></li>
|
||||
<li>Fixed the issue where the formula and table feature toggle switches were not working in <code>command line mode</code>, causing the features to remain enabled.</li>
|
||||
<li>Fixed compatibility issues with sglang version 0.4.7 in the <code>sglang-engine</code> mode.</li>
|
||||
<li>Updated Dockerfile and installation documentation for deploying the full version of MinerU in sglang environment</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/06/13 2.0.0 Released</summary>
|
||||
<ul>
|
||||
<li><strong>New Architecture</strong>: MinerU 2.0 has been deeply restructured in code organization and interaction methods, significantly improving system usability, maintainability, and extensibility.
|
||||
<ul>
|
||||
<li><strong>Removal of Third-party Dependency Limitations</strong>: Completely eliminated the dependency on <code>pymupdf</code>, moving the project toward a more open and compliant open-source direction.</li>
|
||||
<li><strong>Ready-to-use, Easy Configuration</strong>: No need to manually edit JSON configuration files; most parameters can now be set directly via command line or API.</li>
|
||||
<li><strong>Automatic Model Management</strong>: Added automatic model download and update mechanisms, allowing users to complete model deployment without manual intervention.</li>
|
||||
<li><strong>Offline Deployment Friendly</strong>: Provides built-in model download commands, supporting deployment requirements in completely offline environments.</li>
|
||||
<li><strong>Streamlined Code Structure</strong>: Removed thousands of lines of redundant code, simplified class inheritance logic, significantly improving code readability and development efficiency.</li>
|
||||
<li><strong>Unified Intermediate Format Output</strong>: Adopted standardized <code>middle_json</code> format, compatible with most secondary development scenarios based on this format, ensuring seamless ecosystem business migration.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>New Model</strong>: MinerU 2.0 integrates our latest small-parameter, high-performance multimodal document parsing model, achieving end-to-end high-speed, high-precision document understanding.
|
||||
<ul>
|
||||
<li><strong>Small Model, Big Capabilities</strong>: With parameters under 1B, yet surpassing traditional 72B-level vision-language models (VLMs) in parsing accuracy.</li>
|
||||
<li><strong>Multiple Functions in One</strong>: A single model covers multilingual recognition, handwriting recognition, layout analysis, table parsing, formula recognition, reading order sorting, and other core tasks.</li>
|
||||
<li><strong>Ultimate Inference Speed</strong>: Achieves peak throughput exceeding 10,000 tokens/s through <code>sglang</code> acceleration on a single NVIDIA 4090 card, easily handling large-scale document processing requirements.</li>
|
||||
<li><strong>Online Experience</strong>: You can experience our brand-new VLM model on <a href="https://mineru.net/OpenSourceTools/Extractor">MinerU.net</a>, <a href="https://huggingface.co/spaces/opendatalab/MinerU">Hugging Face</a>, and <a href="https://www.modelscope.cn/studios/OpenDataLab/MinerU">ModelScope</a>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Incompatible Changes Notice</strong>: To improve overall architectural rationality and long-term maintainability, this version contains some incompatible changes:
|
||||
<ul>
|
||||
<li>Python package name changed from <code>magic-pdf</code> to <code>mineru</code>, and the command-line tool changed from <code>magic-pdf</code> to <code>mineru</code>. Please update your scripts and command calls accordingly.</li>
|
||||
<li>For modular system design and ecosystem consistency considerations, MinerU 2.0 no longer includes the LibreOffice document conversion module. If you need to process Office documents, we recommend converting them to PDF format through an independently deployed LibreOffice service before proceeding with subsequent parsing operations.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>2025/05/24 Release 1.3.12</summary>
|
||||
<ul>
|
||||
<li>Added support for PPOCRv5 models, updated <code>ch_server</code> model to <code>PP-OCRv5_rec_server</code>, and <code>ch_lite</code> model to <code>PP-OCRv5_rec_mobile</code> (model update required)
|
||||
<ul>
|
||||
<li>In testing, we found that PPOCRv5(server) has some improvement for handwritten documents, but has slightly lower accuracy than v4_server_doc for other document types, so the default ch model remains unchanged as <code>PP-OCRv4_server_rec_doc</code>.</li>
|
||||
<li>Since PPOCRv5 has enhanced recognition capabilities for handwriting and special characters, you can manually choose the PPOCRv5 model for Japanese-Traditional Chinese mixed scenarios and handwritten documents</li>
|
||||
<li>You can select the appropriate model through the lang parameter <code>lang='ch_server'</code> (Python API) or <code>--lang ch_server</code> (command line):
|
||||
<ul>
|
||||
<li><code>ch</code>: <code>PP-OCRv4_server_rec_doc</code> (default) (Chinese/English/Japanese/Traditional Chinese mixed/15K dictionary)</li>
|
||||
<li><code>ch_server</code>: <code>PP-OCRv5_rec_server</code> (Chinese/English/Japanese/Traditional Chinese mixed + handwriting/18K dictionary)</li>
|
||||
<li><code>ch_lite</code>: <code>PP-OCRv5_rec_mobile</code> (Chinese/English/Japanese/Traditional Chinese mixed + handwriting/18K dictionary)</li>
|
||||
<li><code>ch_server_v4</code>: <code>PP-OCRv4_rec_server</code> (Chinese/English mixed/6K dictionary)</li>
|
||||
<li><code>ch_lite_v4</code>: <code>PP-OCRv4_rec_mobile</code> (Chinese/English mixed/6K dictionary)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Added support for handwritten documents through optimized layout recognition of handwritten text areas
|
||||
<ul>
|
||||
<li>This feature is supported by default, no additional configuration required</li>
|
||||
<li>You can refer to the instructions above to manually select the PPOCRv5 model for better handwritten document parsing results</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>The <code>huggingface</code> and <code>modelscope</code> demos have been updated to versions that support handwriting recognition and PPOCRv5 models, which you can experience online</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/29 Release 1.3.10</summary>
|
||||
<ul>
|
||||
<li>Added support for custom formula delimiters, which can be configured by modifying the <code>latex-delimiter-config</code> section in the <code>magic-pdf.json</code> file in your user directory.</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/27 Release 1.3.9</summary>
|
||||
<ul>
|
||||
<li>Optimized formula parsing functionality, improved formula rendering success rate</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/23 Release 1.3.8</summary>
|
||||
<ul>
|
||||
<li>The default <code>ocr</code> model (<code>ch</code>) has been updated to <code>PP-OCRv4_server_rec_doc</code> (model update required)
|
||||
<ul>
|
||||
<li><code>PP-OCRv4_server_rec_doc</code> is trained on a mixture of more Chinese document data and PP-OCR training data based on <code>PP-OCRv4_server_rec</code>, adding recognition capabilities for some traditional Chinese characters, Japanese, and special characters. It can recognize over 15,000 characters and improves both document-specific and general text recognition abilities.</li>
|
||||
<li><a href="https://paddlepaddle.github.io/PaddleX/latest/module_usage/tutorials/ocr_modules/text_recognition.html#_3">Performance comparison of PP-OCRv4_server_rec_doc/PP-OCRv4_server_rec/PP-OCRv4_mobile_rec</a></li>
|
||||
<li>After verification, the <code>PP-OCRv4_server_rec_doc</code> model shows significant accuracy improvements in Chinese/English/Japanese/Traditional Chinese in both single language and mixed language scenarios, with comparable speed to <code>PP-OCRv4_server_rec</code>, making it suitable for most use cases.</li>
|
||||
<li>In some pure English scenarios, <code>PP-OCRv4_server_rec_doc</code> may have word adhesion issues, while <code>PP-OCRv4_server_rec</code> performs better in these cases. Therefore, we've kept the <code>PP-OCRv4_server_rec</code> model, which users can access by adding the parameter <code>lang='ch_server'</code> (Python API) or <code>--lang ch_server</code> (command line).</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/22 Release 1.3.7</summary>
|
||||
<ul>
|
||||
<li>Fixed the issue where the lang parameter was ineffective during table parsing model initialization</li>
|
||||
<li>Fixed the significant speed reduction of OCR and table parsing in <code>cpu</code> mode</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/16 Release 1.3.4</summary>
|
||||
<ul>
|
||||
<li>Slightly improved OCR-det speed by removing some unnecessary blocks</li>
|
||||
<li>Fixed page-internal sorting errors caused by footnotes in certain cases</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/12 Release 1.3.2</summary>
|
||||
<ul>
|
||||
<li>Fixed dependency version incompatibility issues when installing on Windows with Python 3.13</li>
|
||||
<li>Optimized memory usage during batch inference</li>
|
||||
<li>Improved parsing of tables rotated 90 degrees</li>
|
||||
<li>Enhanced parsing of oversized tables in financial report samples</li>
|
||||
<li>Fixed the occasional word adhesion issue in English text areas when OCR language is not specified (model update required)</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/08 Release 1.3.1</summary>
|
||||
<ul>
|
||||
<li>Fixed several compatibility issues
|
||||
<ul>
|
||||
<li>Added support for Python 3.13</li>
|
||||
<li>Made final adaptations for outdated Linux systems (such as CentOS 7) with no guarantee of continued support in future versions, <a href="https://github.com/opendatalab/MinerU/issues/1004">installation instructions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/03 Release 1.3.0</summary>
|
||||
<ul>
|
||||
<li>Installation and compatibility optimizations
|
||||
<ul>
|
||||
<li>Resolved compatibility issues caused by <code>detectron2</code> by removing <code>layoutlmv3</code> usage in layout</li>
|
||||
<li>Extended torch version compatibility to 2.2~2.6 (excluding 2.5)</li>
|
||||
<li>Added CUDA compatibility for versions 11.8/12.4/12.6/12.8 (CUDA version determined by torch), solving compatibility issues for users with 50-series and H-series GPUs</li>
|
||||
<li>Extended Python compatibility to versions 3.10~3.12, fixing the issue of automatic downgrade to version 0.6.1 when installing in non-3.10 environments</li>
|
||||
<li>Optimized offline deployment process, eliminating the need to download any model files after successful deployment</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Performance optimizations
|
||||
<ul>
|
||||
<li>Enhanced parsing speed for batches of small files by supporting batch processing of multiple PDF files (<a href="demo/batch_demo.py">script example</a>), with formula parsing speed improved by up to 1400% and overall parsing speed improved by up to 500% compared to version 1.0.1</li>
|
||||
<li>Reduced memory usage and improved parsing speed by optimizing MFR model loading and usage (requires re-running the <a href="docs/how_to_download_models_zh_cn.md">model download process</a> to get incremental updates to model files)</li>
|
||||
<li>Optimized GPU memory usage, requiring only 6GB minimum to run this project</li>
|
||||
<li>Improved running speed on MPS devices</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Parsing effect optimizations
|
||||
<ul>
|
||||
<li>Updated MFR model to <code>unimernet(2503)</code>, fixing line break loss issues in multi-line formulas</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>Usability optimizations
|
||||
<ul>
|
||||
<li>Completely replaced the <code>paddle</code> framework and <code>paddleocr</code> in the project by using <code>paddleocr2torch</code>, resolving conflicts between <code>paddle</code> and <code>torch</code>, as well as thread safety issues caused by the <code>paddle</code> framework</li>
|
||||
<li>Added real-time progress bar display during parsing, allowing precise tracking of parsing progress and making the waiting process more bearable</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>2025/03/03 1.2.1 released</summary>
|
||||
<ul>
|
||||
<li>Fixed the impact on punctuation marks during full-width to half-width conversion of letters and numbers</li>
|
||||
<li>Fixed caption matching inaccuracies in certain scenarios</li>
|
||||
<li>Fixed formula span loss issues in certain scenarios</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/02/24 1.2.0 released</summary>
|
||||
<p>This version includes several fixes and improvements to enhance parsing efficiency and accuracy:</p>
|
||||
<ul>
|
||||
<li><strong>Performance Optimization</strong>
|
||||
<ul>
|
||||
<li>Increased classification speed for PDF documents in auto mode.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Parsing Optimization</strong>
|
||||
<ul>
|
||||
<li>Improved parsing logic for documents containing watermarks, significantly enhancing the parsing results for such documents.</li>
|
||||
<li>Enhanced the matching logic for multiple images/tables and captions within a single page, improving the accuracy of image-text matching in complex layouts.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Bug Fixes</strong>
|
||||
<ul>
|
||||
<li>Fixed an issue where image/table spans were incorrectly filled into text blocks under certain conditions.</li>
|
||||
<li>Resolved an issue where title blocks were empty in some cases.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/01/22 1.1.0 released</summary>
|
||||
<p>In this version we have focused on improving parsing accuracy and efficiency:</p>
|
||||
<ul>
|
||||
<li><strong>Model capability upgrade</strong> (requires re-executing the <a href="https://github.com/opendatalab/MinerU/blob/master/docs/how_to_download_models_en.md">model download process</a> to obtain incremental updates of model files)
|
||||
<ul>
|
||||
<li>The layout recognition model has been upgraded to the latest <code>doclayout_yolo(2501)</code> model, improving layout recognition accuracy.</li>
|
||||
<li>The formula parsing model has been upgraded to the latest <code>unimernet(2501)</code> model, improving formula recognition accuracy.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Performance optimization</strong>
|
||||
<ul>
|
||||
<li>On devices that meet certain configuration requirements (16GB+ VRAM), by optimizing resource usage and restructuring the processing pipeline, overall parsing speed has been increased by more than 50%.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Parsing effect optimization</strong>
|
||||
<ul>
|
||||
<li>Added a new heading classification feature (testing version, enabled by default) to the online demo (<a href="https://mineru.net/OpenSourceTools/Extractor">mineru.net</a>/<a href="https://huggingface.co/spaces/opendatalab/MinerU">huggingface</a>/<a href="https://www.modelscope.cn/studios/OpenDataLab/MinerU">modelscope</a>), which supports hierarchical classification of headings, thereby enhancing document structuring.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/01/10 1.0.1 released</summary>
|
||||
<p>This is our first official release, where we have introduced a completely new API interface and enhanced compatibility through extensive refactoring, as well as a brand new automatic language identification feature:</p>
|
||||
<ul>
|
||||
<li><strong>New API Interface</strong>
|
||||
<ul>
|
||||
<li>For the data-side API, we have introduced the Dataset class, designed to provide a robust and flexible data processing framework. This framework currently supports a variety of document formats, including images (.jpg and .png), PDFs, Word documents (.doc and .docx), and PowerPoint presentations (.ppt and .pptx). It ensures effective support for data processing tasks ranging from simple to complex.</li>
|
||||
<li>For the user-side API, we have meticulously designed the MinerU processing workflow as a series of composable Stages. Each Stage represents a specific processing step, allowing users to define new Stages according to their needs and creatively combine these stages to customize their data processing workflows.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Enhanced Compatibility</strong>
|
||||
<ul>
|
||||
<li>By optimizing the dependency environment and configuration items, we ensure stable and efficient operation on ARM architecture Linux systems.</li>
|
||||
<li>We have deeply integrated with Huawei Ascend NPU acceleration, providing autonomous and controllable high-performance computing capabilities. This supports the localization and development of AI application platforms in China. <a href="https://github.com/opendatalab/MinerU/blob/master/docs/README_Ascend_NPU_Acceleration_zh_CN.md">Ascend NPU Acceleration</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Automatic Language Identification</strong>
|
||||
<ul>
|
||||
<li>By introducing a new language recognition model, setting the <code>lang</code> configuration to <code>auto</code> during document parsing will automatically select the appropriate OCR language model, improving the accuracy of scanned document parsing.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/22 0.10.0 released</summary>
|
||||
<p>Introducing hybrid OCR text extraction capabilities:</p>
|
||||
<ul>
|
||||
<li>Significantly improved parsing performance in complex text distribution scenarios such as dense formulas, irregular span regions, and text represented by images.</li>
|
||||
<li>Combines the dual advantages of accurate content extraction and faster speed in text mode, and more precise span/line region recognition in OCR mode.</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/15 0.9.3 released</summary>
|
||||
<p>Integrated <a href="https://github.com/RapidAI/RapidTable">RapidTable</a> for table recognition, improving single-table parsing speed by more than 10 times, with higher accuracy and lower GPU memory usage.</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/06 0.9.2 released</summary>
|
||||
<p>Integrated the <a href="https://huggingface.co/U4R/StructTable-InternVL2-1B">StructTable-InternVL2-1B</a> model for table recognition functionality.</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/10/31 0.9.0 released</summary>
|
||||
<p>This is a major new version with extensive code refactoring, addressing numerous issues, improving performance, reducing hardware requirements, and enhancing usability:</p>
|
||||
<ul>
|
||||
<li>Refactored the sorting module code to use <a href="https://github.com/ppaanngggg/layoutreader">layoutreader</a> for reading order sorting, ensuring high accuracy in various layouts.</li>
|
||||
<li>Refactored the paragraph concatenation module to achieve good results in cross-column, cross-page, cross-figure, and cross-table scenarios.</li>
|
||||
<li>Refactored the list and table of contents recognition functions, significantly improving the accuracy of list blocks and table of contents blocks, as well as the parsing of corresponding text paragraphs.</li>
|
||||
<li>Refactored the matching logic for figures, tables, and descriptive text, greatly enhancing the accuracy of matching captions and footnotes to figures and tables, and reducing the loss rate of descriptive text to near zero.</li>
|
||||
<li>Added multi-language support for OCR, supporting detection and recognition of 84 languages. For the list of supported languages, see <a href="https://paddlepaddle.github.io/PaddleOCR/latest/en/ppocr/blog/multi_languages.html#5-support-languages-and-abbreviations">OCR Language Support List</a>.</li>
|
||||
<li>Added memory recycling logic and other memory optimization measures, significantly reducing memory usage. The memory requirement for enabling all acceleration features except table acceleration (layout/formula/OCR) has been reduced from 16GB to 8GB, and the memory requirement for enabling all acceleration features has been reduced from 24GB to 10GB.</li>
|
||||
<li>Optimized configuration file feature switches, adding an independent formula detection switch to significantly improve speed and parsing results when formula detection is not needed.</li>
|
||||
<li>Integrated <a href="https://github.com/opendatalab/PDF-Extract-Kit">PDF-Extract-Kit 1.0</a>:
|
||||
<ul>
|
||||
<li>Added the self-developed <code>doclayout_yolo</code> model, which speeds up processing by more than 10 times compared to the original solution while maintaining similar parsing effects, and can be freely switched with <code>layoutlmv3</code> via the configuration file.</li>
|
||||
<li>Upgraded formula parsing to <code>unimernet 0.2.1</code>, improving formula parsing accuracy while significantly reducing memory usage.</li>
|
||||
<li>Due to the repository change for <code>PDF-Extract-Kit 1.0</code>, you need to re-download the model. Please refer to <a href="https://github.com/opendatalab/MinerU/blob/master/docs/how_to_download_models_en.md">How to Download Models</a> for detailed steps.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/09/27 Version 0.8.1 released</summary>
|
||||
<p>Fixed some bugs, and providing a <a href="https://github.com/opendatalab/MinerU/blob/master/projects/web_demo/README.md">localized deployment version</a> of the <a href="https://opendatalab.com/OpenSourceTools/Extractor/PDF/">online demo</a> and the <a href="https://github.com/opendatalab/MinerU/blob/master/projects/web/README.md">front-end interface</a>.</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/09/09 Version 0.8.0 released</summary>
|
||||
<p>Supporting fast deployment with Dockerfile, and launching demos on Huggingface and Modelscope.</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/30 Version 0.7.1 released</summary>
|
||||
<p>Add paddle tablemaster table recognition option</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/09 Version 0.7.0b1 released</summary>
|
||||
<p>Simplified installation process, added table recognition functionality</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/01 Version 0.6.2b1 released</summary>
|
||||
<p>Optimized dependency conflict issues and installation documentation</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/07/05 Initial open-source release</summary>
|
||||
</details>
|
||||
</details>
|
||||
|
||||
# MinerU
|
||||
|
||||
@@ -103,7 +422,7 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
|
||||
- Automatically recognize and convert formulas in the document to LaTeX format.
|
||||
- Automatically recognize and convert tables in the document to HTML format.
|
||||
- Automatically detect scanned PDFs and garbled PDFs and enable OCR functionality.
|
||||
- OCR supports detection and recognition of 109 languages.
|
||||
- OCR supports detection and recognition of 84 languages.
|
||||
- Supports multiple output formats, such as multimodal and NLP Markdown, JSON sorted by reading order, and rich intermediate formats.
|
||||
- Supports various visualization results, including layout visualization and span visualization, for efficient confirmation of output quality.
|
||||
- Supports running in a pure CPU environment, and also supports GPU(CUDA)/NPU(CANN)/MPS acceleration
|
||||
@@ -140,97 +459,61 @@ A WebUI developed based on Gradio, with a simple interface and only core parsing
|
||||
> 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>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">Parsing Backend</th>
|
||||
<th rowspan="2">pipeline</th>
|
||||
<th colspan="2">*-auto-engine</th>
|
||||
<th colspan="2">*-http-client</th>
|
||||
<td>Parsing Backend</td>
|
||||
<td>pipeline</td>
|
||||
<td>vlm-transformers</td>
|
||||
<td>vlm-sglang</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>hybrid</th>
|
||||
<th>vlm</th>
|
||||
<th>hybrid</th>
|
||||
<th>vlm</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Backend Features</th>
|
||||
<td >Good Compatibility</td>
|
||||
<td colspan="2">High Hardware Requirements</td>
|
||||
<td colspan="2">For OpenAI Compatible Servers<sup>2</sup></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Accuracy<sup>1</sup></th>
|
||||
<td style="text-align:center;">82+</td>
|
||||
<td colspan="4" style="text-align:center;">90+</td>
|
||||
<td>Operating System</td>
|
||||
<td>Linux / Windows / macOS</td>
|
||||
<td>Linux / Windows</td>
|
||||
<td>Linux / Windows (via WSL2)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Operating System</th>
|
||||
<td colspan="5" style="text-align:center;">Linux<sup>3</sup> / Windows<sup>4</sup> / macOS<sup>5</sup></td>
|
||||
<td>CPU Inference Support</td>
|
||||
<td>✅</td>
|
||||
<td colspan="2">❌</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pure CPU Support</th>
|
||||
<td style="text-align:center;">✅</td>
|
||||
<td colspan="2" style="text-align:center;">❌</td>
|
||||
<td colspan="2" style="text-align:center;">✅</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>GPU Acceleration</th>
|
||||
<td colspan="4" style="text-align:center;">Volta and later architecture GPUs or Apple Silicon</td>
|
||||
<td rowspan="2">Not Required</td>
|
||||
<td>GPU Requirements</td>
|
||||
<td>Turing architecture and later, 6GB+ VRAM or Apple Silicon</td>
|
||||
<td colspan="2">Turing architecture and later, 8GB+ VRAM</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Min VRAM</th>
|
||||
<td style="text-align:center;">4GB</td>
|
||||
<td style="text-align:center;">8GB</td>
|
||||
<td style="text-align:center;">8GB</td>
|
||||
<td style="text-align:center;">2GB</td>
|
||||
<td>Memory Requirements</td>
|
||||
<td colspan="3">Minimum 16GB+, recommended 32GB+</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>RAM</th>
|
||||
<td colspan="3" style="text-align:center;">Min 8GB, Recommended 16GB or more</td>
|
||||
<td colspan="2" style="text-align:center;">Min 8GB</td>
|
||||
<td>Disk Space Requirements</td>
|
||||
<td colspan="3">20GB+, SSD recommended</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Disk Space</th>
|
||||
<td colspan="3" style="text-align:center;">Min 20GB, SSD Recommended</td>
|
||||
<td colspan="2" style="text-align:center;">Min 2GB</td>
|
||||
<td>Python Version</td>
|
||||
<td colspan="3">3.10-3.13</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Python Version</th>
|
||||
<td colspan="5" style="text-align:center;">3.10-3.13</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<sup>1</sup> Accuracy metrics are the End-to-End Evaluation Overall scores from OmniDocBench (v1.5), based on the latest version of `MinerU`.
|
||||
<sup>2</sup> Servers compatible with OpenAI API, such as local model servers or remote model services deployed via inference frameworks like `vLLM`/`SGLang`/`LMDeploy`.
|
||||
<sup>3</sup> Linux only supports distributions from 2019 and later.
|
||||
<sup>4</sup> Since the key dependency `ray` does not support Python 3.13 on Windows, only versions 3.10~3.12 are supported.
|
||||
<sup>5</sup> macOS requires version 14.0 or later.
|
||||
|
||||
|
||||
### Install MinerU
|
||||
|
||||
#### Install MinerU using pip or uv
|
||||
```bash
|
||||
pip install --upgrade pip
|
||||
pip install uv
|
||||
uv pip install -U "mineru[all]"
|
||||
uv pip install -U "mineru[core]"
|
||||
```
|
||||
|
||||
#### Install MinerU from source code
|
||||
```bash
|
||||
git clone https://github.com/opendatalab/MinerU.git
|
||||
cd MinerU
|
||||
uv pip install -e .[all]
|
||||
uv pip install -e .[core]
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> `mineru[all]` includes all core features, compatible with Windows / Linux / macOS systems, suitable for most users.
|
||||
> If you need to specify the inference framework for the VLM model, or only intend to install a lightweight client on an edge device, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).
|
||||
> `mineru[core]` includes all core features except `sglang` acceleration, compatible with Windows / Linux / macOS systems, suitable for most users.
|
||||
> If you need to use `sglang` acceleration for VLM model inference or install a lightweight client on edge devices, please refer to the documentation [Extension Modules Installation Guide](https://opendatalab.github.io/MinerU/quick_start/extension_modules/).
|
||||
|
||||
---
|
||||
|
||||
@@ -242,15 +525,10 @@ You can get the [Docker Deployment Instructions](https://opendatalab.github.io/M
|
||||
|
||||
### Using MinerU
|
||||
|
||||
|
||||
If your device meets the GPU acceleration requirements in the table above, you can use a simple command line for document parsing:
|
||||
The simplest command line invocation is:
|
||||
```bash
|
||||
mineru -p <input_path> -o <output_path>
|
||||
```
|
||||
If your device does not meet the GPU acceleration requirements, you can specify the backend as `pipeline` to run in a pure CPU environment:
|
||||
```bash
|
||||
mineru -p <input_path> -o <output_path> -b pipeline
|
||||
```
|
||||
|
||||
You can use MinerU for PDF parsing through various methods such as command line, API, and WebUI. For detailed instructions, please refer to the [Usage Guide](https://opendatalab.github.io/MinerU/usage/).
|
||||
|
||||
@@ -263,8 +541,8 @@ You can use MinerU for PDF parsing through various methods such as command line,
|
||||
- [x] Handwritten Text Recognition
|
||||
- [x] Vertical Text Recognition
|
||||
- [x] Latin Accent Mark Recognition
|
||||
- [x] Code block recognition in the main text
|
||||
- [x] [Chemical formula recognition](docs/chemical_knowledge_introduction/introduction.pdf)(mineru.net)
|
||||
- [ ] Code block recognition in the main text
|
||||
- [ ] [Chemical formula recognition](docs/chemical_knowledge_introduction/introduction.pdf)
|
||||
- [ ] Geometric shape recognition
|
||||
|
||||
# Known Issues
|
||||
@@ -282,7 +560,7 @@ You can use MinerU for PDF parsing through various methods such as command line,
|
||||
|
||||
- If you encounter any issues during usage, you can first check the [FAQ](https://opendatalab.github.io/MinerU/faq/) for solutions.
|
||||
- If your issue remains unresolved, you may also use [DeepWiki](https://deepwiki.com/opendatalab/MinerU) to interact with an AI assistant, which can address most common problems.
|
||||
- If you still cannot resolve the issue, you are welcome to join our community via [Discord](https://discord.gg/Tdedn9GTXq) or [WeChat](https://mineru.net/community-portal/?aliasId=3c430f94) to discuss with other users and developers.
|
||||
- If you still cannot resolve the issue, you are welcome to join our community via [Discord](https://discord.gg/Tdedn9GTXq) or [WeChat](http://mineru.space/s/V85Yl) to discuss with other users and developers.
|
||||
|
||||
# All Thanks To Our Contributors
|
||||
|
||||
@@ -294,36 +572,27 @@ You can use MinerU for PDF parsing through various methods such as command line,
|
||||
|
||||
[LICENSE.md](LICENSE.md)
|
||||
|
||||
The source code in this repository is licensed under Apache License 2.0.
|
||||
Currently, some models in this project are trained based on YOLO. However, since YOLO follows the AGPL license, it may impose restrictions on certain use cases. In future iterations, we plan to explore and replace these with models under more permissive licenses to enhance user-friendliness and flexibility.
|
||||
|
||||
# Acknowledgments
|
||||
|
||||
- [PDF-Extract-Kit](https://github.com/opendatalab/PDF-Extract-Kit)
|
||||
- [DocLayout-YOLO](https://github.com/opendatalab/DocLayout-YOLO)
|
||||
- [UniMERNet](https://github.com/opendatalab/UniMERNet)
|
||||
- [TableStructureRec](https://github.com/RapidAI/TableStructureRec)
|
||||
- [RapidTable](https://github.com/RapidAI/RapidTable)
|
||||
- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
|
||||
- [PaddleOCR2Pytorch](https://github.com/frotms/PaddleOCR2Pytorch)
|
||||
- [layoutreader](https://github.com/ppaanngggg/layoutreader)
|
||||
- [xy-cut](https://github.com/Sanster/xy-cut)
|
||||
- [fast-langdetect](https://github.com/LlmKira/fast-langdetect)
|
||||
- [pypdfium2](https://github.com/pypdfium2-team/pypdfium2)
|
||||
- [pdftext](https://github.com/datalab-to/pdftext)
|
||||
- [pdfminer.six](https://github.com/pdfminer/pdfminer.six)
|
||||
- [pypdf](https://github.com/py-pdf/pypdf)
|
||||
- [magika](https://github.com/google/magika)
|
||||
- [vLLM](https://github.com/vllm-project/vllm)
|
||||
- [LMDeploy](https://github.com/InternLM/lmdeploy)
|
||||
|
||||
# Citation
|
||||
|
||||
```bibtex
|
||||
@misc{niu2025mineru25decoupledvisionlanguagemodel,
|
||||
title={MinerU2.5: A Decoupled Vision-Language Model for Efficient High-Resolution Document Parsing},
|
||||
author={Junbo Niu and Zheng Liu and Zhuangcheng Gu and Bin Wang and Linke Ouyang and Zhiyuan Zhao and Tao Chu and Tianyao He and Fan Wu and Qintong Zhang and Zhenjiang Jin and Guang Liang and Rui Zhang and Wenzheng Zhang and Yuan Qu and Zhifei Ren and Yuefeng Sun and Yuanhong Zheng and Dongsheng Ma and Zirui Tang and Boyu Niu and Ziyang Miao and Hejun Dong and Siyi Qian and Junyuan Zhang and Jingzhou Chen and Fangdong Wang and Xiaomeng Zhao and Liqun Wei and Wei Li and Shasha Wang and Ruiliang Xu and Yuanyuan Cao and Lu Chen and Qianqian Wu and Huaiyu Gu and Lindong Lu and Keming Wang and Dechen Lin and Guanlin Shen and Xuanhe Zhou and Linfeng Zhang and Yuhang Zang and Xiaoyi Dong and Jiaqi Wang and Bo Zhang and Lei Bai and Pei Chu and Weijia Li and Jiang Wu and Lijun Wu and Zhenxiang Li and Guangyu Wang and Zhongying Tu and Chao Xu and Kai Chen and Yu Qiao and Bowen Zhou and Dahua Lin and Wentao Zhang and Conghui He},
|
||||
year={2025},
|
||||
eprint={2509.22186},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CV},
|
||||
url={https://arxiv.org/abs/2509.22186},
|
||||
}
|
||||
|
||||
@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},
|
||||
@@ -362,4 +631,3 @@ The source code in this repository is licensed under Apache License 2.0.
|
||||
- [OmniDocBench (A Comprehensive Benchmark for Document Parsing and Evaluation)](https://github.com/opendatalab/OmniDocBench)
|
||||
- [Magic-HTML (Mixed web page extraction tool)](https://github.com/opendatalab/magic-html)
|
||||
- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)
|
||||
- [Dingo: A Comprehensive AI Data Quality Evaluation Tool](https://github.com/MigoXLab/dingo)
|
||||
|
||||
524
README_zh-CN.md
@@ -1,7 +1,7 @@
|
||||
<div align="center" xmlns="http://www.w3.org/1999/html">
|
||||
<!-- logo -->
|
||||
<p align="center">
|
||||
<img src="https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">
|
||||
<img src="docs/images/MinerU-logo.png" width="300px" style="vertical-align:middle;">
|
||||
</p>
|
||||
|
||||
<!-- icon -->
|
||||
@@ -17,9 +17,8 @@
|
||||
[](https://mineru.net/OpenSourceTools/Extractor?source=github)
|
||||
[](https://www.modelscope.cn/studios/OpenDataLab/MinerU)
|
||||
[](https://huggingface.co/spaces/opendatalab/MinerU)
|
||||
[](https://colab.research.google.com/gist/myhloli/a3cb16570ab3cfeadf9d8f0ac91b4fca/mineru_demo.ipynb)
|
||||
[](https://arxiv.org/abs/2409.18839)
|
||||
[](https://arxiv.org/abs/2509.22186)
|
||||
[](https://colab.research.google.com/gist/myhloli/3b3a00a4a0a61577b6c30f989092d20d/mineru_demo.ipynb)
|
||||
[](https://arxiv.org/abs/2409.18839)
|
||||
[](https://deepwiki.com/opendatalab/MinerU)
|
||||
|
||||
|
||||
@@ -38,51 +37,359 @@
|
||||
<!-- join us -->
|
||||
|
||||
<p align="center">
|
||||
👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="https://mineru.net/community-portal/?aliasId=3c430f94" target="_blank">WeChat</a>
|
||||
👋 join us on <a href="https://discord.gg/Tdedn9GTXq" target="_blank">Discord</a> and <a href="http://mineru.space/s/V85Yl" target="_blank">WeChat</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
# 更新记录
|
||||
- 2025/07/16 2.1.1发布
|
||||
- bug修复
|
||||
- 修复`pipeline`在某些情况可能发生的文本块内容丢失问题 #3005
|
||||
- 修复`sglang-client`需要安装`torch`等不必要的包的问题 #2968
|
||||
- 更新`dockerfile`以修复linux字体缺失导致的解析文本内容不完整问题 #2915
|
||||
- 易用性更新
|
||||
- 更新`compose.yaml`,便于用户直接启动`sglang-server`、`mineru-api`、`mineru-gradio`服务
|
||||
- 启用全新的[在线文档站点](https://opendatalab.github.io/MinerU/zh/),简化readme,提供更好的文档体验
|
||||
- 2025/07/05 2.1.0发布
|
||||
- 这是 MinerU 2 的第一个大版本更新,包含了大量新功能和改进,包含众多性能优化、体验优化和bug修复,具体更新内容如下:
|
||||
- 性能优化:
|
||||
- 大幅提升某些特定分辨率(长边2000像素左右)文档的预处理速度
|
||||
- 大幅提升`pipeline`后端批量处理大量页数较少(<10)文档时的后处理速度
|
||||
- `pipeline`后端的layout分析速度提升约20%
|
||||
- 体验优化:
|
||||
- 内置开箱即用的`fastapi服务`和`gradio webui`,详细使用方法请参考[文档](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#apiwebuisglang-clientserver)
|
||||
- `sglang`适配`0.4.8`版本,大幅降低`vlm-sglang`后端的显存要求,最低可在`8G显存`(Turing及以后架构)的显卡上运行
|
||||
- 对所有命令增加`sglang`的参数透传,使得`sglang-engine`后端可以与`sglang-server`一致,接收`sglang`的所有参数
|
||||
- 支持基于配置文件的功能扩展,包含`自定义公式标识符`、`开启标题分级功能`、`自定义本地模型目录`,详细使用方法请参考[文档](https://opendatalab.github.io/MinerU/zh/usage/quick_usage/#mineru_1)
|
||||
- 新特性:
|
||||
- `pipeline`后端更新 PP-OCRv5 多语种文本识别模型,支持法语、西班牙语、葡萄牙语、俄语、韩语等 37 种语言的文字识别,平均精度涨幅超30%。[详情](https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/algorithm/PP-OCRv5/PP-OCRv5_multi_languages.html)
|
||||
- `pipeline`后端增加对竖排文本的有限支持
|
||||
|
||||
- 2026/02/06 2.7.6 发布
|
||||
- 新增国产算力平台昆仑芯、太初元碁的适配支持,目前已由官方和厂商适配并支持的国产算力平台包括:
|
||||
- [昇腾 Ascend](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Ascend)
|
||||
- [平头哥 T-Head](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/THead)
|
||||
- [沐曦 METAX](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/METAX)
|
||||
- [海光 Hygon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Hygon/)
|
||||
- [燧原 Enflame](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Enflame/)
|
||||
- [摩尔线程 MooreThreads](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/MooreThreads/)
|
||||
- [天数智芯 IluvatarCorex](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/IluvatarCorex/)
|
||||
- [寒武纪 Cambricon](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Cambricon/)
|
||||
- [昆仑芯 Kunlunxin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Kunlunxin/)
|
||||
- [太初元碁 Tecorigin](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Tecorigin/)
|
||||
- [壁仞 Biren](https://opendatalab.github.io/MinerU/zh/usage/acceleration_cards/Biren/)
|
||||
- MinerU 持续兼容国产硬件平台,支持主流芯片架构。以安全可靠的技术,助力科研、政企用户迈向文档数字化新高度!
|
||||
|
||||
- 2026/01/30 2.7.4 发布
|
||||
- 新增国产算力平台天数智芯、寒武纪的适配支持。
|
||||
|
||||
- 2026/01/23 2.7.2 发布
|
||||
- 新增国产算力平台海光、燧原、摩尔线程的适配支持
|
||||
- 跨页表合并优化,提升合并成功率与合并效果
|
||||
|
||||
- 2026/01/06 2.7.1 发布
|
||||
- fix bug: #4300
|
||||
- 更新pdfminer.six的依赖版本以解决 [CVE-2025-64512](https://github.com/advisories/GHSA-wf5f-4jwr-ppcp)
|
||||
- 支持输入图像的exif方向自动校正,提升OCR识别效果 #4283
|
||||
|
||||
- 2025/12/30 2.7.0 发布
|
||||
- 简化安装流程,现在不再需要单独安装`vlm`加速引擎依赖包,安装时使用`uv pip install mineru[all]`即可安装所有可选后端的依赖包。
|
||||
- 增加全新后端`hybrid`,该后端结合了`pipeline`和`vlm`后端的优势,在vlm的基础上,融入了pipeline的部分能力,在高精度的基础上增加了额外的扩展性:
|
||||
- 从文本pdf中直接抽取文本,在文本pdf场景原生支持多语言识别,并极大减少解析幻觉;
|
||||
- 通过指定ocr语言,在扫描pdf场景下支持109种语言的文本识别;
|
||||
- 独立的行内公式识别开关,在不需要行内公式识别的场景下可单独关闭,提升解析结果视觉效果。
|
||||
- 简化`vlm/hybrid`后端的引擎选择逻辑,用户只需指定后端为`*-auto-engine`,系统会根据当前环境自动选择合适的引擎进行推理加速,提升易用性.
|
||||
- 默认解析后端从`pipeline`切换至`hybrid-auto-engine`,提升新用户开箱即用的结果一致性,避免出现解析结果认知差异。
|
||||
- gradio应用增加i18n适配,支持中英文两种语言切换。
|
||||
|
||||
> 📝 查看完整的 [更新日志](https://opendatalab.github.io/MinerU/zh/reference/changelog/) 了解更多历史版本信息
|
||||
<details>
|
||||
<summary>历史日志</summary>
|
||||
<details>
|
||||
<summary>2025/06/20 2.0.6发布</summary>
|
||||
<ul>
|
||||
<li>修复<code>vlm</code>模式下,某些偶发的无效块内容导致解析中断问题</li>
|
||||
<li>修复<code>vlm</code>模式下,某些不完整的表结构导致的解析中断问题</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/06/17 2.0.5发布</summary>
|
||||
<ul>
|
||||
<li>修复了<code>sglang-client</code>模式下依然需要下载模型的问题</li>
|
||||
<li>修复了<code>sglang-client</code>模式需要依赖<code>torch</code>等实际运行不需要的包的问题</li>
|
||||
<li>修复了同一进程内尝试通过多个url启动多个<code>sglang-client</code>实例时,只有第一个生效的问题</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/06/15 2.0.3发布</summary>
|
||||
<ul>
|
||||
<li>修复了当下载模型类型设置为<code>all</code>时,配置文件出现键值更新错误的问题</li>
|
||||
<li>修复了命令行模式下公式和表格功能开关不生效导致功能无法关闭的问题</li>
|
||||
<li>修复了<code>sglang-engine</code>模式下,0.4.7版本sglang的兼容性问题</li>
|
||||
<li>更新了sglang环境下部署完整版MinerU的Dockerfile和相关安装文档</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/06/13 2.0.0发布</summary>
|
||||
<ul>
|
||||
<li><strong>全新架构</strong>:MinerU 2.0 在代码结构和交互方式上进行了深度重构,显著提升了系统的易用性、可维护性与扩展能力。
|
||||
<ul>
|
||||
<li><strong>去除第三方依赖限制</strong>:彻底移除对 <code>pymupdf</code> 的依赖,推动项目向更开放、合规的开源方向迈进。</li>
|
||||
<li><strong>开箱即用,配置便捷</strong>:无需手动编辑 JSON 配置文件,绝大多数参数已支持命令行或 API 直接设置。</li>
|
||||
<li><strong>模型自动管理</strong>:新增模型自动下载与更新机制,用户无需手动干预即可完成模型部署。</li>
|
||||
<li><strong>离线部署友好</strong>:提供内置模型下载命令,支持完全断网环境下的部署需求。</li>
|
||||
<li><strong>代码结构精简</strong>:移除数千行冗余代码,简化类继承逻辑,显著提升代码可读性与开发效率。</li>
|
||||
<li><strong>统一中间格式输出</strong>:采用标准化的 <code>middle_json</code> 格式,兼容多数基于该格式的二次开发场景,确保生态业务无缝迁移。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>全新模型</strong>:MinerU 2.0 集成了我们最新研发的小参数量、高性能多模态文档解析模型,实现端到端的高速、高精度文档理解。
|
||||
<ul>
|
||||
<li><strong>小模型,大能力</strong>:模型参数不足 1B,却在解析精度上超越传统 72B 级别的视觉语言模型(VLM)。</li>
|
||||
<li><strong>多功能合一</strong>:单模型覆盖多语言识别、手写识别、版面分析、表格解析、公式识别、阅读顺序排序等核心任务。</li>
|
||||
<li><strong>极致推理速度</strong>:在单卡 NVIDIA 4090 上通过 <code>sglang</code> 加速,达到峰值吞吐量超过 10,000 token/s,轻松应对大规模文档处理需求。</li>
|
||||
<li><strong>在线体验</strong>:您可以在<a href="https://mineru.net/OpenSourceTools/Extractor">MinerU.net</a>、<a href="https://huggingface.co/spaces/opendatalab/MinerU">Hugging Face</a>, 以及<a href="https://www.modelscope.cn/studios/OpenDataLab/MinerU">ModelScope</a>体验我们的全新VLM模型</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>不兼容变更说明</strong>:为提升整体架构合理性与长期可维护性,本版本包含部分不兼容的变更:
|
||||
<ul>
|
||||
<li>Python 包名从 <code>magic-pdf</code> 更改为 <code>mineru</code>,命令行工具也由 <code>magic-pdf</code> 改为 <code>mineru</code>,请同步更新脚本与调用命令。</li>
|
||||
<li>出于对系统模块化设计与生态一致性的考虑,MinerU 2.0 已不再内置 LibreOffice 文档转换模块。如需处理 Office 文档,建议通过独立部署的 LibreOffice 服务先行转换为 PDF 格式,再进行后续解析操作。</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<details>
|
||||
<summary>2025/05/24 1.3.12 发布</summary>
|
||||
<ul>
|
||||
<li>增加ppocrv5模型的支持,将<code>ch_server</code>模型更新为<code>PP-OCRv5_rec_server</code>,<code>ch_lite</code>模型更新为<code>PP-OCRv5_rec_mobile</code>(需更新模型)
|
||||
<ul>
|
||||
<li>在测试中,发现ppocrv5(server)对手写文档效果有一定提升,但在其余类别文档的精度略差于v4_server_doc,因此默认的ch模型保持不变,仍为<code>PP-OCRv4_server_rec_doc</code>。</li>
|
||||
<li>由于ppocrv5强化了手写场景和特殊字符的识别能力,因此您可以在日繁混合场景以及手写文档场景下手动选择使用ppocrv5模型</li>
|
||||
<li>您可通过lang参数<code>lang='ch_server'</code>(python api)或<code>--lang ch_server</code>(命令行)自行选择相应的模型:
|
||||
<ul>
|
||||
<li><code>ch</code> :<code>PP-OCRv4_rec_server_doc</code>(默认)(中英日繁混合/1.5w字典)</li>
|
||||
<li><code>ch_server</code> :<code>PP-OCRv5_rec_server</code>(中英日繁混合+手写场景/1.8w字典)</li>
|
||||
<li><code>ch_lite</code> :<code>PP-OCRv5_rec_mobile</code>(中英日繁混合+手写场景/1.8w字典)</li>
|
||||
<li><code>ch_server_v4</code> :<code>PP-OCRv4_rec_server</code>(中英混合/6k字典)</li>
|
||||
<li><code>ch_lite_v4</code> :<code>PP-OCRv4_rec_mobile</code>(中英混合/6k字典)</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>增加手写文档的支持,通过优化layout对手写文本区域的识别,现已支持手写文档的解析
|
||||
<ul>
|
||||
<li>默认支持此功能,无需额外配置</li>
|
||||
<li>可以参考上述说明,手动选择ppocrv5模型以获得更好的手写文档解析效果</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><code>huggingface</code>和<code>modelscope</code>的demo已更新为支持手写识别和ppocrv5模型的版本,可自行在线体验</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/29 1.3.10 发布</summary>
|
||||
<ul>
|
||||
<li>支持使用自定义公式标识符,可通过修改用户目录下的<code>magic-pdf.json</code>文件中的<code>latex-delimiter-config</code>项实现。</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/27 1.3.9 发布</summary>
|
||||
<ul>
|
||||
<li>优化公式解析功能,提升公式渲染的成功率</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/23 1.3.8 发布</summary>
|
||||
<ul>
|
||||
<li><code>ocr</code>默认模型(<code>ch</code>)更新为<code>PP-OCRv4_server_rec_doc</code>(需更新模型)
|
||||
<ul>
|
||||
<li><code>PP-OCRv4_server_rec_doc</code>是在<code>PP-OCRv4_server_rec</code>的基础上,在更多中文文档数据和PP-OCR训练数据的混合数据训练而成,增加了部分繁体字、日文、特殊字符的识别能力,可支持识别的字符为1.5万+,除文档相关的文字识别能力提升外,也同时提升了通用文字的识别能力。</li>
|
||||
<li><a href="https://paddlepaddle.github.io/PaddleX/latest/module_usage/tutorials/ocr_modules/text_recognition.html#_3">PP-OCRv4_server_rec_doc/PP-OCRv4_server_rec/PP-OCRv4_mobile_rec 性能对比</a></li>
|
||||
<li>经验证,<code>PP-OCRv4_server_rec_doc</code>模型在<code>中英日繁</code>单种语言或多种语言混合场景均有明显精度提升,且速度与<code>PP-OCRv4_server_rec</code>相当,适合绝大部分场景使用。</li>
|
||||
<li><code>PP-OCRv4_server_rec_doc</code>在小部分纯英文场景可能会发生单词粘连问题,<code>PP-OCRv4_server_rec</code>则在此场景下表现更好,因此我们保留了<code>PP-OCRv4_server_rec</code>模型,用户可通过增加参数<code>lang='ch_server'</code>(python api)或<code>--lang ch_server</code>(命令行)调用。</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/22 1.3.7 发布</summary>
|
||||
<ul>
|
||||
<li>修复表格解析模型初始化时lang参数失效的问题</li>
|
||||
<li>修复在<code>cpu</code>模式下ocr和表格解析速度大幅下降的问题</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/16 1.3.4 发布</summary>
|
||||
<ul>
|
||||
<li>通过移除一些无用的块,小幅提升了ocr-det的速度</li>
|
||||
<li>修复部分情况下由footnote导致的页面内排序错误</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/12 1.3.2 发布</summary>
|
||||
<ul>
|
||||
<li>修复了windows系统下,在python3.13环境安装时一些依赖包版本不兼容的问题</li>
|
||||
<li>优化批量推理时的内存占用</li>
|
||||
<li>优化旋转90度表格的解析效果</li>
|
||||
<li>优化财报样本中超大表格的解析效果</li>
|
||||
<li>修复了在未指定OCR语言时,英文文本区域偶尔出现的单词黏连问题(需要更新模型)</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/08 1.3.1 发布</summary>
|
||||
<ul>
|
||||
<li>修复了一些兼容问题
|
||||
<ul>
|
||||
<li>支持python 3.13</li>
|
||||
<li>为部分过时的linux系统(如centos7)做出最后适配,并不再保证后续版本的继续支持,<a href="https://github.com/opendatalab/MinerU/issues/1004">安装说明</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/04/03 1.3.0 发布</summary>
|
||||
<ul>
|
||||
<li>安装与兼容性优化
|
||||
<ul>
|
||||
<li>通过移除layout中<code>layoutlmv3</code>的使用,解决了由<code>detectron2</code>导致的兼容问题</li>
|
||||
<li>torch版本兼容扩展到2.2~2.6(2.5除外)</li>
|
||||
<li>cuda兼容支持11.8/12.4/12.6/12.8(cuda版本由torch决定),解决部分用户50系显卡与H系显卡的兼容问题</li>
|
||||
<li>python兼容版本扩展到3.10~3.12,解决了在非3.10环境下安装时自动降级到0.6.1的问题</li>
|
||||
<li>优化离线部署流程,部署成功后不需要联网下载任何模型文件</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>性能优化
|
||||
<ul>
|
||||
<li>通过支持多个pdf文件的batch处理(<a href="demo/batch_demo.py">脚本样例</a>),提升了批量小文件的解析速度 (与1.0.1版本相比,公式解析速度最高提升超过1400%,整体解析速度最高提升超过500%)</li>
|
||||
<li>通过优化mfr模型的加载和使用,降低了显存占用并提升了解析速度(需重新执行<a href="docs/how_to_download_models_zh_cn.md">模型下载流程</a>以获得模型文件的增量更新)</li>
|
||||
<li>优化显存占用,最低仅需6GB即可运行本项目</li>
|
||||
<li>优化了在mps设备上的运行速度</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>解析效果优化
|
||||
<ul>
|
||||
<li>mfr模型更新到<code>unimernet(2503)</code>,解决多行公式中换行丢失的问题</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>易用性优化
|
||||
<ul>
|
||||
<li>通过使用<code>paddleocr2torch</code>,完全替代<code>paddle</code>框架以及<code>paddleocr</code>在项目中的使用,解决了<code>paddle</code>和<code>torch</code>的冲突问题,和由于<code>paddle</code>框架导致的线程不安全问题</li>
|
||||
<li>解析过程增加实时进度条显示,精准把握解析进度,让等待不再痛苦</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/03/03 1.2.1 发布,修复了一些问题</summary>
|
||||
<ul>
|
||||
<li>修复在字母与数字的全角转半角操作时对标点符号的影响</li>
|
||||
<li>修复在某些情况下caption的匹配不准确问题</li>
|
||||
<li>修复在某些情况下的公式span丢失问题</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/02/24 1.2.0 发布,这个版本我们修复了一些问题,提升了解析的效率与精度:</summary>
|
||||
<ul>
|
||||
<li>性能优化
|
||||
<ul>
|
||||
<li>auto模式下pdf文档的分类速度提升</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>解析优化
|
||||
<ul>
|
||||
<li>优化对包含水印文档的解析逻辑,显著提升包含水印文档的解析效果</li>
|
||||
<li>改进了单页内多个图像/表格与caption的匹配逻辑,提升了复杂布局下图文匹配的准确性</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>问题修复
|
||||
<ul>
|
||||
<li>修复在某些情况下图片/表格span被填充进textblock导致的异常</li>
|
||||
<li>修复在某些情况下标题block为空的问题</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/01/22 1.1.0 发布,在这个版本我们重点提升了解析的精度与效率:</summary>
|
||||
<ul>
|
||||
<li>模型能力升级(需重新执行 <a href="https://github.com/opendatalab/MinerU/docs/how_to_download_models_zh_cn.md">模型下载流程</a> 以获得模型文件的增量更新)
|
||||
<ul>
|
||||
<li>布局识别模型升级到最新的 `doclayout_yolo(2501)` 模型,提升了layout识别精度</li>
|
||||
<li>公式解析模型升级到最新的 `unimernet(2501)` 模型,提升了公式识别精度</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>性能优化
|
||||
<ul>
|
||||
<li>在配置满足一定条件(显存16GB+)的设备上,通过优化资源占用和重构处理流水线,整体解析速度提升50%以上</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>解析效果优化
|
||||
<ul>
|
||||
<li>在线demo(<a href="https://mineru.net/OpenSourceTools/Extractor">mineru.net</a> / <a href="https://huggingface.co/spaces/opendatalab/MinerU">huggingface</a> / <a href="https://www.modelscope.cn/studios/OpenDataLab/MinerU">modelscope</a>)上新增标题分级功能(测试版本,默认开启),支持对标题进行分级,提升文档结构化程度</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2025/01/10 1.0.1 发布,这是我们的第一个正式版本,在这个版本中,我们通过大量重构带来了全新的API接口和更广泛的兼容性,以及全新的自动语言识别功能:</summary>
|
||||
<ul>
|
||||
<li>全新API接口
|
||||
<ul>
|
||||
<li>对于数据侧API,我们引入了Dataset类,旨在提供一个强大而灵活的数据处理框架。该框架当前支持包括图像(.jpg及.png)、PDF、Word(.doc及.docx)、以及PowerPoint(.ppt及.pptx)在内的多种文档格式,确保了从简单到复杂的数据处理任务都能得到有效的支持。</li>
|
||||
<li>针对用户侧API,我们将MinerU的处理流程精心设计为一系列可组合的Stage阶段。每个Stage代表了一个特定的处理步骤,用户可以根据自身需求自由地定义新的Stage,并通过创造性地组合这些阶段来定制专属的数据处理流程。</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>更广泛的兼容性适配
|
||||
<ul>
|
||||
<li>通过优化依赖环境和配置项,确保在ARM架构的Linux系统上能够稳定高效运行。</li>
|
||||
<li>深度适配华为昇腾NPU加速,积极响应信创要求,提供自主可控的高性能计算能力,助力人工智能应用平台的国产化应用与发展。 <a href="https://github.com/opendatalab/MinerU/docs/README_Ascend_NPU_Acceleration_zh_CN.md">NPU加速教程</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>自动语言识别
|
||||
<ul>
|
||||
<li>通过引入全新的语言识别模型, 在文档解析中将 `lang` 配置为 `auto`,即可自动选择合适的OCR语言模型,提升扫描类文档解析的准确性。</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/22 0.10.0发布,通过引入混合OCR文本提取能力,</summary>
|
||||
<ul>
|
||||
<li>在公式密集、span区域不规范、部分文本使用图像表现等复杂文本分布场景下获得解析效果的显著提升</li>
|
||||
<li>同时具备文本模式内容提取准确、速度更快与OCR模式span/line区域识别更准的双重优势</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/15 0.9.3发布,为表格识别功能接入了<a href="https://github.com/RapidAI/RapidTable">RapidTable</a>,单表解析速度提升10倍以上,准确率更高,显存占用更低</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/11/06 0.9.2发布,为表格识别功能接入了<a href="https://huggingface.co/U4R/StructTable-InternVL2-1B">StructTable-InternVL2-1B</a>模型</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/10/31 0.9.0发布,这是我们进行了大量代码重构的全新版本,解决了众多问题,提升了性能,降低了硬件需求,并提供了更丰富的易用性:</summary>
|
||||
<ul>
|
||||
<li>重构排序模块代码,使用 <a href="https://github.com/ppaanngggg/layoutreader">layoutreader</a> 进行阅读顺序排序,确保在各种排版下都能实现极高准确率</li>
|
||||
<li>重构段落拼接模块,在跨栏、跨页、跨图、跨表情况下均能实现良好的段落拼接效果</li>
|
||||
<li>重构列表和目录识别功能,极大提升列表块和目录块识别的准确率及对应文本段落的解析效果</li>
|
||||
<li>重构图、表与描述性文本的匹配逻辑,大幅提升 caption 和 footnote 与图表的匹配准确率,并将描述性文本的丢失率降至接近0</li>
|
||||
<li>增加 OCR 的多语言支持,支持 84 种语言的检测与识别,语言支持列表详见 <a href="https://paddlepaddle.github.io/PaddleOCR/latest/ppocr/blog/multi_languages.html#5">OCR 语言支持列表</a></li>
|
||||
<li>增加显存回收逻辑及其他显存优化措施,大幅降低显存使用需求。开启除表格加速外的全部加速功能(layout/公式/OCR)的显存需求从16GB降至8GB,开启全部加速功能的显存需求从24GB降至10GB</li>
|
||||
<li>优化配置文件的功能开关,增加独立的公式检测开关,无需公式检测时可大幅提升速度和解析效果</li>
|
||||
<li>集成 <a href="https://github.com/opendatalab/PDF-Extract-Kit">PDF-Extract-Kit 1.0</a>
|
||||
<ul>
|
||||
<li>加入自研的 `doclayout_yolo` 模型,在相近解析效果情况下比原方案提速10倍以上,可通过配置文件与 `layoutlmv3` 自由切换</li>
|
||||
<li>公式解析升级至 `unimernet 0.2.1`,在提升公式解析准确率的同时,大幅降低显存需求</li>
|
||||
<li>因 `PDF-Extract-Kit 1.0` 更换仓库,需要重新下载模型,步骤详见 <a href="https://github.com/opendatalab/MinerU/docs/how_to_download_models_zh_cn.md">如何下载模型</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/09/27 0.8.1发布,修复了一些bug,同时提供了<a href="https://opendatalab.com/OpenSourceTools/Extractor/PDF/">在线demo</a>的<a href="https://github.com/opendatalab/MinerU/projects/web_demo/README_zh-CN.md">本地化部署版本</a>和<a href="https://github.com/opendatalab/MinerU/projects/web/README_zh-CN.md">前端界面</a></summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/09/09 0.8.0发布,支持Dockerfile快速部署,同时上线了huggingface、modelscope demo</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/30 0.7.1发布,集成了paddle tablemaster表格识别功能</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/09 0.7.0b1发布,简化安装步骤提升易用性,加入表格识别功能</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/08/01 0.6.2b1发布,优化了依赖冲突问题和安装文档</summary>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>2024/07/05 首次开源</summary>
|
||||
</details>
|
||||
</details>
|
||||
|
||||
# MinerU
|
||||
|
||||
@@ -103,7 +410,7 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
|
||||
- 自动识别并转换文档中的公式为LaTeX格式
|
||||
- 自动识别并转换文档中的表格为HTML格式
|
||||
- 自动检测扫描版PDF和乱码PDF,并启用OCR功能
|
||||
- OCR支持109种语言的检测与识别
|
||||
- OCR支持84种语言的检测与识别
|
||||
- 支持多种输出格式,如多模态与NLP的Markdown、按阅读顺序排序的JSON、含有丰富信息的中间格式等
|
||||
- 支持多种可视化结果,包括layout可视化、span可视化等,便于高效确认输出效果与质检
|
||||
- 支持纯CPU环境运行,并支持 GPU(CUDA)/NPU(CANN)/MPS 加速
|
||||
@@ -139,100 +446,61 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
|
||||
> 在非主线环境中,由于硬件、软件配置的多样性,以及第三方依赖项的兼容性问题,我们无法100%保证项目的完全可用性。因此,对于希望在非推荐环境中使用本项目的用户,我们建议先仔细阅读文档以及FAQ,大多数问题已经在FAQ中有对应的解决方案,除此之外我们鼓励社区反馈问题,以便我们能够逐步扩大支持范围。
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">解析后端</th>
|
||||
<th rowspan="2">pipeline</th>
|
||||
<th colspan="2">*-auto-engine</th>
|
||||
<th colspan="2">*-http-client</th>
|
||||
<td>解析后端</td>
|
||||
<td>pipeline</td>
|
||||
<td>vlm-transformers</td>
|
||||
<td>vlm-sglang</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>hybrid</th>
|
||||
<th>vlm</th>
|
||||
<th>hybrid</th>
|
||||
<th>vlm</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>后端特性</th>
|
||||
<td >兼容性好</td>
|
||||
<td colspan="2">硬件配置要求较高</td>
|
||||
<td colspan="2">适用于OpenAI兼容服务器<sup>2</sup></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>精度指标<sup>1</sup></th>
|
||||
<td style="text-align:center;">82+</td>
|
||||
<td colspan="4" style="text-align:center;">90+</td>
|
||||
<td>操作系统</td>
|
||||
<td>Linux / Windows / macOS</td>
|
||||
<td>Linux / Windows</td>
|
||||
<td>Linux / Windows (via WSL2)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>操作系统</th>
|
||||
<td colspan="5" style="text-align:center;">Linux<sup>3</sup> / Windows<sup>4</sup> / macOS<sup>5</sup></td>
|
||||
<td>CPU推理支持</td>
|
||||
<td>✅</td>
|
||||
<td colspan="2">❌</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>纯CPU平台支持</th>
|
||||
<td style="text-align:center;">✅</td>
|
||||
<td colspan="2" style="text-align:center;">❌</td>
|
||||
<td colspan="2" style="text-align:center;">✅</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>GPU加速支持</th>
|
||||
<td colspan="4" style="text-align:center;">Volta及以后架构GPU或Apple Silicon</td>
|
||||
<td rowspan="2">不需要</td>
|
||||
<td>GPU要求</td>
|
||||
<td>Turing及以后架构,6G显存以上或Apple Silicon</td>
|
||||
<td colspan="2">Turing及以后架构,8G显存以上</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>显存最低要求</th>
|
||||
<td style="text-align:center;">4GB</td>
|
||||
<td style="text-align:center;">8GB</td>
|
||||
<td style="text-align:center;">8GB</td>
|
||||
<td style="text-align:center;">2GB</td>
|
||||
<td>内存要求</td>
|
||||
<td colspan="3">最低16G以上,推荐32G以上</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>内存要求</th>
|
||||
<td colspan="3" style="text-align:center;">最低8GB以上,推荐16GB以上</td>
|
||||
<td colspan="2" style="text-align:center;">最低8GB</td>
|
||||
<td>磁盘空间要求</td>
|
||||
<td colspan="3">20G以上,推荐使用SSD</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>磁盘空间要求</th>
|
||||
<td colspan="3" style="text-align:center;">20GB以上,推荐使用SSD</td>
|
||||
<td colspan="2" style="text-align:center;">至少2GB</td>
|
||||
<td>python版本</td>
|
||||
<td colspan="3">3.10-3.13</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>python版本</th>
|
||||
<td colspan="5" style="text-align:center;">3.10-3.13</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<sup>1</sup> 精度指标为OmniDocBench (v1.5)的End-to-End Evaluation Overall分数,基于`MinerU`最新版本测试
|
||||
<sup>2</sup> 兼容OpenAI API的服务器,如通过`vLLM`/`SGLang`/`LMDeploy`等推理框架部署的本地模型服务器或远程模型服务
|
||||
<sup>3</sup> Linux仅支持2019年及以后发行版
|
||||
<sup>4</sup> 由于关键依赖`ray`未能在windows平台支持Python 3.13,故仅支持至3.10~3.12版本
|
||||
<sup>5</sup> macOS 需使用14.0以上版本
|
||||
|
||||
> [!TIP]
|
||||
> 除以上主流环境与平台外,我们也收录了一些社区用户反馈的其他平台支持情况,详情请参考[其他加速卡适配](https://opendatalab.github.io/MinerU/zh/usage/)。
|
||||
> 如果您有意将自己的环境适配经验分享给社区,欢迎通过[show-and-tell](https://github.com/opendatalab/MinerU/discussions/categories/show-and-tell)提交或提交PR至[其他加速卡适配](https://github.com/opendatalab/MinerU/tree/master/docs/zh/usage/acceleration_cards)文档。
|
||||
|
||||
### 安装 MinerU
|
||||
|
||||
#### 使用pip或uv安装MinerU
|
||||
```bash
|
||||
pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple
|
||||
pip install uv -i https://mirrors.aliyun.com/pypi/simple
|
||||
uv pip install -U "mineru[all]" -i https://mirrors.aliyun.com/pypi/simple
|
||||
uv pip install -U "mineru[core]" -i https://mirrors.aliyun.com/pypi/simple
|
||||
```
|
||||
|
||||
#### 通过源码安装MinerU
|
||||
```bash
|
||||
git clone https://github.com/opendatalab/MinerU.git
|
||||
cd MinerU
|
||||
uv pip install -e .[all] -i https://mirrors.aliyun.com/pypi/simple
|
||||
uv pip install -e .[core] -i https://mirrors.aliyun.com/pypi/simple
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> `mineru[all]`包含所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
|
||||
> 如果您需要指定vlm模型的推理框架,或是仅准备在边缘设备安装轻量版client端,可以参考文档[扩展模块安装指南](https://opendatalab.github.io/MinerU/zh/quick_start/extension_modules/)。
|
||||
> `mineru[core]`包含除`sglang`加速外的所有核心功能,兼容Windows / Linux / macOS系统,适合绝大多数用户。
|
||||
> 如果您有使用`sglang`加速VLM模型推理,或是在边缘设备安装轻量版client端等需求,可以参考文档[扩展模块安装指南](https://opendatalab.github.io/MinerU/zh/quick_start/extension_modules/)。
|
||||
|
||||
---
|
||||
|
||||
@@ -244,20 +512,10 @@ MinerU提供了便捷的docker部署方式,这有助于快速搭建环境并
|
||||
|
||||
### 使用 MinerU
|
||||
|
||||
>[!TIP]
|
||||
>默认使用托管在`huggingface`的模型进行解析,首次使用时会自动下载所需模型文件,后续使用将直接加载本地缓存的模型。如果您无法访问`huggingface`,可以通过以下命令切换至国内镜像源:
|
||||
>```bash
|
||||
>export MINERU_MODEL_SOURCE=modelscope
|
||||
>```
|
||||
|
||||
如果您的设备满足上表中GPU加速的条件,可以使用简单的命令行进行文档解析:
|
||||
最简单的命令行调用方式:
|
||||
```bash
|
||||
mineru -p <input_path> -o <output_path>
|
||||
```
|
||||
如果您的设备不满足GPU加速条件,可以指定后端为`pipeline`,以在纯CPU环境下运行:
|
||||
```bash
|
||||
mineru -p <input_path> -o <output_path> -b pipeline
|
||||
```
|
||||
|
||||
您可以通过命令行、API、WebUI等多种方式使用MinerU进行PDF解析,具体使用方法请参考[使用指南](https://opendatalab.github.io/MinerU/zh/usage/)。
|
||||
|
||||
@@ -270,8 +528,8 @@ mineru -p <input_path> -o <output_path> -b pipeline
|
||||
- [x] 手写文本识别
|
||||
- [x] 竖排文本识别
|
||||
- [x] 拉丁字母重音符号识别
|
||||
- [x] 正文中代码块识别
|
||||
- [x] [化学式识别](docs/chemical_knowledge_introduction/introduction.pdf)(https://mineru.net)
|
||||
- [ ] 正文中代码块识别
|
||||
- [ ] [化学式识别](docs/chemical_knowledge_introduction/introduction.pdf)
|
||||
- [ ] 图表内容识别
|
||||
|
||||
# Known Issues
|
||||
@@ -289,7 +547,7 @@ mineru -p <input_path> -o <output_path> -b pipeline
|
||||
|
||||
- 如果您在使用过程中遇到问题,可以先查看[常见问题](https://opendatalab.github.io/MinerU/zh/faq/)是否有解答。
|
||||
- 如果未能解决您的问题,您也可以使用[DeepWiki](https://deepwiki.com/opendatalab/MinerU)与AI助手交流,这可以解决大部分常见问题。
|
||||
- 如果您仍然无法解决问题,您可通过[Discord](https://discord.gg/Tdedn9GTXq)或[WeChat](https://mineru.net/community-portal/?aliasId=3c430f94)加入社区,与其他用户和开发者交流。
|
||||
- 如果您仍然无法解决问题,您可通过[Discord](https://discord.gg/Tdedn9GTXq)或[WeChat](http://mineru.space/s/V85Yl)加入社区,与其他用户和开发者交流。
|
||||
|
||||
# All Thanks To Our Contributors
|
||||
|
||||
@@ -301,36 +559,27 @@ mineru -p <input_path> -o <output_path> -b pipeline
|
||||
|
||||
[LICENSE.md](LICENSE.md)
|
||||
|
||||
本仓库源码采用 Apache License 2.0 许可。
|
||||
本项目目前部分模型基于YOLO训练,但因其遵循AGPL协议,可能对某些使用场景构成限制。未来版本迭代中,我们计划探索并替换为许可条款更为宽松的模型,以提升用户友好度及灵活性。
|
||||
|
||||
# Acknowledgments
|
||||
|
||||
- [PDF-Extract-Kit](https://github.com/opendatalab/PDF-Extract-Kit)
|
||||
- [DocLayout-YOLO](https://github.com/opendatalab/DocLayout-YOLO)
|
||||
- [UniMERNet](https://github.com/opendatalab/UniMERNet)
|
||||
- [TableStructureRec](https://github.com/RapidAI/TableStructureRec)
|
||||
- [RapidTable](https://github.com/RapidAI/RapidTable)
|
||||
- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
|
||||
- [PaddleOCR2Pytorch](https://github.com/frotms/PaddleOCR2Pytorch)
|
||||
- [layoutreader](https://github.com/ppaanngggg/layoutreader)
|
||||
- [xy-cut](https://github.com/Sanster/xy-cut)
|
||||
- [fast-langdetect](https://github.com/LlmKira/fast-langdetect)
|
||||
- [pypdfium2](https://github.com/pypdfium2-team/pypdfium2)
|
||||
- [pdftext](https://github.com/datalab-to/pdftext)
|
||||
- [pdfminer.six](https://github.com/pdfminer/pdfminer.six)
|
||||
- [pypdf](https://github.com/py-pdf/pypdf)
|
||||
- [magika](https://github.com/google/magika)
|
||||
- [vLLM](https://github.com/vllm-project/vllm)
|
||||
- [LMDeploy](https://github.com/InternLM/lmdeploy)
|
||||
|
||||
# Citation
|
||||
|
||||
```bibtex
|
||||
@misc{niu2025mineru25decoupledvisionlanguagemodel,
|
||||
title={MinerU2.5: A Decoupled Vision-Language Model for Efficient High-Resolution Document Parsing},
|
||||
author={Junbo Niu and Zheng Liu and Zhuangcheng Gu and Bin Wang and Linke Ouyang and Zhiyuan Zhao and Tao Chu and Tianyao He and Fan Wu and Qintong Zhang and Zhenjiang Jin and Guang Liang and Rui Zhang and Wenzheng Zhang and Yuan Qu and Zhifei Ren and Yuefeng Sun and Yuanhong Zheng and Dongsheng Ma and Zirui Tang and Boyu Niu and Ziyang Miao and Hejun Dong and Siyi Qian and Junyuan Zhang and Jingzhou Chen and Fangdong Wang and Xiaomeng Zhao and Liqun Wei and Wei Li and Shasha Wang and Ruiliang Xu and Yuanyuan Cao and Lu Chen and Qianqian Wu and Huaiyu Gu and Lindong Lu and Keming Wang and Dechen Lin and Guanlin Shen and Xuanhe Zhou and Linfeng Zhang and Yuhang Zang and Xiaoyi Dong and Jiaqi Wang and Bo Zhang and Lei Bai and Pei Chu and Weijia Li and Jiang Wu and Lijun Wu and Zhenxiang Li and Guangyu Wang and Zhongying Tu and Chao Xu and Kai Chen and Yu Qiao and Bowen Zhou and Dahua Lin and Wentao Zhang and Conghui He},
|
||||
year={2025},
|
||||
eprint={2509.22186},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CV},
|
||||
url={https://arxiv.org/abs/2509.22186},
|
||||
}
|
||||
|
||||
@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},
|
||||
@@ -368,5 +617,4 @@ mineru -p <input_path> -o <output_path> -b pipeline
|
||||
- [PDF-Extract-Kit (A Comprehensive Toolkit for High-Quality PDF Content Extraction)](https://github.com/opendatalab/PDF-Extract-Kit)
|
||||
- [OmniDocBench (A Comprehensive Benchmark for Document Parsing and Evaluation)](https://github.com/opendatalab/OmniDocBench)
|
||||
- [Magic-HTML (Mixed web page extraction tool)](https://github.com/opendatalab/magic-html)
|
||||
- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)
|
||||
- [Dingo: A Comprehensive AI Data Quality Evaluation Tool](https://github.com/MigoXLab/dingo)
|
||||
- [Magic-Doc (Fast speed ppt/pptx/doc/docx/pdf extraction tool)](https://github.com/InternLM/magic-doc)
|
||||
441
demo/demo.py
@@ -1,256 +1,245 @@
|
||||
# Copyright (c) Opendatalab. All rights reserved.
|
||||
import asyncio
|
||||
import copy
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
from loguru import logger
|
||||
|
||||
from mineru.cli import api_client as _api_client
|
||||
from mineru.cli.common import image_suffixes, office_suffixes, pdf_suffixes
|
||||
from mineru.utils.guess_suffix_or_lang import guess_suffix_by_path
|
||||
|
||||
SUPPORTED_INPUT_SUFFIXES = set(pdf_suffixes + image_suffixes + office_suffixes)
|
||||
from mineru.cli.common import convert_pdf_bytes_to_bytes_by_pypdfium2, prepare_env, read_fn
|
||||
from mineru.data.data_reader_writer import FileBasedDataWriter
|
||||
from mineru.utils.draw_bbox import draw_layout_bbox, draw_span_bbox
|
||||
from mineru.utils.enum_class import MakeMode
|
||||
from mineru.backend.vlm.vlm_analyze import doc_analyze as vlm_doc_analyze
|
||||
from mineru.backend.pipeline.pipeline_analyze import doc_analyze as pipeline_doc_analyze
|
||||
from mineru.backend.pipeline.pipeline_middle_json_mkcontent import union_make as pipeline_union_make
|
||||
from mineru.backend.pipeline.model_json_to_middle_json import result_to_middle_json as pipeline_result_to_middle_json
|
||||
from mineru.backend.vlm.vlm_middle_json_mkcontent import union_make as vlm_union_make
|
||||
from mineru.utils.models_download_utils import auto_download_and_get_model_root_path
|
||||
|
||||
|
||||
def collect_input_files(input_path: str | Path) -> list[Path]:
|
||||
path = Path(input_path).expanduser().resolve()
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(f"Input path does not exist: {path}")
|
||||
def do_parse(
|
||||
output_dir, # Output directory for storing parsing results
|
||||
pdf_file_names: list[str], # List of PDF file names to be parsed
|
||||
pdf_bytes_list: list[bytes], # List of PDF bytes to be parsed
|
||||
p_lang_list: list[str], # List of languages for each PDF, default is 'ch' (Chinese)
|
||||
backend="pipeline", # The backend for parsing PDF, default is 'pipeline'
|
||||
parse_method="auto", # The method for parsing PDF, default is 'auto'
|
||||
formula_enable=True, # Enable formula parsing
|
||||
table_enable=True, # Enable table parsing
|
||||
server_url=None, # Server URL for vlm-sglang-client backend
|
||||
f_draw_layout_bbox=True, # Whether to draw layout bounding boxes
|
||||
f_draw_span_bbox=True, # Whether to draw span bounding boxes
|
||||
f_dump_md=True, # Whether to dump markdown files
|
||||
f_dump_middle_json=True, # Whether to dump middle JSON files
|
||||
f_dump_model_output=True, # Whether to dump model output files
|
||||
f_dump_orig_pdf=True, # Whether to dump original PDF files
|
||||
f_dump_content_list=True, # Whether to dump content list files
|
||||
f_make_md_mode=MakeMode.MM_MD, # The mode for making markdown content, default is MM_MD
|
||||
start_page_id=0, # Start page ID for parsing, default is 0
|
||||
end_page_id=None, # End page ID for parsing, default is None (parse all pages until the end of the document)
|
||||
):
|
||||
|
||||
if path.is_file():
|
||||
file_suffix = guess_suffix_by_path(path)
|
||||
if file_suffix not in SUPPORTED_INPUT_SUFFIXES:
|
||||
raise ValueError(f"Unsupported input file type: {path.name}")
|
||||
return [path]
|
||||
if backend == "pipeline":
|
||||
for idx, pdf_bytes in enumerate(pdf_bytes_list):
|
||||
new_pdf_bytes = convert_pdf_bytes_to_bytes_by_pypdfium2(pdf_bytes, start_page_id, end_page_id)
|
||||
pdf_bytes_list[idx] = new_pdf_bytes
|
||||
|
||||
if not path.is_dir():
|
||||
raise ValueError(f"Input path must be a file or directory: {path}")
|
||||
infer_results, all_image_lists, all_pdf_docs, lang_list, ocr_enabled_list = pipeline_doc_analyze(pdf_bytes_list, p_lang_list, parse_method=parse_method, formula_enable=formula_enable,table_enable=table_enable)
|
||||
|
||||
input_files = sorted(
|
||||
(
|
||||
candidate.resolve()
|
||||
for candidate in path.iterdir()
|
||||
if candidate.is_file()
|
||||
and guess_suffix_by_path(candidate) in SUPPORTED_INPUT_SUFFIXES
|
||||
),
|
||||
key=lambda item: item.name,
|
||||
)
|
||||
if not input_files:
|
||||
raise ValueError(f"No supported files found in directory: {path}")
|
||||
return input_files
|
||||
for idx, model_list in enumerate(infer_results):
|
||||
model_json = copy.deepcopy(model_list)
|
||||
pdf_file_name = pdf_file_names[idx]
|
||||
local_image_dir, local_md_dir = prepare_env(output_dir, pdf_file_name, parse_method)
|
||||
image_writer, md_writer = FileBasedDataWriter(local_image_dir), FileBasedDataWriter(local_md_dir)
|
||||
|
||||
images_list = all_image_lists[idx]
|
||||
pdf_doc = all_pdf_docs[idx]
|
||||
_lang = lang_list[idx]
|
||||
_ocr_enable = ocr_enabled_list[idx]
|
||||
middle_json = pipeline_result_to_middle_json(model_list, images_list, pdf_doc, image_writer, _lang, _ocr_enable, formula_enable)
|
||||
|
||||
def build_form_data(
|
||||
language: str,
|
||||
backend: str,
|
||||
parse_method: str,
|
||||
formula_enable: bool,
|
||||
table_enable: bool,
|
||||
server_url: str | None,
|
||||
start_page_id: int,
|
||||
end_page_id: int | None,
|
||||
) -> dict[str, str | list[str]]:
|
||||
return _api_client.build_parse_request_form_data(
|
||||
lang_list=[language],
|
||||
backend=backend,
|
||||
parse_method=parse_method,
|
||||
formula_enable=formula_enable,
|
||||
table_enable=table_enable,
|
||||
server_url=server_url,
|
||||
start_page_id=start_page_id,
|
||||
end_page_id=end_page_id,
|
||||
return_md=True,
|
||||
return_middle_json=False,
|
||||
return_model_output=False,
|
||||
return_content_list=False,
|
||||
return_images=True,
|
||||
response_format_zip=True,
|
||||
return_original_file=False,
|
||||
)
|
||||
pdf_info = middle_json["pdf_info"]
|
||||
|
||||
pdf_bytes = pdf_bytes_list[idx]
|
||||
if f_draw_layout_bbox:
|
||||
draw_layout_bbox(pdf_info, pdf_bytes, local_md_dir, f"{pdf_file_name}_layout.pdf")
|
||||
|
||||
def format_status_message(status_snapshot: _api_client.TaskStatusSnapshot) -> str:
|
||||
if status_snapshot.queued_ahead is None:
|
||||
return status_snapshot.status
|
||||
return f"{status_snapshot.status} (queued_ahead={status_snapshot.queued_ahead})"
|
||||
if f_draw_span_bbox:
|
||||
draw_span_bbox(pdf_info, pdf_bytes, local_md_dir, f"{pdf_file_name}_span.pdf")
|
||||
|
||||
|
||||
def prepare_local_api_temp_dir() -> None:
|
||||
current_temp_dir = Path(tempfile.gettempdir())
|
||||
if os.name == "nt" or not Path("/tmp").exists():
|
||||
return
|
||||
if not str(current_temp_dir).startswith("/mnt/"):
|
||||
return
|
||||
|
||||
# vLLM/ZeroMQ IPC sockets fail on drvfs-backed temp directories under WSL.
|
||||
os.environ["TMPDIR"] = "/tmp"
|
||||
tempfile.tempdir = None
|
||||
|
||||
|
||||
async def run_demo(
|
||||
input_path: str | Path,
|
||||
output_dir: str | Path,
|
||||
*,
|
||||
api_url: str | None = None,
|
||||
backend: str = "hybrid-auto-engine",
|
||||
parse_method: str = "auto",
|
||||
language: str = "ch",
|
||||
formula_enable: bool = True,
|
||||
table_enable: bool = True,
|
||||
server_url: str | None = None,
|
||||
start_page_id: int = 0,
|
||||
end_page_id: int | None = None,
|
||||
) -> None:
|
||||
api_url = api_url or None
|
||||
server_url = server_url or None
|
||||
if backend.endswith("http-client") and not server_url:
|
||||
raise ValueError(f"backend={backend} requires server_url")
|
||||
|
||||
input_files = collect_input_files(input_path)
|
||||
output_path = Path(output_dir).expanduser().resolve()
|
||||
output_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
form_data = build_form_data(
|
||||
language=language,
|
||||
backend=backend,
|
||||
parse_method=parse_method,
|
||||
formula_enable=formula_enable,
|
||||
table_enable=table_enable,
|
||||
server_url=server_url,
|
||||
start_page_id=start_page_id,
|
||||
end_page_id=end_page_id,
|
||||
)
|
||||
upload_assets = [
|
||||
_api_client.UploadAsset(path=file_path, upload_name=file_path.name)
|
||||
for file_path in input_files
|
||||
]
|
||||
|
||||
local_server: _api_client.LocalAPIServer | None = None
|
||||
result_zip_path: Path | None = None
|
||||
task_label = f"{len(input_files)} file(s)"
|
||||
|
||||
async with httpx.AsyncClient(
|
||||
timeout=_api_client.build_http_timeout(),
|
||||
follow_redirects=True,
|
||||
) as http_client:
|
||||
try:
|
||||
if api_url is None:
|
||||
prepare_local_api_temp_dir()
|
||||
local_server = _api_client.LocalAPIServer()
|
||||
base_url = local_server.start()
|
||||
print(f"Started local mineru-api: {base_url}")
|
||||
server_health = await _api_client.wait_for_local_api_ready(
|
||||
http_client,
|
||||
local_server,
|
||||
)
|
||||
else:
|
||||
server_health = await _api_client.fetch_server_health(
|
||||
http_client,
|
||||
_api_client.normalize_base_url(api_url),
|
||||
if f_dump_orig_pdf:
|
||||
md_writer.write(
|
||||
f"{pdf_file_name}_origin.pdf",
|
||||
pdf_bytes,
|
||||
)
|
||||
|
||||
print(f"Using API: {server_health.base_url}")
|
||||
print(f"Submitting {len(upload_assets)} file(s)")
|
||||
submit_response = await _api_client.submit_parse_task(
|
||||
base_url=server_health.base_url,
|
||||
upload_assets=upload_assets,
|
||||
form_data=form_data,
|
||||
)
|
||||
print(f"task_id: {submit_response.task_id}")
|
||||
if submit_response.queued_ahead is not None:
|
||||
print(f"status: pending (queued_ahead={submit_response.queued_ahead})")
|
||||
if f_dump_md:
|
||||
image_dir = str(os.path.basename(local_image_dir))
|
||||
md_content_str = pipeline_union_make(pdf_info, f_make_md_mode, image_dir)
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}.md",
|
||||
md_content_str,
|
||||
)
|
||||
|
||||
last_status_message = None
|
||||
if f_dump_content_list:
|
||||
image_dir = str(os.path.basename(local_image_dir))
|
||||
content_list = pipeline_union_make(pdf_info, MakeMode.CONTENT_LIST, image_dir)
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_content_list.json",
|
||||
json.dumps(content_list, ensure_ascii=False, indent=4),
|
||||
)
|
||||
|
||||
def on_status_update(status_snapshot: _api_client.TaskStatusSnapshot) -> None:
|
||||
nonlocal last_status_message
|
||||
message = format_status_message(status_snapshot)
|
||||
if message == last_status_message:
|
||||
return
|
||||
last_status_message = message
|
||||
print(f"status: {message}")
|
||||
if f_dump_middle_json:
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_middle.json",
|
||||
json.dumps(middle_json, ensure_ascii=False, indent=4),
|
||||
)
|
||||
|
||||
await _api_client.wait_for_task_result(
|
||||
client=http_client,
|
||||
submit_response=submit_response,
|
||||
task_label=task_label,
|
||||
status_snapshot_callback=on_status_update,
|
||||
)
|
||||
print("status: completed")
|
||||
result_zip_path = await _api_client.download_result_zip(
|
||||
client=http_client,
|
||||
submit_response=submit_response,
|
||||
task_label=task_label,
|
||||
)
|
||||
finally:
|
||||
if local_server is not None:
|
||||
local_server.stop()
|
||||
if f_dump_model_output:
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_model.json",
|
||||
json.dumps(model_json, ensure_ascii=False, indent=4),
|
||||
)
|
||||
|
||||
assert result_zip_path is not None
|
||||
logger.info(f"local output dir is {local_md_dir}")
|
||||
else:
|
||||
if backend.startswith("vlm-"):
|
||||
backend = backend[4:]
|
||||
|
||||
f_draw_span_bbox = False
|
||||
parse_method = "vlm"
|
||||
for idx, pdf_bytes in enumerate(pdf_bytes_list):
|
||||
pdf_file_name = pdf_file_names[idx]
|
||||
pdf_bytes = convert_pdf_bytes_to_bytes_by_pypdfium2(pdf_bytes, start_page_id, end_page_id)
|
||||
local_image_dir, local_md_dir = prepare_env(output_dir, pdf_file_name, parse_method)
|
||||
image_writer, md_writer = FileBasedDataWriter(local_image_dir), FileBasedDataWriter(local_md_dir)
|
||||
middle_json, infer_result = vlm_doc_analyze(pdf_bytes, image_writer=image_writer, backend=backend, server_url=server_url)
|
||||
|
||||
pdf_info = middle_json["pdf_info"]
|
||||
|
||||
if f_draw_layout_bbox:
|
||||
draw_layout_bbox(pdf_info, pdf_bytes, local_md_dir, f"{pdf_file_name}_layout.pdf")
|
||||
|
||||
if f_draw_span_bbox:
|
||||
draw_span_bbox(pdf_info, pdf_bytes, local_md_dir, f"{pdf_file_name}_span.pdf")
|
||||
|
||||
if f_dump_orig_pdf:
|
||||
md_writer.write(
|
||||
f"{pdf_file_name}_origin.pdf",
|
||||
pdf_bytes,
|
||||
)
|
||||
|
||||
if f_dump_md:
|
||||
image_dir = str(os.path.basename(local_image_dir))
|
||||
md_content_str = vlm_union_make(pdf_info, f_make_md_mode, image_dir)
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}.md",
|
||||
md_content_str,
|
||||
)
|
||||
|
||||
if f_dump_content_list:
|
||||
image_dir = str(os.path.basename(local_image_dir))
|
||||
content_list = vlm_union_make(pdf_info, MakeMode.CONTENT_LIST, image_dir)
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_content_list.json",
|
||||
json.dumps(content_list, ensure_ascii=False, indent=4),
|
||||
)
|
||||
|
||||
if f_dump_middle_json:
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_middle.json",
|
||||
json.dumps(middle_json, ensure_ascii=False, indent=4),
|
||||
)
|
||||
|
||||
if f_dump_model_output:
|
||||
model_output = ("\n" + "-" * 50 + "\n").join(infer_result)
|
||||
md_writer.write_string(
|
||||
f"{pdf_file_name}_model_output.txt",
|
||||
model_output,
|
||||
)
|
||||
|
||||
logger.info(f"local output dir is {local_md_dir}")
|
||||
|
||||
|
||||
def parse_doc(
|
||||
path_list: list[Path],
|
||||
output_dir,
|
||||
lang="ch",
|
||||
backend="pipeline",
|
||||
method="auto",
|
||||
server_url=None,
|
||||
start_page_id=0,
|
||||
end_page_id=None
|
||||
):
|
||||
"""
|
||||
Parameter description:
|
||||
path_list: List of document paths to be parsed, can be PDF or image files.
|
||||
output_dir: Output directory for storing parsing results.
|
||||
lang: Language option, default is 'ch', optional values include['ch', 'ch_server', 'ch_lite', 'en', 'korean', 'japan', 'chinese_cht', 'ta', 'te', 'ka']。
|
||||
Input the languages in the pdf (if known) to improve OCR accuracy. Optional.
|
||||
Adapted only for the case where the backend is set to "pipeline"
|
||||
backend: the backend for parsing pdf:
|
||||
pipeline: More general.
|
||||
vlm-transformers: More general.
|
||||
vlm-sglang-engine: Faster(engine).
|
||||
vlm-sglang-client: Faster(client).
|
||||
without method specified, pipeline will be used by default.
|
||||
method: the method for parsing pdf:
|
||||
auto: Automatically determine the method based on the file type.
|
||||
txt: Use text extraction method.
|
||||
ocr: Use OCR method for image-based PDFs.
|
||||
Without method specified, 'auto' will be used by default.
|
||||
Adapted only for the case where the backend is set to "pipeline".
|
||||
server_url: When the backend is `sglang-client`, you need to specify the server_url, for example:`http://127.0.0.1:30000`
|
||||
start_page_id: Start page ID for parsing, default is 0
|
||||
end_page_id: End page ID for parsing, default is None (parse all pages until the end of the document)
|
||||
"""
|
||||
try:
|
||||
_api_client.safe_extract_zip(result_zip_path, output_path)
|
||||
finally:
|
||||
result_zip_path.unlink(missing_ok=True)
|
||||
print(f"Extracted result to: {output_path}")
|
||||
file_name_list = []
|
||||
pdf_bytes_list = []
|
||||
lang_list = []
|
||||
for path in path_list:
|
||||
file_name = str(Path(path).stem)
|
||||
pdf_bytes = read_fn(path)
|
||||
file_name_list.append(file_name)
|
||||
pdf_bytes_list.append(pdf_bytes)
|
||||
lang_list.append(lang)
|
||||
do_parse(
|
||||
output_dir=output_dir,
|
||||
pdf_file_names=file_name_list,
|
||||
pdf_bytes_list=pdf_bytes_list,
|
||||
p_lang_list=lang_list,
|
||||
backend=backend,
|
||||
parse_method=method,
|
||||
server_url=server_url,
|
||||
start_page_id=start_page_id,
|
||||
end_page_id=end_page_id
|
||||
)
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
demo_dir = Path(__file__).resolve().parent
|
||||
if __name__ == '__main__':
|
||||
# args
|
||||
__dir__ = os.path.dirname(os.path.abspath(__file__))
|
||||
pdf_files_dir = os.path.join(__dir__, "pdfs")
|
||||
output_dir = os.path.join(__dir__, "output")
|
||||
pdf_suffixes = [".pdf"]
|
||||
image_suffixes = [".png", ".jpeg", ".jpg"]
|
||||
|
||||
# Input can be a single supported file or a directory containing supported files.
|
||||
input_path = demo_dir / "pdfs"
|
||||
# Parsed outputs will be extracted into this directory.
|
||||
output_dir = demo_dir / "api_output"
|
||||
# Set this to an existing MinerU FastAPI base URL, for example:
|
||||
# "http://127.0.0.1:8000"
|
||||
# Leave it as None to start a temporary local mineru-api automatically.
|
||||
api_url = None
|
||||
|
||||
# Available examples:
|
||||
# "hybrid-auto-engine" -> local hybrid parsing, recommended default
|
||||
# "pipeline" -> more general OCR/text pipeline
|
||||
# "vlm-auto-engine" -> local VLM parsing
|
||||
# "vlm-http-client" -> remote OpenAI-compatible VLM server
|
||||
# "hybrid-http-client" -> remote OpenAI-compatible hybrid server
|
||||
backend = "hybrid-auto-engine"
|
||||
# Available options:
|
||||
# "auto" -> let MinerU choose between text extraction and OCR
|
||||
# "txt" -> force text extraction
|
||||
# "ocr" -> force OCR
|
||||
parse_method = "auto"
|
||||
# OCR language hint. This is mainly used by pipeline and hybrid backends.
|
||||
language = "ch"
|
||||
# Enable formula parsing in the output.
|
||||
formula_enable = True
|
||||
# Enable table parsing in the output.
|
||||
table_enable = True
|
||||
# Required only for "*-http-client" backends, for example:
|
||||
# "http://127.0.0.1:30000"
|
||||
server_url = None
|
||||
# Zero-based page range. Set end_page_id to None to parse to the last page.
|
||||
start_page_id = 0
|
||||
end_page_id = None
|
||||
doc_path_list = []
|
||||
for doc_path in Path(pdf_files_dir).glob('*'):
|
||||
if doc_path.suffix in pdf_suffixes + image_suffixes:
|
||||
doc_path_list.append(doc_path)
|
||||
|
||||
"""如果您由于网络问题无法下载模型,可以设置环境变量MINERU_MODEL_SOURCE为modelscope使用免代理仓库下载模型"""
|
||||
# os.environ['MINERU_MODEL_SOURCE'] = "modelscope"
|
||||
|
||||
asyncio.run(
|
||||
run_demo(
|
||||
input_path=input_path,
|
||||
output_dir=output_dir,
|
||||
api_url=api_url,
|
||||
backend=backend,
|
||||
parse_method=parse_method,
|
||||
language=language,
|
||||
formula_enable=formula_enable,
|
||||
table_enable=table_enable,
|
||||
server_url=server_url,
|
||||
start_page_id=start_page_id,
|
||||
end_page_id=end_page_id,
|
||||
)
|
||||
)
|
||||
"""Use pipeline mode if your environment does not support VLM"""
|
||||
parse_doc(doc_path_list, output_dir, backend="pipeline")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
"""To enable VLM mode, change the backend to 'vlm-xxx'"""
|
||||
# parse_doc(doc_path_list, output_dir, backend="vlm-transformers") # more general.
|
||||
# parse_doc(doc_path_list, output_dir, backend="vlm-sglang-engine") # faster(engine).
|
||||
# parse_doc(doc_path_list, output_dir, backend="vlm-sglang-client", server_url="http://127.0.0.1:30000") # faster(client).
|
||||
@@ -1,7 +1,5 @@
|
||||
# Use DaoCloud mirrored vllm image for China region for gpu with Volta、Turing、Ampere、Ada Lovelace、Hopper、Blackwell architecture (7.0 <= Compute Capability <= 12.0)
|
||||
# Compute Capability version query (https://developer.nvidia.com/cuda-gpus)
|
||||
# support x86_64 architecture and ARM(AArch64) architecture
|
||||
FROM docker.m.daocloud.io/vllm/vllm-openai:v0.11.2
|
||||
# Use the official sglang image
|
||||
FROM lmsysorg/sglang:v0.4.8.post1-cu126
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
@@ -15,7 +13,7 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U 'mineru[core]>=2.7.0' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
|
||||
RUN python3 -m pip install -U 'mineru[core]' -i https://mirrors.aliyun.com/pypi/simple --break-system-packages && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + iluvatar GPU.
|
||||
FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/corex:4.4.0_torch2.7.1_vllm0.11.2_py3.10
|
||||
|
||||
|
||||
# Install Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install 'mineru[core]>=2.7.4' \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,34 +0,0 @@
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + Hygon DCU.
|
||||
FROM harbor.sourcefind.cn:5443/dcu/admin/base/vllm:0.9.2-ubuntu22.04-dtk25.04.2-1226-das1.7-py3.10-20251226
|
||||
|
||||
|
||||
# Install Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install mineru[api,gradio] \
|
||||
"matplotlib>=3.10,<4" \
|
||||
"ultralytics>=8.3.48,<9" \
|
||||
"doclayout_yolo==0.0.4" \
|
||||
"ftfy>=6.3.1,<7" \
|
||||
"shapely>=2.0.7,<3" \
|
||||
"pyclipper>=1.3.0,<2" \
|
||||
"omegaconf>=2.3.0,<3" \
|
||||
numpy==1.25.0 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,30 +0,0 @@
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + Enflame GCU.
|
||||
FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/gcu:docker_images_topsrider_i3x_3.6.20260106_vllm0.11_pytorch2.8.0
|
||||
|
||||
|
||||
# Install Noto fonts for Chinese characters
|
||||
RUN echo 'deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse\n\
|
||||
deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse\n\
|
||||
deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse\n\
|
||||
deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse' > /tmp/aliyun-sources.list && \
|
||||
apt-get -o Dir::Etc::SourceList=/tmp/aliyun-sources.list update && \
|
||||
apt-get -o Dir::Etc::SourceList=/tmp/aliyun-sources.list install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/aliyun-sources.list
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install "mineru[core]>=2.7.2" \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,33 +0,0 @@
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + Kunlun XPU.
|
||||
FROM docker.1ms.run/wjie520/vllm_kunlun:v0.10.1.1rc1
|
||||
|
||||
|
||||
# Install Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install "mineru[api,gradio]>=2.7.6" \
|
||||
"matplotlib>=3.10,<4" \
|
||||
"ultralytics>=8.3.48,<9" \
|
||||
"doclayout_yolo==0.0.4" \
|
||||
"ftfy>=6.3.1,<7" \
|
||||
"shapely>=2.0.7,<3" \
|
||||
"pyclipper>=1.3.0,<2" \
|
||||
"omegaconf>=2.3.0,<3" \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
sed -i '1,200{s/self\.act = act_layer()/self.act = nn.GELU()/;t;b};' /root/miniconda/envs/vllm_kunlun_0.10.1.1/lib/python3.10/site-packages/vllm_kunlun/models/qwen2_vl.py && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,34 +0,0 @@
|
||||
# 基础镜像配置 vLLM 或 LMDeploy 推理环境,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + metax GPU。
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + metax GPU.
|
||||
FROM cr.metax-tech.com/public-ai-release/maca/vllm:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-amd64
|
||||
# Base image containing the LMDeploy inference environment, requiring amd64(x86-64) CPU + metax GPU.
|
||||
# FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/maca:maca.ai3.1.0.7-torch2.6-py310-ubuntu22.04-lmdeploy0.10.2-amd64
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig \
|
||||
libgl1 && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# mod torchvision to be compatible with torch 2.6
|
||||
RUN sed -i '3s/^Version: 0.15.1+metax3\.1\.0\.4$/Version: 0.21.0+metax3.1.0.4/' /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info/METADATA && \
|
||||
mv /opt/conda/lib/python3.10/site-packages/torchvision-0.15.1+metax3.1.0.4.dist-info /opt/conda/lib/python3.10/site-packages/torchvision-0.21.0+metax3.1.0.4.dist-info
|
||||
|
||||
# Install mineru latest
|
||||
RUN /opt/conda/bin/python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
/opt/conda/bin/python3 -m pip install 'mineru[core]>=2.6.5' \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
/opt/conda/bin/python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "/opt/conda/bin/mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,42 +0,0 @@
|
||||
# 基础镜像配置 vLLM 或 LMDeploy ,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + Cambricon MLU.
|
||||
# Base image containing the LMDEPLOY inference environment, requiring amd64(x86-64) CPU + Cambricon MLU.
|
||||
FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/camb:mineru25
|
||||
ARG BACKEND=lmdeploy
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + Cambricon MLU.
|
||||
# FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/mlu:vllm0.8.3-torch2.6.0-torchmlu1.26.1-ubuntu22.04-py310
|
||||
# ARG BACKEND=vllm
|
||||
|
||||
# Install Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN /bin/bash -c '\
|
||||
if [ "$BACKEND" = "vllm" ]; then \
|
||||
source /torch/venv3/pytorch_infer/bin/activate; \
|
||||
fi && \
|
||||
python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install "mineru[core]>=2.7.4" \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install $(if [ "$BACKEND" = "lmdeploy" ]; then echo "accelerate==1.2.0"; else echo "transformers==4.50.3"; fi) && \
|
||||
python3 -m pip cache purge'
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c '\
|
||||
if [ "$BACKEND" = "vllm" ]; then \
|
||||
source /torch/venv3/pytorch_infer/bin/activate; \
|
||||
fi && \
|
||||
mineru-models-download -s modelscope -m all'
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,38 +0,0 @@
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + MooreThreads GPU.
|
||||
FROM registry.mthreads.com/mcconline/vllm-musa-qy2-py310:v0.8.4-release
|
||||
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig \
|
||||
libgl1 && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
git clone https://gitcode.com/gh_mirrors/vi/vision.git -b v0.20.0 --depth 1 && \
|
||||
cd vision && \
|
||||
python3 setup.py install && \
|
||||
python3 -m pip install "mineru[api,gradio]>=2.7.2" \
|
||||
"matplotlib>=3.10,<4" \
|
||||
"ultralytics>=8.3.48,<9" \
|
||||
"doclayout_yolo==0.0.4" \
|
||||
"ftfy>=6.3.1,<7" \
|
||||
"shapely>=2.0.7,<3" \
|
||||
"pyclipper>=1.3.0,<2" \
|
||||
"omegaconf>=2.3.0,<3" \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,32 +0,0 @@
|
||||
# 基础镜像配置 vLLM 或 LMDeploy ,请根据实际需要选择其中一个,要求 ARM(AArch64) CPU + Ascend NPU。
|
||||
# Base image containing the vLLM inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
|
||||
FROM quay.m.daocloud.io/ascend/vllm-ascend:v0.11.0
|
||||
# Base image containing the LMDeploy inference environment, requiring ARM(AArch64) CPU + Ascend NPU.
|
||||
# FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ascend:mineru-a2
|
||||
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig \
|
||||
libgl1 \
|
||||
libglib2.0-0 && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install 'mineru[core]>=2.6.5' \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN TORCH_DEVICE_BACKEND_AUTOLOAD=0 /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,30 +0,0 @@
|
||||
# 基础镜像配置 vLLM 或 LMDeploy 推理环境,请根据实际需要选择其中一个,要求 amd64(x86-64) CPU + t-head PPU。
|
||||
# Base image containing the vLLM inference environment, requiring amd64(x86-64) CPU + t-head PPU.
|
||||
FROM crpi-vofi3w62lkohhxsp.cn-shanghai.personal.cr.aliyuncs.com/opendatalab-mineru/ppu:ppu-pytorch2.6.0-ubuntu24.04-cuda12.6-vllm0.8.5-py312
|
||||
# Base image containing the LMDeploy inference environment, requiring amd64(x86-64) CPU + t-head PPU.
|
||||
# FROM crpi-4crprmm5baj1v8iv.cn-hangzhou.personal.cr.aliyuncs.com/lmdeploy_dlinfer/ppu:mineru-ppu
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
fonts-noto-core \
|
||||
fonts-noto-cjk \
|
||||
fontconfig \
|
||||
libgl1 && \
|
||||
fc-cache -fv && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U pip -i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip install 'mineru[core]>=2.6.5' \
|
||||
numpy==1.26.4 \
|
||||
opencv-python==4.11.0.86 \
|
||||
-i https://mirrors.aliyun.com/pypi/simple && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
RUN /bin/bash -c "mineru-models-download -s modelscope -m all"
|
||||
|
||||
# Set the entry point to activate the virtual environment and run the command line tool
|
||||
ENTRYPOINT ["/bin/bash", "-c", "export MINERU_MODEL_SOURCE=local && exec \"$@\"", "--"]
|
||||
@@ -1,19 +1,21 @@
|
||||
services:
|
||||
mineru-openai-server:
|
||||
image: mineru:latest
|
||||
container_name: mineru-openai-server
|
||||
mineru-sglang-server:
|
||||
image: mineru-sglang:latest
|
||||
container_name: mineru-sglang-server
|
||||
restart: always
|
||||
profiles: ["openai-server"]
|
||||
profiles: ["sglang-server"]
|
||||
ports:
|
||||
- 30000:30000
|
||||
environment:
|
||||
MINERU_MODEL_SOURCE: local
|
||||
entrypoint: mineru-openai-server
|
||||
entrypoint: mineru-sglang-server
|
||||
command:
|
||||
--host 0.0.0.0
|
||||
--port 30000
|
||||
# --data-parallel-size 2 # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
|
||||
# --gpu-memory-utilization 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
# --enable-torch-compile # You can also enable torch.compile to accelerate inference speed by approximately 15%
|
||||
# --dp-size 2 # If using multiple GPUs, increase throughput using sglang's multi-GPU parallel mode
|
||||
# --tp-size 2 # If you have more than one GPU, you can expand available VRAM using tensor parallelism (TP) mode.
|
||||
# --mem-fraction-static 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
ulimits:
|
||||
memlock: -1
|
||||
stack: 67108864
|
||||
@@ -25,11 +27,11 @@ services:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
device_ids: ["0"] # Modify for multiple GPUs: ["0", "1"]
|
||||
device_ids: ["0"]
|
||||
capabilities: [gpu]
|
||||
|
||||
mineru-api:
|
||||
image: mineru:latest
|
||||
image: mineru-sglang:latest
|
||||
container_name: mineru-api
|
||||
restart: always
|
||||
profiles: ["api"]
|
||||
@@ -41,25 +43,25 @@ services:
|
||||
command:
|
||||
--host 0.0.0.0
|
||||
--port 8000
|
||||
# parameters for vllm-engine
|
||||
# --data-parallel-size 2 # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
|
||||
# --gpu-memory-utilization 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
# parameters for sglang-engine
|
||||
# --enable-torch-compile # You can also enable torch.compile to accelerate inference speed by approximately 15%
|
||||
# --dp-size 2 # If using multiple GPUs, increase throughput using sglang's multi-GPU parallel mode
|
||||
# --tp-size 2 # If you have more than one GPU, you can expand available VRAM using tensor parallelism (TP) mode.
|
||||
# --mem-fraction-static 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
ulimits:
|
||||
memlock: -1
|
||||
stack: 67108864
|
||||
ipc: host
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
device_ids: ["0"] # Modify for multiple GPUs: ["0", "1"]
|
||||
capabilities: [gpu]
|
||||
device_ids: [ "0" ]
|
||||
capabilities: [ gpu ]
|
||||
|
||||
mineru-gradio:
|
||||
image: mineru:latest
|
||||
image: mineru-sglang:latest
|
||||
container_name: mineru-gradio
|
||||
restart: always
|
||||
profiles: ["gradio"]
|
||||
@@ -71,11 +73,14 @@ services:
|
||||
command:
|
||||
--server-name 0.0.0.0
|
||||
--server-port 7860
|
||||
--enable-sglang-engine true # Enable the sglang engine for Gradio
|
||||
# --enable-api false # If you want to disable the API, set this to false
|
||||
# --max-convert-pages 20 # If you want to limit the number of pages for conversion, set this to a specific number
|
||||
# parameters for vllm-engine
|
||||
# --data-parallel-size 2 # If using multiple GPUs, increase throughput using vllm's multi-GPU parallel mode
|
||||
# --gpu-memory-utilization 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
# parameters for sglang-engine
|
||||
# --enable-torch-compile # You can also enable torch.compile to accelerate inference speed by approximately 15%
|
||||
# --dp-size 2 # If using multiple GPUs, increase throughput using sglang's multi-GPU parallel mode
|
||||
# --tp-size 2 # If you have more than one GPU, you can expand available VRAM using tensor parallelism (TP) mode.
|
||||
# --mem-fraction-static 0.5 # If running on a single GPU and encountering VRAM shortage, reduce the KV cache size by this parameter, if VRAM issues persist, try lowering it further to `0.4` or below.
|
||||
ulimits:
|
||||
memlock: -1
|
||||
stack: 67108864
|
||||
@@ -85,5 +90,5 @@ services:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
device_ids: ["0"] # Modify for multiple GPUs: ["0", "1"]
|
||||
capabilities: [gpu]
|
||||
device_ids: [ "0" ]
|
||||
capabilities: [ gpu ]
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Use the official vllm image for gpu with Volta、Turing、Ampere、Ada Lovelace、Hopper、Blackwell architecture (7.0 <= Compute Capability <= 12.0)
|
||||
# Compute Capability version query (https://developer.nvidia.com/cuda-gpus)
|
||||
# support x86_64 architecture and ARM(AArch64) architecture
|
||||
FROM vllm/vllm-openai:v0.11.2
|
||||
# Use the official sglang image
|
||||
FROM lmsysorg/sglang:v0.4.8.post1-cu126
|
||||
|
||||
# Install libgl for opencv support & Noto fonts for Chinese characters
|
||||
RUN apt-get update && \
|
||||
@@ -15,7 +13,7 @@ RUN apt-get update && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install mineru latest
|
||||
RUN python3 -m pip install -U 'mineru[core]>=2.7.0' --break-system-packages && \
|
||||
RUN python3 -m pip install -U 'mineru[core]' --break-system-packages && \
|
||||
python3 -m pip cache purge
|
||||
|
||||
# Download models and update the configuration file
|
||||
|
||||
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 88 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 261 KiB |
|
Before Width: | Height: | Size: 261 KiB |
|
Before Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 145 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 214 KiB |
|
Before Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 147 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 249 KiB |
|
Before Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 236 KiB |
|
Before Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 190 KiB |
|
Before Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 261 KiB |
|
Before Width: | Height: | Size: 286 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 133 KiB |
|
Before Width: | Height: | Size: 185 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 246 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 63 KiB |