This commit is contained in:
Nick Walton
2019-09-27 12:21:53 -06:00
parent 524b843217
commit 7f9ef794dc
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ def console_print(str, pycharm=False):
def play_unconstrained():
generator = CTRLGenerator()
#generator = WebGenerator(CRED_FILE)
prompt = get_story_start("forest")
prompt = get_story_start("hospital")
story_manager = UnconstrainedStoryManager(generator)
story_manager.start_new_story(prompt)
+3 -3
View File
@@ -20,7 +20,7 @@ def loss(labels, logits):
class CTRLGenerator():
def __init__(self, control_code="Horror Text: ", generate_num=80, temperature=0.4):
def __init__(self, control_code="Books: ", generate_num=80, temperature=0.4):
self.generate_num=generate_num
model_dir = "generator/ctrl/model/seqlen256_v1.ckpt/"
@@ -158,7 +158,7 @@ class CTRLGenerator():
if prompt[-1] != " ":
prompt = prompt + " "
#prompt = second_to_first_person(prompt)
prompt = second_to_first_person(prompt)
prompt = self.control_code + prompt
# print("\n\nAFTER PROMPT_REPLACE")
@@ -218,7 +218,7 @@ class CTRLGenerator():
# disallow some tokens
forbidden_tokens = ['<unk>', 'Sco@@', "&amp@@", "1]@@", "2]@@", "3]@@", "4]@@", "https://www.@@", "[@@", ":@@",
"Edit", "&@@", "2:","1:", ":", "Edit@@", "EDI@@", "EDIT@@", "edit", "TL@@", "tl@@", ";@@",
'**', "http://@@", "Redd@@", "UP@@"]
'**', "http://@@", "Redd@@", "UP@@", "mom"]
if num_new_lines > self.max_new_lines:
forbidden_tokens.append("\n")