• pokjay's avatar
    Fix ExponentialDecayLengthPenalty negative logits issue (#25594) · 6acc27ee
    pokjay authored
    
    
    * Fix issues in test_exponential_decay_length_penalty
    
    Fix tests which were broken and add validation of negative scores.
    
    Current test didn't take into account that ExponentialDecayLengthPenalty updates the score inplace, resulting in updates to base tested Tensor.
    
    In addition, the gt assert had empty Tensors due to indexing along the batch dimension.
    
    Test is currently expected to fail to show ExponentialDecayLengthPenalty issues with negative scores
    
    * Fix ExponentialDecayLengthPenalty negative logits issue
    
    In cases where the scores are negative, ExponentialDecayLengthPenalty decreases the score of eos_token_id instead of increasing it.
    To fix this issue we compute the penalty of the absolute value and add it to the original score.
    
    * Add examples for ExponentialDecayLengthPenalty
    
    * Fix styling issue in ExponentialDecayLengthPenalty doc
    
    * Apply suggestions from code review
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    
    * Style and quality fix
    
    * Fix example outputs
    
    ---------
    Co-authored-by: default avatarArthur <48595927+ArthurZucker@users.noreply.github.com>
    6acc27ee
test_logits_process.py 34.5 KB