-
Notifications
You must be signed in to change notification settings - Fork 31.1k
[T5] make decoder input ids optional for t5 training #3521
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
[T5] make decoder input ids optional for t5 training #3521
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3521 +/- ##
=======================================
Coverage 77.80% 77.81%
=======================================
Files 100 100
Lines 17051 17069 +18
=======================================
+ Hits 13267 13282 +15
- Misses 3784 3787 +3
Continue to review full report at Codecov.
|
c767d69 to
eb6cb30
Compare
| # replace possible -100 values in lm_labels by `pad_token_id` | ||
| shifted_input_ids.masked_fill_(shifted_input_ids == -100, pad_token_id) | ||
|
|
||
| assert torch.all(shifted_input_ids >= 0).item(), "Verify that `lm_labels` has only positive values and -100" |
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!
|
@patrickvonplaten Hi Patrick! Could you tell me what is the difference between decoder_input_ids and lm_labels for T5ForConditionalGeneration? For context: I am using T5ForConditionalGeneration for paraphrase generation. I am checking this code:https://github.com/ramsrigouthamg/Paraphrase-any-question-with-T5-Text-To-Text-Transfer-Transformer-/blob/master/t5-pretrained-question-paraphraser.ipynb He uses lm_labels with decoder_attention_mask. Thanks in advance! |
|
@mengyahuUSTC-PU . When calling the forward() , decoder_input_ids is None as follows: decode_input_ids is derived from lm_labels if decode_input_ids is None. decode_input_ids= I was wondering in what case I need to feed decode_input_ids. |
decoder_input_idsoptional when supplyinglm_labelsforT5ForConditionalGeneration