-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix resolution problem for swin transformer and clip vit #3021
Merged
cuicheng01
merged 7 commits into
PaddlePaddle:develop
from
psky1111:Hackathon-5th-Paddleclas-project
Oct 31, 2023
Merged
fix resolution problem for swin transformer and clip vit #3021
cuicheng01
merged 7 commits into
PaddlePaddle:develop
from
psky1111:Hackathon-5th-Paddleclas-project
Oct 31, 2023
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
Update .gitignore fix time cost problem Update swin_transformer.py fix the speed and memory problem reduce the unnecessary calculation when patch matches resolution fix conflict remove check resolution function Revert "fix conflict" This reverts commit d7a7dad. fix conflict remove the conflict checkpoint function 【Hackathon 5th No.69】 分类大模型--人体视觉任务SOLIDER (PaddlePaddle#2995) * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider * add_solider update doc about PPHGNetV2 (PaddlePaddle#3002) fix clip patch embedding resolution problem support non 224 resolution integrate the pading function to one adjust function name fix the resolution problem for clip-vision transformer part and swim transformer fix the resolution problem for clip-vision transformer part and swim transformer
Thanks for your contribution! |
测试代码,其中 swin_bug_version与vit_bug_version为未修改前的版本. swin from release2.5分支, vit_bug_version from develop分支. import paddle
from ppcls.arch.backbone.legendary_models import swin_transformer
from ppcls.arch.backbone.model_zoo.foundation_vit import VisionTransformer
from ppcls.arch.backbone.legendary_models import swin_bug_version
from ppcls.arch.backbone.model_zoo import vit_bug_version
from ppcls.utils.logger import init_logger
import datetime
if __name__ == "__main__":
init_logger()
inputs_ori = paddle.ones((30,3,224,224))
inputs_our = paddle.ones((30,3,221,221))
swim = swin_transformer.SwinTransformer()
baseline_swim = swin_bug_version.SwinTransformer()
baseline_vit = vit_bug_version.VisionTransformer("CLIP_vit_base_patch16_224")
vit = VisionTransformer("CLIP_vit_base_patch16_224")
# multi-resolution version
start = datetime.datetime.now()
outputs = swim(inputs_ori)
cur = datetime.datetime.now()
print(f"swin: using 224 resolution cost {cur-start}")
# ori version
start = datetime.datetime.now()
outputs = baseline_swim(inputs_ori)
cur = datetime.datetime.now()
print(f"ori_swin: using 224 resolution cost {cur-start}")
start = datetime.datetime.now()
outputs = swim(inputs_our)
cur = datetime.datetime.now()
print(f"swin: using 221 resolution cost {cur-start}")
# multi-resolution version
start = datetime.datetime.now()
outputs = vit(inputs_ori)
cur = datetime.datetime.now()
print(f"vit: using 224 resolution cost {cur-start}")
# ori version
start = datetime.datetime.now()
outputs = baseline_vit(inputs_ori)
cur = datetime.datetime.now()
print(f"ori_vit: using 224 resolution cost {cur-start}")
start = datetime.datetime.now()
outputs = vit(inputs_our)
cur = datetime.datetime.now()
print(f"vit: using 221 resolution cost {cur-start}")
|
using the huggingface plan and drop the cache
cuicheng01
approved these changes
Oct 31, 2023
psky1111
added a commit
to psky1111/PaddleClas
that referenced
this pull request
Nov 3, 2023
…dlePaddle#3021)" This reverts commit 61f748d.
psky1111
added a commit
to psky1111/PaddleClas
that referenced
this pull request
Nov 3, 2023
…vit (PaddlePaddle#3021)"" This reverts commit 174db43.
psky1111
added a commit
to psky1111/PaddleClas
that referenced
this pull request
Nov 3, 2023
…vit (PaddlePaddle#3021)"" This reverts commit 174db43. Update foundation_vit.py Update foundation_vit.py Revert "fix resolution problem for swin transformer and clip vit (PaddlePaddle#3021)" This reverts commit 61f748d.
shiyutang
added
the
Contributor PR is merged
add this when a contributor's PR is merged.
label
Nov 8, 2023
cuicheng01
pushed a commit
that referenced
this pull request
Feb 6, 2024
* fix the resolution problem for clip-vision transformer part and swim transformer fix the resolution problem for clip-vision transformer part and swim transformer * Revert "Revert "fix resolution problem for swin transformer and clip vit (#3021)"" This reverts commit 174db43. Update foundation_vit.py Update foundation_vit.py Revert "fix resolution problem for swin transformer and clip vit (#3021)" This reverts commit 61f748d. * add backbone function * fix static graph problem * remove text encoder framework and add classifier header directly * fix bug in clip when using classifier header * updated * support embeding Note, support embed is only for check the model since there is no related text encoder * compatible with param transfer * update setting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
fix time cost problem