-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Attention block] relative positional embedding #7346
[Attention block] relative positional embedding #7346
Conversation
67ccdbe
to
a46b374
Compare
c1d9754
to
57fc23b
Compare
I wonder if this is an example of the point we should start splitting out different types of attention block into their own blocks? Thoughts @KumoLiu @ericspod ? Note this also will have some merge conflicts as it stands with the local window pr |
@marksgraham @KumoLiu I feel with the generative merging in progress we should think about refactoring how these blocks work in general to try and separate these differing features into separate classes. We can perhaps have a single attention block class that is customisable with features, but if not we can do multiple classes but doing this cleanly will probably involve refactoring the existing things that have been merged from GenerativeModels. This PR adds something good however so we should keep this open but postpone until we have the other things merged perhaps. |
4b2c852
to
fa72b81
Compare
Following @ericspod suggestions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick update, looks cleaner now. Only have a few concern inline.
I think this is looking much better. Would it be possible to merge into |
target branch updated to |
Hi @vgrau98, could you please try |
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: vgrau98 <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Co-authored-by: Eric Kerfoot <[email protected]> Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
Signed-off-by: vgrau98 <[email protected]>
d75b341
to
6fb51f5
Compare
should be ok now |
/build |
Yes, I'm creating another PR to fix the error caused by the upgrade of flake8-bugbear You can either cherry-pick that one or make the same change in this PR. |
/build |
Fixes Project-MONAI#7356 ### Description Add relative positinoal embedding in attention block as described in https://arxiv.org/pdf/2112.01526.pdf Largely inspired by https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/modeling/image_encoder.py Can be useful for Project-MONAI#6357 ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: vgrau98 <[email protected]> Signed-off-by: vgrau98 <[email protected]> Co-authored-by: Eric Kerfoot <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: YunLiu <[email protected]> Signed-off-by: Mark Graham <[email protected]>
Fixes #7356
Description
Add relative positinoal embedding in attention block as described in https://arxiv.org/pdf/2112.01526.pdf
Largely inspired by https://github.com/facebookresearch/segment-anything/blob/main/segment_anything/modeling/image_encoder.py
Can be useful for #6357
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.