# How to stop a step2step generation model while streaming

**URL:** <https://discuss.huggingface.co/t/how-to-stop-a-step2step-generation-model-while-streaming/55638>\
**Category:** Beginners\
**Created:** [September 19, 2023, 3:42pm UTC](https://discuss.huggingface.co/t/how-to-stop-a-step2step-generation-model-while-streaming/55638 "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](https://discuss.huggingface.co/u/EquinoxElahin)\
**Post date:** [September 19, 2023, 3:42pm UTC](https://discuss.huggingface.co/t/how-to-stop-a-step2step-generation-model-while-streaming/55638/1 "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,
