KEMBAR78
Gaussian nll loss scalar variance support by michael-diggin · Pull Request #138931 · pytorch/pytorch · GitHub
Skip to content

Conversation

@michael-diggin
Copy link
Contributor

Fixes #138747

Adds support for variance being a Tensor or a float in gaussian_nll_loss to avoid a cpu-gpu sync point in the loss function, when the variance is a static tensor like <scalar>*torch.ones_like(input)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 25, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 25, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138931

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ You can merge normally! (1 Unrelated Failure)

As of commit 6da0ea9 with merge base de34f58 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 28, 2024
Copy link
Contributor

@mikaylagawarecki mikaylagawarecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@mikaylagawarecki
Copy link
Contributor

@pytorchbot merge -r

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 6, 2024
@mikaylagawarecki mikaylagawarecki added topic: not user facing topic category and removed ciflow/trunk Trigger trunk jobs on your pull request labels Nov 6, 2024
@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased gaussian-nll-loss-scalar-var onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout gaussian-nll-loss-scalar-var && git pull --rebase)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 3 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@mikaylagawarecki
Copy link
Contributor

Seems like CI is failing

@michael-diggin
Copy link
Contributor Author

Seems like CI is failing

I think it wasn't liking the fact I had used Tensor | float as that isn't supported on Python 3.9. I've changed it to use Union[Tensor, Float] which should be the exact same.

@michael-diggin
Copy link
Contributor Author

@mikaylagawarecki I've updated the PR which should fix the failing CI, if you would be able to re-trigger that workflow if you're happy with the update?

@michael-diggin
Copy link
Contributor Author

Thanks! I think the only remaining failure is the bc-lint here: https://github.com/pytorch/pytorch/actions/runs/11784651031/job/32831020347?pr=138931#step:2:833
Which I believe is a false positive, as Tensor -> Union[Tensor, Float] is a backwards compatible change.
If you agree we can add the suppress-bc-linter label and I think that should raise them as notifications rather than errors?

@michael-diggin
Copy link
Contributor Author

Thanks! I think the only remaining failure is the bc-lint here: https://github.com/pytorch/pytorch/actions/runs/11784651031/job/32831020347?pr=138931#step:2:833 Which I believe is a false positive, as Tensor -> Union[Tensor, Float] is a backwards compatible change. If you agree we can add the suppress-bc-linter label and I think that should raise them as notifications rather than errors?

Hi @mikaylagawarecki, would you be able to take a look at this comment if you get a chance? I believe adding that label (following the docs here) and rerunning the bc-lint check should fix the last remaining failing check. Thanks! 🙏

@mikaylagawarecki mikaylagawarecki added the suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) label Nov 15, 2024
@mikaylagawarecki
Copy link
Contributor

@pytorchbot merge -r

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 15, 2024
@pytorchmergebot
Copy link
Collaborator

@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here

@pytorchmergebot
Copy link
Collaborator

Successfully rebased gaussian-nll-loss-scalar-var onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout gaussian-nll-loss-scalar-var && git pull --rebase)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 3 mandatory check(s) failed. The first few are:

Dig deeper by viewing the failures on hud

Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@michael-diggin
Copy link
Contributor Author

michael-diggin commented Nov 20, 2024

Hi @mikaylagawarecki - sorry to bother you again (and hopefully last time!).
The one failing check looks like an unrelated flake based on the pytorch-bot comment here. Is it safe to ignore it, or can we rerun the failed test?

@mikaylagawarecki
Copy link
Contributor

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@michael-diggin michael-diggin deleted the gaussian-nll-loss-scalar-var branch December 4, 2024 07:52
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
Fixes pytorch#138747

Adds support for `variance` being a Tensor or a float in `gaussian_nll_loss` to avoid a cpu-gpu sync point in the loss function, when the variance is a static tensor like `<scalar>*torch.ones_like(input)`

Pull Request resolved: pytorch#138931
Approved by: https://github.com/mikaylagawarecki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: nn release notes category suppress-bc-linter Suppresses the failures of API backward-compatibility linter (Lint/bc_linter) topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Speed up gaussian_nll_loss when variance is always the same scalar value

5 participants