Skip to content
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

fix: correct the positional encoding of Transformer in pytorch examples #20203

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Galaxy-Husky
Copy link

@Galaxy-Husky Galaxy-Husky commented Aug 15, 2024

What does this PR do?

Fixes #19138

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--20203.org.readthedocs.build/en/20203/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Aug 15, 2024
@Galaxy-Husky
Copy link
Author

The difference between this example and the original one pytorch example is that the default value of argument batch_first is set to False in PyTorch, whereas here it is set to True.

In order to use the positional encoding correctly, I made the above changes. But I don't know how to write a test case.

Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81%. Comparing base (5be58f6) to head (7355f4f).

❗ There is a different number of reports uploaded between BASE (5be58f6) and HEAD (7355f4f). Click for more details.

HEAD has 553 uploads less than BASE
Flag BASE (5be58f6) HEAD (7355f4f)
cpu 147 21
lightning 106 16
pytest 87 2
python3.9 43 6
python3.10 42 6
lightning_fabric 25 0
gpu 4 2
python3.11 42 6
python3.12 20 3
pytorch2.1 38 12
pytest-full 64 21
pytorch2.3 9 3
pytorch_lightning 20 7
pytorch2.2 9 3
pytorch2.4 8 3
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #20203     +/-   ##
=========================================
- Coverage      89%      81%     -8%     
=========================================
  Files         267      264      -3     
  Lines       23084    23029     -55     
=========================================
- Hits        20585    18618   -1967     
- Misses       2499     4411   +1912     

@Galaxy-Husky
Copy link
Author

@Borda Hi, could you tell me how to deal with the two failed workflows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pl Generic label for PyTorch Lightning package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong PositionalEncoding in the Transformer example
2 participants