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

[Refactor] Re-write get_sinusoid_encoding from third-party implementation #965

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

hukkai
Copy link

@hukkai hukkai commented Aug 12, 2022

Motivation

The function get_sinusoid_encoding implemented here (https://github.com/open-mmlab/mmclassification/blob/master/mmcls/models/backbones/t2t_vit.py#L216-#L242) is copied from a third-party implementation (https://github.com/jadore801120/attention-is-all-you-need-pytorch/blob/master/transformer/Models.py#L31), while we did not point this out. I re-write the numpy based implementation with pytorch.

Modification

Rewrite the function at mmcls/models/backbones/t2t_vit.py and add the unit test at tests/test_models/test_backbones/test_t2t_vit.py.

BC-breaking (Optional)

Does the modification introduce changes that break the backward compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here and update the documentation.

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.

@CLAassistant
Copy link

CLAassistant commented Aug 12, 2022

CLA assistant check
All committers have signed the CLA.

@mzr1996 mzr1996 changed the base branch from master to dev September 13, 2022 07:24
@mzr1996 mzr1996 merged commit 0b4a67d into open-mmlab:dev Sep 13, 2022
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