Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

fixing image_encoder to work with cuda_graphs #393

Open
wants to merge 2 commits into
base: gh/HDCharles/1/base
Choose a base branch
from

Conversation

HDCharles
Copy link

@HDCharles HDCharles commented May 24, 2023

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:

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]
@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 24, 2023
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
@HDCharles HDCharles marked this pull request as draft May 24, 2023 06:01
@@ -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))
Copy link

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)

Copy link
Author

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 HDCharles requested a review from vkuzo May 30, 2023 20:37
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
@HDCharles HDCharles marked this pull request as ready for review May 30, 2023 20:39
@HDCharles HDCharles requested a review from HannaMao May 30, 2023 20:44
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants