-
Notifications
You must be signed in to change notification settings - Fork 460
Create install_npu.md #226
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Install with NPU Support | ||
| 此向导仅用于在NPU上运行monkey-ocr,需提前下载模型权重到/root/.cache目录,已在910B4显卡上面做过验证,后端使用vllm_queue, 性能大致0.7page/s。 | ||
| # step1: 下载vllm-ascend镜像并启动,需要vllm-ascend:v0.9.2rc1及更高版本 | ||
| ``` | ||
| # Update DEVICE according to your device (/dev/davinci[0-7]) | ||
| export DEVICE=/dev/davinci0 | ||
| # Update the vllm-ascend image | ||
| export IMAGE=quay.io/ascend/vllm-ascend:v0.9.2rc1 | ||
| docker run --rm \ | ||
| --name vllm-ascend \ | ||
| --device $DEVICE \ | ||
| --device /dev/davinci_manager \ | ||
| --device /dev/devmm_svm \ | ||
| --device /dev/hisi_hdc \ | ||
| -v /usr/local/dcmi:/usr/local/dcmi \ | ||
| -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \ | ||
| -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \ | ||
| -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \ | ||
| -v /etc/ascend_install.info:/etc/ascend_install.info \ | ||
| -v /root/.cache:/root/.cache \ | ||
| -p 8000:8000 \ | ||
| -it $IMAGE bash | ||
| ``` | ||
| # step2: 进入镜像内部安装对应的包 | ||
| ``` | ||
| git clone https://github.com/Yuliang-Liu/MonkeyOCR.git | ||
| cd MonkeyOCR | ||
| pip install -e . | ||
| # 下面的命令不执行会报错缺少一些opencv图形化显示的so,我们不需要 | ||
| pip uninstall opencv-python-headless opencv-python -y | ||
| pip install opencv-python-headless==4.11.0.86 | ||
| ``` | ||
| # step3:修改model_config.yaml配置 | ||
| ``` | ||
| device: npu | ||
| weights: | ||
| doclayout_yolo: Structure/doclayout_yolo_docstructbench_imgsz1280_2501.pt # or Structure/layout_zh.pt | ||
| # PP-DocLayout_plus-L: Structure/PP-DocLayout_plus-L | ||
| layoutreader: Relation | ||
| layout_config: | ||
| model: doclayout_yolo # PP-DocLayout_plus-L (MonkeyOCR-pro, npu不支持) / doclayout_yolo (MonkeyOCR) | ||
| reader: | ||
| name: layoutreader | ||
| models_dir: /root/.cache | ||
| chat_config: | ||
| weight_path: /root/.cache/Recognition | ||
| backend: vllm_queue | ||
| ... | ||
| ``` | ||
| # step4: 启动服务 | ||
| ``` | ||
| export VLLM_WORKER_MULTIPROC_METHOD=spawn | ||
| export VLLM_USE_V1=1 | ||
| # 可选,如果是卡0可以不设置 | ||
| export ASCEND_RT_VISIBLE_DEVICEAS=0 | ||
| univcore api.main:app --host 0.0.0.0 --port 8000 | ||
| ``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.