def clean_text(text):
    """Remove new lines and multiple spaces and adjust end of sentence dot."""

    text = text.replace("\n", " ")
    text = re.sub(r'\s+', ' ', text)
    for _ in range(3):
        text = text.replace(' . ', '. ')

    return text
Remove new lines and multiple spaces and adjust end of sentence dot.
megatron_lm/tasks/data_utils.py