Repository navigation
Note that dropout stays active during sampling in char-RNN generation tutorial - #3998
Open
Raushan2102 wants to merge 1 commit into
Open
Raushan2102 wants to merge 1 commit into
Raushan2102 wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3998
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
This branch has not been deployed
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.
Description
sample()inchar_rnn_generation_tutorial.pypicks the top letter (topk(1)), butrnnis never put ineval()mode, andtorch.no_grad()does not disablenn.Dropout. As a result, greedy sampling returns a different name on each call. The tutorial uses dropout for sampling variety on purpose, so this PR does not change any code. It adds a short note explaining why the samples vary and how to get repeatable output (rnn.eval(), thenrnn.train()before training again).Reproduction (tutorial's
RNN,train()andsample(), PyTorch 2.1.1): 20 calls tosample()gave 7–10 distinct names per category in training mode and 1 afterrnn.eval().I could not find an existing issue for this. Related: #3956 changes the same tutorial but does not touch dropout or sampling.
AI assistance was used to find the issue and draft the note; I reproduced the result locally.
Checklist