Skip to content

Commit

Permalink
Remove starting newlines on generated text
Browse files Browse the repository at this point in the history
  • Loading branch information
minimaxir committed Jun 16, 2019
1 parent 6951425 commit ae3436d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gpt_2_simple/gpt_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ae3436d

Please sign in to comment.