-
Notifications
You must be signed in to change notification settings - Fork 178
[tools/onnx-subgraph] Add readme.md for environment and existing code #14725
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f7f39f3
[tools/onnx-subgraph] Add readme.md for environment and existing code
chenyx113 fdbb6e6
[tools/onnx-subgraph]recovery last version code
chenyx113 b9140f7
[tools/onnx-subgraph] update format issue as review comments
chenyx113 892aea4
update the format checking issue in readme.md
chenyx113 9fa575a
Update README.md format with target script type
chenyx113 bf95961
Update README.md remove blank space
chenyx113 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,54 @@ | ||
| # onnx_autosubgraph | ||
| onnx-subgraph tool provides model auto partitionioning of onnx model to several sub models by | ||
| operator, performance and model size limitations,with the order and input / output names of | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sub models | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # How to build the onnx-subgraph | ||
| ## OS environment dependence | ||
| 1. ubuntu >=20.04 | ||
| 2. GCC >= 9.4.0 | ||
| 3. cmake >= 3.10 | ||
| 4. python >= 3.8 | ||
| 5. apt-get install libprotobuf-dev protobuf-compiler libjsoncpp-dev | ||
|
|
||
| ## Python packages dependence | ||
| onnx 1.16.0 | ||
| onnxruntime 1.18.1 | ||
| onnxsim 0.4.36 | ||
| torch 2.3.1 | ||
| scikit-image | ||
| scikit-learn | ||
| pandas | ||
| tqdm | ||
|
|
||
| ## building the onnx-subgraph | ||
| 1. cd onnx-subgraph | ||
| 2. mkdir build & cd build | ||
| 3. cmake .. & make | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 4. we can get following output at ./build | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| └── scripts | ||
| ├── extract_onnx.py | ||
| └── test_model_download.sh | ||
| └── subgraphs_ios.txt | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # How to use the onnx-subgraph | ||
| ## Pre-steps | ||
| ### Download the test AI models | ||
| 1. bash scripts/test_model_download.sh, then "resnet-test.onnx" will be got in ./build | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 2. you can change to any other onnx files as your needs, or edit the download link in | ||
| "scripts/test_model_download.sh" | ||
|
|
||
| ## Parse the onnx model | ||
| note: subgraphs_ios.txt will be generated in future code, suppose we already have it as | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| the example file now | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Split the onnx model to subgraphs | ||
| 1. python scripts/extract_onnx.py \ | ||
| -s ./scripts/subgraphs_ios.txt \ | ||
| -m ./resnet-test.onnx | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| after extraction done, the subgraphs will be saved at './subgraphs' | ||
| subgraphs | ||
| ├── CPUsubgraph0.onnx | ||
| └── CPUsubgraph1.onnx | ||
| ├── NPUsubgraph0.onnx | ||
| └── NPUsubgraph1.onnx | ||
seanshpark marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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.