This repository has been archived by the owner on Jul 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fixing image_encoder to work with cuda_graphs #393
Open
HDCharles
wants to merge
2
commits into
gh/HDCharles/1/base
Choose a base branch
from
gh/HDCharles/1/head
base: gh/HDCharles/1/base
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
Summary: the combination of tensors on multiple devices in get_rel_pos was preventing cuda graphs from correctly optimizing things Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
HDCharles
added a commit
that referenced
this pull request
May 24, 2023
Summary: the combination of tensors on multiple devices in get_rel_pos was preventing cuda graphs from correctly optimizing things Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 0fea0e19e5bf0ee44a19669fe33e7e16002a55af Pull Request resolved: #393
vkuzo
reviewed
May 24, 2023
@@ -315,8 +315,8 @@ def get_rel_pos(q_size: int, k_size: int, rel_pos: torch.Tensor) -> torch.Tensor | |||
rel_pos_resized = rel_pos | |||
|
|||
# Scale the coords with short length if shapes for q and k are different. | |||
q_coords = torch.arange(q_size)[:, None] * max(k_size / q_size, 1.0) | |||
k_coords = torch.arange(k_size)[None, :] * max(q_size / k_size, 1.0) | |||
q_coords = (torch.arange(q_size).to(rel_pos.device)[:, None] * max(k_size / q_size, 1.0)) |
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.
nit: torch.arange(q_size, device=rel_pos.device)
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.
fixed
Summary: the combination of tensors on multiple devices in get_rel_pos was preventing cuda graphs from correctly optimizing things Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
HDCharles
added a commit
that referenced
this pull request
May 30, 2023
Summary: the combination of tensors on multiple devices in get_rel_pos was preventing cuda graphs from correctly optimizing things Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 2256f130bb8249403710e1048ef69385ff71aed2 Pull Request resolved: #393
7 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
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.
Stack from ghstack (oldest at bottom):
Summary: the combination of tensors on multiple devices in get_rel_pos
was preventing cuda graphs from correctly optimizing things
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags: