GPT-2 last sentence-trunication

Hi, I finetune gpt-2 model based on Tutorial - Transformers
Now I want to generating text and when I generate text with GPT-2 model sometimes the last sentence is not a proper sentence for example :

Once upon a time, there was a group of new immigrants and their son who at the beginning of World War II once began a long run of the most inhumane abuse they had been involved in. At the age the so-snappy, one

I wonder is there a way to handle this issue.I’ve checked Preprocessing data and used different values for padding and truncation but the problem still remains the same.
also, I tried to use <|endoftext|> in the tokenizer but it didn’t work.

Note that I use transformers generator for this

generator(text,max_length=max_length, top_k=to_k,top_p=.9,return_full_text=False)

any help would be appreciated.

thanks :slightly_smiling_face: