mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
Develop (#12)
* 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:
@@ -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
@@ -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
@@ -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)
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user