This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
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.
Add option to use scheduled sampling in CopyNet #309
Add option to use scheduled sampling in CopyNet #309
Changes from 10 commits
dd349ff
2a3a702
a15356f
bc6c191
61792c2
acd7f29
4ce4c7b
c4d5444
0cc0197
39ef089
36d08f7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Ah, I realized this implementation doesn't work, because
last_predictions
is never updated. I would have had to take the index of the token with the highest probability for this timestep under the model. Something like:@epwalsh does this make sense?
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.
Hmm, yeup, good catch. To avoid duplicate computation you could use
all_scores
from the_get_ll_contrib()
method. And note that you will need to take into account this mask. So I suggest returningall_scores
andmask
from_get_ll_contrib
so you can use them here.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.
Gotcha. Could I just return
log_probs
from_get_ll_contrib()
? Its computed like:log_probs = util.masked_log_softmax(all_scores, mask)
.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.
Yes, good point.
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.
Awesome, just pushed that change.
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.
@epwalsh Added a similar condition to
simple_seq2seq
to avoid the call totorch.rand
when_scheduled_sampling_ratio
is0.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.
@epwalsh Added the same test for scheduled sampling to
simple_seq2seq
.