mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
fixed mental issue?
This commit is contained in:
@@ -177,6 +177,9 @@ class CTRLGenerator():
|
||||
if not first_letter_capitalized:
|
||||
result = result[0].lower() + result[1:]
|
||||
|
||||
while("\n \n \n " in result):
|
||||
result = result.replace("\n \n \n ", "\n \n ")
|
||||
|
||||
# print("\n\nAFTER RESULT_REPLACE:")
|
||||
# print(repr(result))
|
||||
|
||||
@@ -191,7 +194,6 @@ class CTRLGenerator():
|
||||
options["used_verbs"] = set()
|
||||
|
||||
first_token = True
|
||||
prompt_length = len(prompt)
|
||||
|
||||
# tokenize provided prompt
|
||||
split_prompt = self.bpe.apply([prompt])[0].split()
|
||||
@@ -256,7 +258,7 @@ class CTRLGenerator():
|
||||
if first_token:
|
||||
for word in get_possible_verbs():
|
||||
if word not in options["used_verbs"]:
|
||||
prompt_logits[_token][self.word2idx[word]] += 5
|
||||
prompt_logits[_token][self.word2idx[word]] += 100
|
||||
|
||||
# compute probabilities from logits
|
||||
prompt_probs = np.exp(prompt_logits[_token])
|
||||
@@ -320,12 +322,4 @@ class CTRLGenerator():
|
||||
|
||||
first_token = False
|
||||
|
||||
|
||||
print("\n\nPrompt is \n", prompt)
|
||||
print("\n\nCut off")
|
||||
print(repr(result))
|
||||
|
||||
import pdb
|
||||
pdb.set_trace()
|
||||
|
||||
return self.result_replace(result)
|
||||
|
||||
@@ -6,5 +6,5 @@ prompts:
|
||||
action_verbs:
|
||||
classic: ["You attack", "You tell", "You use", "You go"]
|
||||
|
||||
anything: ["You", "You", "You", "You"]
|
||||
anything: ["You", "You"]
|
||||
|
||||
|
||||
@@ -167,9 +167,7 @@ class CTRLStoryManager(ConstrainedStoryManager):
|
||||
options["used_verbs"] = set(used_verbs)
|
||||
result = self.generate_action_result(self.story_context(), phrase, options=options)
|
||||
|
||||
print("Result string? ", result[0].split())
|
||||
used_verb = result[0].split()[1]
|
||||
print("Used verb is ", used_verb)
|
||||
used_verbs.append(used_verb)
|
||||
|
||||
results.append(result)
|
||||
|
||||
Reference in New Issue
Block a user