This commit is contained in:
root
2019-11-16 03:59:16 +00:00
parent 7bb5901b0b
commit eb8cc5e9bb
4 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -14,8 +14,8 @@ CRED_FILE = "./AI-Adventure-2bb65e3a4e2f.json"
def play_unconstrained():
generator = SimpleGenerator()
prompt = get_story_start("classic")
context = get_context("classic")
prompt = get_story_start("zombies")
context = get_context("zombies")
story_manager = UnconstrainedStoryManager(generator)
story_manager.start_new_story(prompt, context=context)
+1 -1
View File
@@ -33,7 +33,7 @@ def get_stories(filename):
output_file_path = "text_adventures.txt"
with open(output_file_path, 'w') as output_file:
filenames = ["story0.json"]
filenames = ["story" + str(i) + ".json" for i in range(1,20)]
stories = []
for filename in filenames:
stories += get_stories(filename)
+1 -1
View File
@@ -17,6 +17,6 @@ gpt2.finetune(sess,
batch_size=8,
learning_rate=0.0001,
model_name=model_name,
steps=1000)
steps=100)
gpt2.generate(sess)
+2
View File
@@ -78,6 +78,8 @@ def cut_trailing_sentence(text):
text = standardize_punctuation(text)
last_punc = max(text.rfind('.'), text.rfind("!"), text.rfind("?"))
last_punc = min(text.rfind("<|endoftext|>"), last_punc)
if last_punc > 0:
text = text[0:last_punc+1]