improve system for rwkv-4-world
This commit is contained in:
parent
9f5d15a7d5
commit
c8b2bb53ef
@ -59,28 +59,28 @@ The following is a coherent verbose detailed conversation between a girl named {
|
||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||
"""
|
||||
if user == "Bob"
|
||||
else ""
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.\n\n"
|
||||
)
|
||||
for message in body.messages:
|
||||
if message.role == "system":
|
||||
completion_text = (
|
||||
f"The following is a coherent verbose detailed conversation between a girl named {bot} and her friend {user}. "
|
||||
if user == "Bob"
|
||||
else ""
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. "
|
||||
+ message.content.replace("\\n", "\n")
|
||||
.replace("\r\n", "\n")
|
||||
.replace("\n\n", "\n")
|
||||
.replace("\n", " ")
|
||||
.strip()
|
||||
.replace("You are", f"{bot} is")
|
||||
.replace("you are", f"{bot} is")
|
||||
.replace("You're", f"{bot} is")
|
||||
.replace("you're", f"{bot} is")
|
||||
.replace("You", f"{bot}")
|
||||
.replace("you", f"{bot}")
|
||||
.replace("Your", f"{bot}'s")
|
||||
.replace("your", f"{bot}'s")
|
||||
.replace("你", f"{bot}")
|
||||
.replace("You are", f"{bot} is" if user == "Bob" else "I am")
|
||||
.replace("you are", f"{bot} is" if user == "Bob" else "I am")
|
||||
.replace("You're", f"{bot} is" if user == "Bob" else "I'm")
|
||||
.replace("you're", f"{bot} is" if user == "Bob" else "I'm")
|
||||
.replace("You", f"{bot}" if user == "Bob" else "I")
|
||||
.replace("you", f"{bot}" if user == "Bob" else "I")
|
||||
.replace("Your", f"{bot}'s" if user == "Bob" else "My")
|
||||
.replace("your", f"{bot}'s" if user == "Bob" else "my")
|
||||
.replace("你", f"{bot}" if user == "Bob" else "我")
|
||||
+ "\n\n"
|
||||
)
|
||||
break
|
||||
|
@ -50,28 +50,32 @@ class RWKV:
|
||||
self.preload()
|
||||
|
||||
def preload(self):
|
||||
if self.user == "Bob":
|
||||
bot = self.bot
|
||||
user = self.user
|
||||
preset_system = f"""
|
||||
interface = self.interface
|
||||
user = self.user
|
||||
bot = self.bot
|
||||
preset_system = (
|
||||
f"""
|
||||
The following is a coherent verbose detailed conversation between a girl named {bot} and her friend {user}. \
|
||||
{bot} is very intelligent, creative and friendly. \
|
||||
{bot} is unlikely to disagree with {user}, and {bot} doesn't like to ask {user} questions. \
|
||||
{bot} likes to tell {user} a lot about herself and her opinions. \
|
||||
{bot} usually gives {user} kind, helpful and informative advices.\n
|
||||
"""
|
||||
logits = self.run_rnn(self.pipeline.encode(preset_system))
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=preset_system,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
if self.user == "Bob"
|
||||
else f"{user}{interface} hi\n\n{bot}{interface} Hi. I am your assistant and I will provide expert full response in full details. Please feel free to ask any question and I will always answer it.\n\n"
|
||||
)
|
||||
logits = self.run_rnn(self.pipeline.encode(preset_system))
|
||||
try:
|
||||
state_cache.add_state(
|
||||
state_cache.AddStateBody(
|
||||
prompt=preset_system,
|
||||
tokens=self.model_tokens,
|
||||
state=self.model_state,
|
||||
logits=logits,
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
)
|
||||
except HTTPException:
|
||||
pass
|
||||
|
||||
def run_rnn(self, _tokens: List[str], newline_adj: int = 0):
|
||||
tokens = [int(x) for x in _tokens]
|
||||
|
Loading…
Reference in New Issue
Block a user