# GPT-2 last sentence-trunication

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgpt-2-last-sentence-trunication%2F9620%3E%5C
**Category:** 🤗Transformers\
**Created:** [August 31, 2021, 8:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgpt-2-last-sentence-trunication%2F9620 "2021-08-31T08:16:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saied](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saied/32/29266_2.png) [@saied](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsaied)%5C
**Post date:** [August 31, 2021, 8:16am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgpt-2-last-sentence-trunication%2F9620%2F1 "2021-08-31T08:16:50Z")

</div>

Hi,  
I have a question about text generation and GPT-2. 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](https://huggingface.co/transformers/preprocessing.html) 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.

thanks 🙂
