diff --git a/console_play.py b/console_play.py index 3a68e3d..253e04f 100644 --- a/console_play.py +++ b/console_play.py @@ -8,7 +8,18 @@ CRED_FILE = "./AI-Adventure-2bb65e3a4e2f.json" def console_print(text, width=75): - print(textwrap.fill(text, width)) + last_newline = 0 + i = 0 + while i < len(text): + if text[i] == "\n": + last_newline = 0 + elif last_newline > width: + text = text[:i] + "\n" + text[i:] + else: + last_newline += 1 + i += 1 + + def play_unconstrained(): diff --git a/generator/gpt2/gpt2_generator.py b/generator/gpt2/gpt2_generator.py index 9a87608..5ad2f35 100644 --- a/generator/gpt2/gpt2_generator.py +++ b/generator/gpt2/gpt2_generator.py @@ -11,8 +11,6 @@ from generator.gpt2.src import model, sample, encoder import json import numpy as np -tf.logging.set_verbosity(tf.logging.ERROR) - class GPT2Generator: def __init__(self, generate_num=100, temperature=0.3, top_k=40, top_p=0.8):