mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
update
This commit is contained in:
+2
-2
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user