def clean(text): if text.endswith(""): text = text[:-len("")] if text.endswith("<|endoftext|>"): text = text[:-len("<|endoftext|>")] return text