# Using the .generate() function with a custom model class

**URL:** <https://discuss.huggingface.co/t/using-the-generate-function-with-a-custom-model-class/32946>\
**Category:** Models\
**Created:** [March 3, 2023, 6:13am UTC](https://discuss.huggingface.co/t/using-the-generate-function-with-a-custom-model-class/32946 "2023-03-03T06:13:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneeshjain](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@aneeshjain](https://discuss.huggingface.co/u/aneeshjain)\
**Post date:** [March 3, 2023, 6:13am UTC](https://discuss.huggingface.co/t/using-the-generate-function-with-a-custom-model-class/32946/1 "2023-03-03T06:13:52Z")

</div>

Hi,

Im trying to use the .generate() function with a custom model class I have implemented. I want to use the generate function available within HuggingFace instead of implementing my own greedy/beam search functions. Is it possible to do this? I have been unable to find any documentation that describes how to do this.
