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] Add Tokens-to-Token ViT backbone and converted checkpoints. #467

Merged
merged 20 commits into from
Oct 29, 2021

Conversation

mzr1996
Copy link
Member

@mzr1996 mzr1996 commented Sep 28, 2021

Motivation

Continue @HIT-cwh's work

Modification

As the title.
This PR depends on #395, please review that PR at first.

BC-breaking (Optional)

No.

Use cases (Optional)

No.

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 Sep 28, 2021

Codecov Report

Merging #467 (844ead1) into master (08bf04e) will increase coverage by 0.64%.
The diff coverage is 94.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #467      +/-   ##
==========================================
+ Coverage   78.77%   79.42%   +0.64%     
==========================================
  Files         103      106       +3     
  Lines        5702     5959     +257     
  Branches      927      962      +35     
==========================================
+ Hits         4492     4733     +241     
- Misses       1088     1095       +7     
- Partials      122      131       +9     
Flag Coverage Δ
unittests 79.42% <94.53%> (+0.64%) ⬆️

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

Impacted Files Coverage Δ
mmcls/models/backbones/t2t_vit.py 94.40% <94.40%> (ø)
mmcls/datasets/pipelines/auto_augment.py 79.18% <100.00%> (+0.04%) ⬆️
mmcls/models/backbones/__init__.py 100.00% <100.00%> (ø)
mmcls/datasets/__init__.py 100.00% <0.00%> (ø)
mmcls/models/losses/__init__.py 100.00% <0.00%> (ø)
mmcls/datasets/imagenet21k.py 81.69% <0.00%> (ø)
mmcls/models/losses/seesaw_loss.py 94.73% <0.00%> (ø)
mmcls/datasets/base_dataset.py 91.95% <0.00%> (+1.14%) ⬆️
mmcls/models/utils/attention.py 100.00% <0.00%> (+1.27%) ⬆️
mmcls/datasets/imagenet.py 34.04% <0.00%> (+8.51%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08bf04e...844ead1. Read the comment docs.

configs/t2t_vit/README.md Show resolved Hide resolved
assert out_indices[i] >= 0, f'Invalid out_indices {index}'
self.out_indices = out_indices

dpr = [x for x in np.linspace(0, drop_path_rate, num_layers)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

dpr could be "droppath rates" or "drop rates".
it is better to use droppath_rates.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, but dpr is used in VisionTransformer and SwinTransformer, and it's a conventional usage.

mmcls/models/backbones/t2t_vit.py Show resolved Hide resolved
mmcls/models/backbones/t2t_vit.py Show resolved Hide resolved
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.

@mzr1996 mzr1996 merged commit fffa30d into open-mmlab:master Oct 29, 2021
mzr1996 added a commit to mzr1996/mmpretrain that referenced this pull request Nov 24, 2022
…open-mmlab#467)

* add t2t backbone

* register t2t_vit

* add t2t_vit config

* [Temp] Align posterize transform with timm.

* Fix lint

* Refactor t2t-vit

* Add config for t2t-vit

* Add metafile and README for t2t-vit

* Add unit tests

* configs

* Update metafile and README

* Improve docstring

* Fix batch size which should be 8x64 instead of 8x128

* Fix typo

* Update model zoo

* Update training augments config.

* Move some arguments of T2TModule to T2TViT

* Update docs.

* Update unit test

Co-authored-by: HIT-cwh <[email protected]>
@mzr1996 mzr1996 deleted the add-t2t branch December 7, 2022 02:08
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.

3 participants