-
Notifications
You must be signed in to change notification settings - Fork 649
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
[WIP]: improvement(ViT): fuse nn.Linear and convert Gather to Crop #442
Closed
Conversation
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
* docs(docs/zh_cn): add doc and link checker * docs(REAME): update * docs(docs/zh_cn): update * docs(benchmark): update table * docs(zh_cn/benchmark): update link * CI(docs): update link check * ci(doc): update checker * docs(zh_cn): update * style(ci): remove useless para * style(ci): update * docs(zh_cn): update * docs(benchmark.md): fix mobilnet link error * docs(docs/zh_cn): add doc and link checker * docs(REAME): update * docs(docs/zh_cn): update * docs(benchmark): update table * docs(zh_cn/benchmark): update link * CI(docs): update link check * ci(doc): update checker * docs(zh_cn): update * style(ci): remove useless para * style(ci): update * docs(zh_cn): update * docs(benchmark.md): fix mobilnet link error * docs(zh_cn/do_regression_test.md): rebase * docs(docs/zh_cn): add doc and link checker * Update README_zh-CN.md * Update README_zh-CN.md * Update index.rst * Update check-doc-link.yml * [Fix] Fix ci (open-mmlab#426) * fix ci * add nvidia key * remote torch * recover pytorch * ci(codecov): ignore ci * docs(zh_cn): add get_started.md * docs(zh_cn): fix review advice * docs(readthedocs): update * docs(zh_CN): update * docs(zh_CN): revert * fix(docs): review advices * fix(docs): review advices * fix(docs): review Co-authored-by: q.yao <[email protected]>
tpoisonooo
changed the title
WIP: improvement(ViT): fuse nn.Linear and convert Gather to Crop
improvement(ViT): fuse nn.Linear and convert Gather to Crop
May 9, 2022
grimoire
reviewed
May 12, 2022
mmdeploy/pytorch/ops/linear.py
Outdated
backend=Backend.NCNN.value) | ||
def linear__ncnn(ctx, g, input, weight, bias): | ||
"""Support export linear This rewrite enable export Gemm.""" | ||
return g.op( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grimoire
reviewed
May 12, 2022
def linear__ncnn(ctx, g, input, weight, bias): | ||
"""Support export linear This rewrite enable export Gemm.""" | ||
return g.op( | ||
'mmdeploy::Gemm', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove mmdeploy
domain? It looks like the same as the official one ONNX Gemm
* docs(zh_CN): fix link missing * docs(benchmark.md): fix pytorch typo
* refactor(onnx2ncnn.cpp): split it to shape_inference, pass and utils * refactor(onnx2ncnn.cpp): split it to shape_inference, pass and utils * refactor(onnx2ncnn.cpp): split code * refactor(net_module.cpp): fix build error * ci(test_onnx2ncnn.py): add generate model adn run * ci(onnx2ncnn): add ncnn backend * ci(test_onnx2ncnn): add converted onnx model` * ci(onnx2ncnn): fix ncnn tar * ci(backed-ncnn): simplify dependency install * ci(onnx2ncnn): fix apt install * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * Update backend-ncnn.yml * fix(ci): add include algorithm * Update build.yml * parent aa85760 author q.yao <[email protected]> 1651287879 +0800 committer tpoisonooo <[email protected]> 1652169959 +0800 [Fix] Fix ci (open-mmlab#426) * fix ci * add nvidia key * remote torch * recover pytorch refactor(onnx2ncnn.cpp): split it to shape_inference, pass and utils * fix(onnx2ncnn): review * fix(onnx2ncnn): build error Co-authored-by: q.yao <[email protected]>
tpoisonooo
changed the title
improvement(ViT): fuse nn.Linear and convert Gather to Crop
[WIP]: improvement(ViT): fuse nn.Linear and convert Gather to Crop
May 16, 2022
close this PR because of bad |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.
Motivation
Fix review advices from Tencent/ncnn#3730
Modification
end2end.param
(289 --> 195)Crop axis=0 starts=0 ends=1
opr instead ofGather axis=0 indices=[0]
in ViT.paramBC-breaking (Optional)
Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.
Checklist