While I did not use run_generation.py code, I remember using this code (or similar to it) and finding myself on the receiving end of an undesirable output. However, Write With Transformers was visibly worse. I can’t think of why this would be the case, but I can say with certainty that this loss in quality does exist and took place recently.
from transformers import AutoModelWithLMHead, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("")
model = AutoModelWithLMHead.from_pretrained("")

sequence = f"""X"""
input = tokenizer.encode(sequence, return_tensors="pt")
generated = model.generate(input, max_length=500, do_sample=True)

resulting_string = tokenizer.decode(generated.tolist()[0])
print(resulting_string)