Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,6 @@ def bot(
|
|
65 |
):
|
66 |
model = MODEL
|
67 |
tokens = get_system_tokens(model)[:]
|
68 |
-
tokens.append(LINEBREAK_TOKEN)
|
69 |
|
70 |
for user_message, bot_message in history[:-1]:
|
71 |
message_tokens = get_message_tokens(model=model, role="user", content=user_message)
|
@@ -78,7 +77,7 @@ def bot(
|
|
78 |
message_tokens = get_message_tokens(model=model, role="user", content=last_user_message)
|
79 |
tokens.extend(message_tokens)
|
80 |
|
81 |
-
role_tokens =
|
82 |
tokens.extend(role_tokens)
|
83 |
generator = model.generate(
|
84 |
tokens,
|
|
|
65 |
):
|
66 |
model = MODEL
|
67 |
tokens = get_system_tokens(model)[:]
|
|
|
68 |
|
69 |
for user_message, bot_message in history[:-1]:
|
70 |
message_tokens = get_message_tokens(model=model, role="user", content=user_message)
|
|
|
77 |
message_tokens = get_message_tokens(model=model, role="user", content=last_user_message)
|
78 |
tokens.extend(message_tokens)
|
79 |
|
80 |
+
role_tokens = model.tokenize("bot\n".encode("utf-8"), special=True)
|
81 |
tokens.extend(role_tokens)
|
82 |
generator = model.generate(
|
83 |
tokens,
|