mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-09-09 11:13:26 +08:00
update
This commit is contained in:
@@ -20,7 +20,7 @@ def loss(labels, logits):
|
||||
|
||||
class CTRLGenerator():
|
||||
|
||||
def __init__(self, control_code="Horror Text: ", generate_num=80, temperature=0.3):
|
||||
def __init__(self, control_code="Writing Text: ", generate_num=80, temperature=0.3):
|
||||
|
||||
self.generate_num=generate_num
|
||||
model_dir = "generator/ctrl/model/seqlen256_v1.ckpt/"
|
||||
@@ -158,7 +158,7 @@ class CTRLGenerator():
|
||||
if prompt[-1] != " ":
|
||||
prompt = prompt + " "
|
||||
|
||||
prompt = second_to_first_person(prompt)
|
||||
#prompt = second_to_first_person(prompt)
|
||||
|
||||
prompt = self.control_code + prompt
|
||||
# print("\n\nAFTER PROMPT_REPLACE")
|
||||
@@ -172,7 +172,7 @@ class CTRLGenerator():
|
||||
first_letter_capitalized = result[0].isupper()
|
||||
result = result.replace("#", "")
|
||||
result = result.replace("*", "")
|
||||
result = first_to_second_person(result)
|
||||
#result = first_to_second_person(result)
|
||||
result = remove_profanity(result)
|
||||
|
||||
if not first_letter_capitalized:
|
||||
|
||||
+1
-1
@@ -173,5 +173,5 @@ def second_to_first_person(text):
|
||||
return capitalize_first_letters(text[1:])
|
||||
|
||||
if __name__ == '__main__':
|
||||
text = '“Hey there, you okay?” She asks. I\'m not sure what to say, “I\'m fine, I\'m sorry.” I say'
|
||||
text = 'You wake up in an old rundown hospital with no memory of how you got there. You look around and see a nurse standing over me. "Hey buddy, you okay?" she asks. She looks at me like I\'m crazy. '
|
||||
print(first_to_second_person(text))
|
||||
Reference in New Issue
Block a user