# Force decoder to avoid repetition between generated sentences

**URL:** <https://discuss.huggingface.co/t/force-decoder-to-avoid-repetition-between-generated-sentences/625>\
**Category:** Beginners\
**Created:** [August 7, 2020, 3:31am UTC](https://discuss.huggingface.co/t/force-decoder-to-avoid-repetition-between-generated-sentences/625 "2020-08-07T03:31:00Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![patrickvonplaten](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/patrickvonplaten/32/2171_2.png) [@patrickvonplaten](https://discuss.huggingface.co/u/patrickvonplaten)\
**Post date:** [November 2, 2020, 1:12pm UTC](https://discuss.huggingface.co/t/force-decoder-to-avoid-repetition-between-generated-sentences/625/2 "2020-11-02T13:12:32Z")

</div>

Hey @mengyahu - this sounds like a cool use case! You are right we the current `generate()` method it is not really possible to avoid repetitions between sentences. It’s quite a special case so I’d suggest that after this PR is merged: [Big `generate()` refactor](https://discuss.huggingface.co/t/big-generate-refactor/1857) you to make a fork of the `transformers` repo and try to tweak the `beam_scorer.update()` function (or the `BeamSearchScorer` class in general to add a penalty as needed).

---

_[View the full topic](https://discuss.huggingface.co/t/force-decoder-to-avoid-repetition-between-generated-sentences/625)._
