lucidrains / performer-pytorch

An implementation of Performer, a linear attention-based transformer, in Pytorch
MIT License
1.07k stars 143 forks source link

Add repetition penalty for text generation #78

Closed AlexandreDey closed 2 years ago

AlexandreDey commented 2 years ago

Implement repetition penalty when generating with autoregressive models.

The original method is described in CTRL paper Added the ability to provide the size of the context window (instead of the whole generated sequence) to allow repetition after a few words (normal for long texts)