# How to stop a step2step generation model while streaming

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-stop-a-step2step-generation-model-while-streaming%2F55638%3E%5C
**Category:** Beginners\
**Created:** [September 19, 2023, 3:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-stop-a-step2step-generation-model-while-streaming%2F55638 "2023-09-19T15:42:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EquinoxElahin](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@EquinoxElahin](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FEquinoxElahin)%5C
**Post date:** [September 19, 2023, 3:42pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-stop-a-step2step-generation-model-while-streaming%2F55638%2F1 "2023-09-19T15:42:25Z")

</div>

Hello everyone, I want my model generates sequences. To make this nice I want to do it on stream.  
But sometimes it acts bad (mainly repetition of specific tokens) So I would like to stop the generation/stream if I see these tokens.  
Can I do this ?  
Thanks,
