Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Add NPU support #1419

Merged
merged 18 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7990e7d
feat(model): add npu support and optimize table model
myhloli Dec 26, 2024
50f4841
refactor(device): optimize memory cleaning and device selection
myhloli Dec 26, 2024
dc0d30f
build: add openai to requirements-docker.txt
myhloli Dec 27, 2024
2e87e64
build(deps): update pydantic to latest version
myhloli Dec 30, 2024
2684e77
fix(npu): correct module name for NPU operations
myhloli Dec 30, 2024
88b909e
refactor(magic_pdf): comment out npu-related code
myhloli Dec 30, 2024
7c5cdcd
refactor(pdf_parse): improve character spacing handling in PDF text e…
myhloli Jan 2, 2025
512adb6
feat(model): add onnxruntime support for paddleocr on cpu
myhloli Jan 3, 2025
04febf5
refactor(ocr): comment out unnecessary log statement
myhloli Jan 3, 2025
16a0a35
fix(magic-pdf): update OCR model selection logic
myhloli Jan 5, 2025
9951a17
style(pdf_parse_union_core_v2): remove unnecessary spaces and improve…
myhloli Jan 5, 2025
f911a10
feat(tools): add character bounding box drawing functionality
myhloli Jan 5, 2025
2e8601a
docs(README): update documentation for NPU support
myhloli Jan 5, 2025
ad09980
build(docker): add Dockerfiles for global and Huawei NPU setups
myhloli Jan 6, 2025
0f1dff1
Merge remote-tracking branch 'origin/dev' into dev
myhloli Jan 6, 2025
36c3ad6
build(docker): update Dockerfiles and download scripts
myhloli Jan 6, 2025
2e1bf88
build(docker): update Dockerfiles for China and Huawei NPU versions
myhloli Jan 6, 2025
8a0aa7a
Merge branch 'dev' into dev
myhloli Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
<li><a href="#online-demo">Online Demo</a></li>
<li><a href="#quick-cpu-demo">Quick CPU Demo</a></li>
<li><a href="#using-gpu">Using GPU</a></li>
<li><a href="#using-npu">Using NPU</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a>
Expand Down Expand Up @@ -129,7 +130,7 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
- 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 both CPU and GPU environments.
- Supports running in a pure CPU environment, and also supports GPU/NPU acceleration
- Compatible with Windows, Linux, and Mac platforms.

## Quick Start
Expand All @@ -141,6 +142,7 @@ There are three different ways to experience MinerU:
- [Online Demo (No Installation Required)](#online-demo)
- [Quick CPU Demo (Windows, Linux, Mac)](#quick-cpu-demo)
- [Linux/Windows + CUDA](#Using-GPU)
- [Linux + CANN](#using-npu)

> [!WARNING]
> **Pre-installation Notice—Hardware and Software Environment Support**
Expand All @@ -156,20 +158,24 @@ There are three different ways to experience MinerU:
<td colspan="3" rowspan="2">Operating System</td>
</tr>
<tr>
<td>Ubuntu 22.04 LTS</td>
<td>Linux after 2019</td>
<td>Windows 10 / 11</td>
<td>macOS 11+</td>
</tr>
<tr>
<td colspan="3">CPU</td>
<td>x86_64(unsupported ARM Linux)</td>
<td>x86_64 / arm64</td>
<td>x86_64(unsupported ARM Windows)</td>
<td>x86_64 / arm64</td>
</tr>
<tr>
<td colspan="3">Memory</td>
<td colspan="3">Memory Requirements</td>
<td colspan="3">16GB or more, recommended 32GB+</td>
</tr>
<tr>
<td colspan="3">Storage Requirements</td>
<td colspan="3">20GB or more, with a preference for SSD</td>
</tr>
<tr>
<td colspan="3">Python Version</td>
<td colspan="3">3.10(Please make sure to create a Python 3.10 virtual environment using conda)</td>
Expand All @@ -186,6 +192,12 @@ There are three different ways to experience MinerU:
<td>11.8 (manual installation) + cuDNN v8.7.0 (manual installation)</td>
<td>None</td>
</tr>
<tr>
<td colspan="3">CANN Environment(NPU support)</td>
<td>8.0+(Ascend 910b)</td>
<td>None</td>
<td>None</td>
</tr>
<tr>
<td rowspan="2">GPU Hardware Support List</td>
<td colspan="2">GPU VRAM 8GB or more</td>
Expand Down Expand Up @@ -267,12 +279,17 @@ If your device supports CUDA and meets the GPU requirements of the mainline envi
> docker run --rm --gpus=all nvidia/cuda:12.1.0-base-ubuntu22.04 nvidia-smi
> ```
```bash
wget https://github.com/opendatalab/MinerU/raw/master/Dockerfile
wget https://github.com/opendatalab/MinerU/raw/master/docker/global/Dockerfile -O Dockerfile
docker build -t mineru:latest .
docker run --rm -it --gpus=all mineru:latest /bin/bash
magic-pdf --help
```

### Using NPU

If your device has NPU acceleration hardware, you can follow the tutorial below to use NPU acceleration:


## Usage

### Command Line
Expand Down
Loading
Loading