You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ExponentialDecayLengthPenalty is intended to exponentially increase the score of the eos_token_id after start_index has been reached, allowing generating shorter sequences without having a hard cutoff. (Original PR: #15245 )
When working with shorter sequences it doesn't necessarily cut the sequence, no matter how large the decay factor is.
In the line below, the processor attempts to increase the score of EOS. However when EOS score is negative, this actually decreases the score, as the exponent will be positive.
As I understand, giving a negative decay factor won't work as well due to the power. Due to this it will only succeed if EOS becomes positive.
In the attached Colab notebook, I added a proposed solution. If the score is negative, we can compute the expected penalty added to EOS if the score was positive, and add that to the original negative score.
If this is acceptable, I'd like to create a PR to fix the issue!
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
System Info
transformers
version: 4.31.0Who can help?
@gante
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
https://colab.research.google.com/drive/1_Ur0sQhrUan68OXDlFK0SGQfDhwlb8Pc?usp=sharing
Expected behavior
Issue Explanation
ExponentialDecayLengthPenalty
is intended to exponentially increase the score of the eos_token_id after start_index has been reached, allowing generating shorter sequences without having a hard cutoff. (Original PR: #15245 )When working with shorter sequences it doesn't necessarily cut the sequence, no matter how large the decay factor is.
In the line below, the processor attempts to increase the score of EOS. However when EOS score is negative, this actually decreases the score, as the exponent will be positive.
As I understand, giving a negative decay factor won't work as well due to the power. Due to this it will only succeed if EOS becomes positive.
transformers/src/transformers/generation/logits_process.py
Line 982 in f1732e1
Proposed solution
In the attached Colab notebook, I added a proposed solution. If the score is negative, we can compute the expected penalty added to EOS if the score was positive, and add that to the original negative score.
If this is acceptable, I'd like to create a PR to fix the issue!
The text was updated successfully, but these errors were encountered: