From ae3436d1cbc8c98561603e7033a850bf479b3e56 Mon Sep 17 00:00:00 2001 From: Max Woolf Date: Sat, 15 Jun 2019 19:33:37 -0700 Subject: [PATCH] Remove starting newlines on generated text --- gpt_2_simple/gpt_2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gpt_2_simple/gpt_2.py b/gpt_2_simple/gpt_2.py index f55a256..eb41f66 100644 --- a/gpt_2_simple/gpt_2.py +++ b/gpt_2_simple/gpt_2.py @@ -429,10 +429,11 @@ def generate(sess, trunc_text = re.search(pattern, gen_text, re.S) if trunc_text: gen_text = trunc_text.group(1) + gen_text = gen_text.lstrip('\n') if destination_path: f.write("{}\n{}".format(gen_text, sample_delim)) if not return_as_list and not destination_path: - print("{}\n{}".format(gen_text, sample_delim)) + print("{}\n{}".format(gen_text, sample_delim), end='') gen_texts.append(gen_text) if destination_path: