How to customize text-generation length

I have trained a text-generation model and uploaded it to the hub, and I was wondering if there is a way to set the number of sentences to model produces to a number (like 5). Current, the model generates about 100 words and cuts off mid-sentence. Is there a solution to this?

You can define both the length output and the number of return sequences with the parameters max_length and num_return_sequences. Take a look at this documentation Generation