move img_mask@get_attn_mask() to hpu#102
Merged
Merged
Conversation
libinta
reviewed
Mar 13, 2024
| "t5", | ||
| "mistral", | ||
| "mixtral", | ||
| "swin", |
| @@ -0,0 +1,50 @@ | |||
| # coding=utf-8 | |||
| # Copyright 2022 The HuggingFace Inc. team. | |||
| # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. | |||
Collaborator
There was a problem hiding this comment.
should we have Hugginface only?
| def gaudi_swin_get_attn_mask(self, height, width, dtype): | ||
| if self.shift_size > 0: | ||
| # calculate attention mask for SW-MSA | ||
| img_mask = torch.zeros((1, height, width, 1), dtype=dtype, device='hpu') |
Collaborator
There was a problem hiding this comment.
can you check if there is self.device?
libinta
approved these changes
Mar 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In certain 1x systems , we notice a drop in performance for swin models as get_attn_mask gets executed in cpu instead of hpu. This was seen after pytorch upgrade to 2.2
This fix allows img_mask in get_attn_mask() to be moved back hpu.