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

[feat] Adding Metaformer support #294

Merged
merged 1 commit into from
May 9, 2022
Merged

[feat] Adding Metaformer support #294

merged 1 commit into from
May 9, 2022

Conversation

blefaudeux
Copy link
Contributor

@blefaudeux blefaudeux commented May 5, 2022

What does this PR do?

Add a helper to generate a Metaformer config, and add an example to train it on Cifar10. Add some documentation about it

TODO

  • unit test

Before submitting

  • Did you have fun?
    • Make sure you had fun coding 🙃
  • Did you read the contributor guideline?
  • Was this discussed/approved via a Github issue? (no need for typos, doc improvements)
    • N/A
  • Did you make sure to update the docs?
    • N/A
  • Did you write any new necessary tests?
    • N/A
  • Did you update the changelog? (if needed)
    • N/A

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 5, 2022
@blefaudeux blefaudeux force-pushed the poolformer branch 2 times, most recently from 9820481 to 93ec973 Compare May 5, 2022 02:18
@codecov-commenter
Copy link

codecov-commenter commented May 5, 2022

Codecov Report

Merging #294 (2c24576) into main (5f75412) will increase coverage by 0.14%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #294      +/-   ##
==========================================
+ Coverage   92.80%   92.95%   +0.14%     
==========================================
  Files          64       65       +1     
  Lines        3489     3519      +30     
==========================================
+ Hits         3238     3271      +33     
+ Misses        251      248       -3     
Flag Coverage Δ
Python 92.95% <100.00%> (+0.14%) ⬆️

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

Impacted Files Coverage Δ
xformers/components/multi_head_dispatch.py 97.87% <100.00%> (ø)
xformers/factory/block_configs.py 90.62% <100.00%> (+1.26%) ⬆️
xformers/helpers/hierarchical_configs.py 100.00% <100.00%> (ø)
xformers/factory/block_factory.py 96.87% <0.00%> (+1.56%) ⬆️

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 5f75412...2c24576. Read the comment docs.

Base automatically changed from poolformer_swin to main May 5, 2022 17:04
@blefaudeux blefaudeux force-pushed the poolformer branch 3 times, most recently from 70a3c7d to 7a96bc3 Compare May 5, 2022 22:16
@blefaudeux blefaudeux requested review from dianaml0 and fmassa May 5, 2022 22:17
@blefaudeux
Copy link
Contributor Author

the coverage numbers should be fixed by the PR update, it's now properly tested

@blefaudeux blefaudeux force-pushed the poolformer branch 8 times, most recently from 327f447 to 550cff9 Compare May 7, 2022 18:08
Copy link
Contributor

@dianaml0 dianaml0 left a comment

Choose a reason for hiding this comment

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

Looks great!


### MicroMetaformer

This is very close to the MicroViT example above, but illustrating the use of a hierarchical Transformer ([Metaformer](https://arxiv.org/pdf/2111.11418.pdf)) this time, through a helper function which generates the required configuration given the pooling parameters. The suggested configuration is about 6.6M parameters big (half of a ResNet18) and trains to about 86% top-1 Cifar10 within minutes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@blefaudeux blefaudeux merged commit 90a1ec7 into main May 9, 2022
@blefaudeux blefaudeux deleted the poolformer branch May 9, 2022 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants