-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improvement(installation): add script install mmdeploy (#919)
* feat(tools): add build ubuntu x64 ncnn * ci(tools): add ncnn auto install * fix(ci): auto install ncnn * fix(tools): no interactive * docs(build): add script build * CI(ncnn): script install ncnn * docs(zh_cn): fix error os * fix * CI(tools/script): test ort install passed * update * CI(tools): support pplnn * CI(build): add pplnn * docs(tools): update * fix * CI(tools): script install torchscript * docs(build): add torchscript * fix(tools): clean code and doc * update * fix(CI): requirements install failed * debug CI * update * update * update * feat(tools/script): support user specify make jobs * fix(tools/script): fix build pplnn with cuda * fix(tools/script): torchscript add tips and simplify install mmcv * fix(tools/script): check nvcc version first * fix(tools/scripts): pplnn checkout * fix(CI): add simple check install succcess * fix * debug CI * fix * fix(CI): pplnn install mis wheel * fix(CI): build error * fix(CI): remove misleading message
- Loading branch information
1 parent
b1e7579
commit 4534598
Showing
19 changed files
with
1,018 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,39 @@ | ||
name: backend-ort | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
|
||
pull_request: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
- "docs/**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
script_install: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install mmdeploy | ||
run: | | ||
python3 tools/scripts/build_ubuntu_x64_ort.py | ||
python3 -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu | ||
python3 -m pip install mmcv-full==1.5.1 -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html | ||
python3 -c 'import mmdeploy.apis.onnxruntime as ort_api; assert ort_api.is_available() and ort_api.is_custom_ops_available()' |
This file contains 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,39 @@ | ||
name: backend-pplnn | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
|
||
pull_request: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
- "docs/**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
script_install: | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install mmdeploy | ||
run: | | ||
python3 tools/scripts/build_ubuntu_x64_pplnn.py | ||
python3 -m pip install torch==1.8.2 torchvision==0.9.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cpu | ||
python3 -m pip install mmcv-full==1.5.1 -f https://download.openmmlab.com/mmcv/dist/cpu/torch1.8.0/index.html | ||
python3 -c 'import mmdeploy.apis.pplnn as pplnn_api; assert pplnn_api.is_available()' |
This file contains 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,36 @@ | ||
name: backend-ort | ||
|
||
on: | ||
push: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
|
||
pull_request: | ||
paths-ignore: | ||
- "demo/**" | ||
- "tools/**" | ||
- "docs/**" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
script_install: | ||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
python-version: [3.7] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install mmdeploy | ||
run: | | ||
python3 tools/scripts/build_ubuntu_x64_torchscript.py |
This file contains 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
This file contains 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
This file contains 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,31 @@ | ||
# Build from Script | ||
|
||
Through user investigation, we know that most users are already familiar with python and torch before using mmdeploy. Therefore we provide scripts to simplify mmdeploy installation. | ||
|
||
Assuming you have a python ready (whether `conda` or `pyenv`), run this script to install mmdeploy + ncnn backend, `nproc` is not compulsory. | ||
|
||
```bash | ||
$ cd /path/to/mmdeploy | ||
$ python3 tools/scripts/build_ubuntu_x64_ncnn.py $(nproc) | ||
.. | ||
``` | ||
|
||
A sudo password may be required during this time, and the script will try its best to build and install mmdeploy SDK and demo: | ||
|
||
- Detect host OS version, `make` job number, whether use `root` and try to fix `python3 -m pip` | ||
- Find the necessary basic tools, such as g++-7, cmake, wget, etc. | ||
- Compile necessary dependencies, such as pyncnn, protobuf | ||
|
||
The script will also try to avoid affecting host environment: | ||
|
||
- The dependencies of source code compilation are placed in the `mmdeploy-dep` directory at the same level as mmdeploy | ||
- The script would not modify variables such as PATH, LD_LIBRARY_PATH, PYTHONPATH, etc. | ||
|
||
Here is the verified installation script. If you want mmdeploy to support multiple backends at the same time, you can execute each script once: | ||
|
||
| script | OS version | | ||
| :-----------------------------: | :---------: | | ||
| build_ubuntu_x64_ncnn.py | 18.04/20.04 | | ||
| build_ubuntu_x64_ort.py | 18.04/20.04 | | ||
| build_ubuntu_x64_pplnn.py | 18.04/20.04 | | ||
| build_ubuntu_x64_torchscript.py | 18.04/20.04 | |
This file contains 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Build From Source | ||
# Build from Source | ||
|
||
## Download | ||
|
||
|
This file contains 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
This file contains 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
This file contains 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,31 @@ | ||
# 一键式脚本安装 | ||
|
||
通过用户调研,我们得知多数使用者在了解 mmdeploy 前,已经熟知 python 和 torch 用法。因此我们提供脚本简化 mmdeploy 安装。 | ||
|
||
假设您已经准备好 Python3.6 pip 以上环境(无论 conda 或 pyenv),运行这个脚本来安装 mmdeploy + ncnn backend,`nproc` 可以不指定。 | ||
|
||
```bash | ||
$ cd /path/to/mmdeploy | ||
$ python3 tools/scripts/build_ubuntu_x64_ncnn.py $(nproc) | ||
.. | ||
``` | ||
|
||
期间可能需要 sudo 密码,脚本会尽最大努力完成 mmdeploy SDK 和 demo: | ||
|
||
- 检测系统版本、make 使用的 job 个数、是否 root 用户,也会自动修复 pip 问题 | ||
- 寻找必须的基础工具,如 g++-7、cmake、wget 等 | ||
- 编译必须的依赖,如 pyncnn、 protobuf | ||
|
||
脚本也会尽量避免影响 host 环境: | ||
|
||
- 源码编译的依赖,都放在与 mmdeploy 同级的 `mmdeploy-dep` 目录中 | ||
- 不会主动修改 PATH、LD_LIBRARY_PATH、PYTHONPATH 等变量 | ||
|
||
这是已验证的安装脚本。如果想让 mmdeploy 同时支持多种 backend,每个脚本执行一次即可: | ||
|
||
| script | OS version | | ||
| :-----------------------------: | :---------: | | ||
| build_ubuntu_x64_ncnn.py | 18.04/20.04 | | ||
| build_ubuntu_x64_ort.py | 18.04/20.04 | | ||
| build_ubuntu_x64_pplnn.py | 18.04/20.04 | | ||
| build_ubuntu_x64_torchscript.py | 18.04/20.04 | |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.