Skip to content

[Fix] Fix some vit init bugs#609

Merged
xvjiarui merged 8 commits intoopen-mmlab:masterfrom
clownrat6:vit_init_refactor
Jun 19, 2021
Merged

[Fix] Fix some vit init bugs#609
xvjiarui merged 8 commits intoopen-mmlab:masterfrom
clownrat6:vit_init_refactor

Conversation

@clownrat6
Copy link
Copy Markdown
Contributor

  1. Fix some new style parameters init bug for vit.

  2. Add some unit test for vit to improve code cov.

@clownrat6 clownrat6 requested a review from xvjiarui June 18, 2021 19:29
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 18, 2021

Codecov Report

Merging #609 (6f6502a) into master (0076913) will increase coverage by 0.11%.
The diff coverage is 85.71%.

❗ Current head 6f6502a differs from pull request most recent head 72178ca. Consider uploading reports for the commit 72178ca to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #609      +/-   ##
==========================================
+ Coverage   85.45%   85.57%   +0.11%     
==========================================
  Files         101      101              
  Lines        5220     5226       +6     
  Branches      840      842       +2     
==========================================
+ Hits         4461     4472      +11     
+ Misses        586      583       -3     
+ Partials      173      171       -2     
Flag Coverage Δ
unittests 85.57% <85.71%> (+0.11%) ⬆️

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

Impacted Files Coverage Δ
mmseg/models/utils/timm_convert.py 7.69% <ø> (+0.28%) ⬆️
mmseg/models/backbones/vit.py 86.66% <85.71%> (+2.85%) ⬆️

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 0076913...72178ca. Read the comment docs.

self.load_state_dict(state_dict, False)

elif pretrained is None:
elif isinstance(self.pretrained, type(None)):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is None

act_cfg (dict): The activation config for FFNs.
Defalut: dict(type='GELU').
final_norm (bool): Whether to add a additional layer to normalize
first_norm (bool): Whether to add a norm in PatchEmbed Block.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
first_norm (bool): Whether to add a norm in PatchEmbed Block.
patch_norm (bool): Whether to add a norm in PatchEmbed Block.

Comment on lines +270 to +275
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=None)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=None)
self.patch_embed = PatchEmbed(
img_size=img_size,
patch_size=patch_size,
in_channels=in_channels,
embed_dim=embed_dims,
norm_cfg=norm_cfg if patch_norm else None)

@xvjiarui xvjiarui merged commit 0c4c3b7 into open-mmlab:master Jun 19, 2021
bowenroom pushed a commit to bowenroom/mmsegmentation that referenced this pull request Feb 25, 2022
* [Fix] Fix vit init bug

* Add some vit unit tests

* Modify module import

* Fix pretrain weights bug

* Modify pretrained judge

* Add some unit tests to improve code cov

* Optimize code

* Fix vit unit test
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
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