* adds saving and loading

* fixed some cmd issues

* fixed some cmd issues

* fixed capitalization issue

* smallupdate

* update

* update

* dev changes

* more testing

* more dev fixes

* dragon story

* dragon story

* adding ai dm mode

* dm fix

* dm

* dm

* Gcloudstoragestuff

* fixed loading issues

* upped memory

* upgrade to new model

* turn on debug

* fixed repetition issue

* turned off debug print

* upped dm temp
This commit is contained in:
Nick Walton
2019-12-02 08:36:43 -07:00
committed by GitHub
parent c63f7e051a
commit 436c421ff8
5 changed files with 14 additions and 8 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ class GPT2Generator:
self.top_k = top_k
self.top_p = top_p
self.model_name = "model_v4"
self.model_name = "model_v5"
self.model_dir = "generator/gpt2/models"
self.checkpoint_path = os.path.join(self.model_dir, self.model_name)
+2 -2
View File
@@ -1,6 +1,6 @@
MODELS_DIRECTORY=generator/gpt2/models
MODEL_VERSION=model_v4
MODEL_NAME=model-200
MODEL_VERSION=model_v5
MODEL_NAME=model-550
DOWNLOAD_URL=https://students.cs.byu.edu/~nickwalt
if [ -d "${MODELS_DIRECTORY}/${MODEL_VERSION}" ]; then
+7 -1
View File
@@ -16,7 +16,10 @@ class AIPlayer:
return self.generator.generate_raw(prompt)
def play_dm():
generator = GPT2Generator()
console_print("Initializing AI Dungeon DM Mode")
generator = GPT2Generator(temperature=0.9)
story_manager = UnconstrainedStoryManager(HumanDM())
context, prompt = select_game()
console_print(context + prompt)
@@ -31,6 +34,9 @@ def play_dm():
print(action)
print("******END DEBUG******\n")
action = action.split("\n")[0]
punc = action.rfind(".")
if punc > 0:
action = action[:punc+1]
shown_action = "> You" + action
console_print(second_to_first_person(shown_action))
story_manager.act(action)
+3 -3
View File
@@ -67,11 +67,11 @@ class Story():
def latest_result(self):
latest_result = self.context
mem_ind = self.memory
if len(self.results) < 2:
latest_result += self.story_start
latest_result = self.story_start
else:
latest_result = self.context
while mem_ind > 0:
if len(self.results) >= mem_ind:
+1 -1
View File
@@ -89,7 +89,7 @@ def split_first_sentence(text):
def cut_trailing_action(text):
lines = text.split("\n")
last_line = lines[-1]
if "you ask." in last_line or "You ask." in last_line or "you say." in last_line or "You say." in last_line:
if "you ask" in last_line or "You ask" in last_line or "you say" in last_line or "You say" in last_line:
text = "\n".join(lines[0:-1])
return text