# How to set stopping criteria in model.generate() when a certain word appears

**URL:** <https://discuss.huggingface.co/t/how-to-set-stopping-criteria-in-model-generate-when-a-certain-word-appears/70274>\
**Category:** 🤗Transformers\
**Created:** [January 23, 2024, 3:28pm UTC](https://discuss.huggingface.co/t/how-to-set-stopping-criteria-in-model-generate-when-a-certain-word-appears/70274 "2024-01-23T15:28:56Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![berkecr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/berkecr/32/32071_2.png) [@berkecr](https://discuss.huggingface.co/u/berkecr)\
**Post date:** [February 18, 2024, 11:01am UTC](https://discuss.huggingface.co/t/how-to-set-stopping-criteria-in-model-generate-when-a-certain-word-appears/70274/4 "2024-02-18T11:01:24Z")

</div>

@Pradeep1995 [this](https://discuss.huggingface.co/t/implimentation-of-stopping-criteria-list/20040/9) may be a good solution.

---

_[View the full topic](https://discuss.huggingface.co/t/how-to-set-stopping-criteria-in-model-generate-when-a-certain-word-appears/70274)._
