Skip to content
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

[Feature] Support ViT-Adapter #1209

Open
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

okotaku
Copy link
Collaborator

@okotaku okotaku commented Nov 21, 2022

Motivation

paper: https://arxiv.org/abs/2205.08534
code: https://github.com/czczup/ViT-Adapter
issue: open-mmlab/mmdetection#9044

Related PR

open-mmlab/mmdetection#9354
open-mmlab/mmcv#2451
open-mmlab/mmcv#2452

Remaining task

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects, like MMDet or MMSeg.
  • CLA has been signed and all committers have signed the CLA in this PR.

@codecov
Copy link

codecov bot commented Nov 21, 2022

Codecov Report

Patch coverage has no change and project coverage change: +87.08 🎉

Comparison is base (b8b31e9) 0.02% compared to head (f22e021) 87.11%.

❗ Current head f22e021 differs from pull request most recent head c92beda. Consider uploading reports for the commit c92beda to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##           dev-1.x    #1209       +/-   ##
============================================
+ Coverage     0.02%   87.11%   +87.08%     
============================================
  Files          121      170       +49     
  Lines         8217    14356     +6139     
  Branches      1368     2267      +899     
============================================
+ Hits             2    12506    +12504     
+ Misses        8215     1449     -6766     
- Partials         0      401      +401     
Flag Coverage Δ
unittests 87.11% <ø> (+87.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcls/datasets/transforms/compose.py
mmcls/models/backbones/replknet.py 93.00% <0.00%> (ø)
mmcls/datasets/inshop.py 100.00% <0.00%> (ø)
mmcls/models/retrievers/__init__.py 100.00% <0.00%> (ø)
mmcls/engine/optimizers/adan_t.py 10.60% <0.00%> (ø)
mmcls/engine/hooks/switch_recipe_hook.py 88.46% <0.00%> (ø)
mmcls/models/backbones/tinyvit.py 91.20% <0.00%> (ø)
mmcls/models/heads/vig_head.py 42.30% <0.00%> (ø)
mmcls/models/backbones/mobileone.py 94.47% <0.00%> (ø)
mmcls/utils/analyze.py 100.00% <0.00%> (ø)
... and 161 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@okotaku okotaku changed the title [Feature] Support ViT-Adapter [WIP][Feature] Support ViT-Adapter Nov 24, 2022
@okotaku okotaku changed the title [WIP][Feature] Support ViT-Adapter [Feature] Support ViT-Adapter Dec 15, 2022
@okotaku
Copy link
Collaborator Author

okotaku commented Dec 15, 2022

There are several points of concern, including

・Duplication of ViTAdapter and BEiTAdapter
・Implementation of is_cls_token for BEiTAttention

Please review.

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Dec 15, 2022

There are several points of concern, including

・Duplication of ViTAdapter and BEiTAdapter ・Implementation of is_cls_token for BEiTAttention

Please review.

Get it, we will review it soon. We will try to merge it into the new version.

@Ezra-Yu
Copy link
Collaborator

Ezra-Yu commented Dec 16, 2022

Implementation of is_cls_token for BEiTAttention

is the is_cls_token the same as with_cls_token? but the num_extra_tokens seems to be 1 in your code and to be 3 in here.

mmcls/models/backbones/vit_adapter.py Outdated Show resolved Hide resolved
mmcls/models/backbones/vit_adapter.py Outdated Show resolved Hide resolved
mmcls/models/backbones/vit_adapter.py Show resolved Hide resolved
mmcls/models/utils/attention.py Show resolved Hide resolved
mmcls/models/utils/attention.py Outdated Show resolved Hide resolved
docs/en/api/models.rst Show resolved Hide resolved
mmcls/models/backbones/vision_transformer.py Outdated Show resolved Hide resolved
mmcls/models/backbones/beit.py Outdated Show resolved Hide resolved
mmcls/models/backbones/vit_adapter.py Show resolved Hide resolved
mmcls/models/backbones/vit_adapter.py Outdated Show resolved Hide resolved
@Ezra-Yu Ezra-Yu self-requested a review March 2, 2023 02:12
Copy link
Collaborator

@Ezra-Yu Ezra-Yu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Ezra-Yu Ezra-Yu changed the base branch from dev-1.x to main April 7, 2023 02:37
@fangyixiao18 fangyixiao18 mentioned this pull request Apr 14, 2023
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants