Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -111,7 +111,7 @@ chat_intro = '''The following is a coherent verbose detailed conversation betwee
|
|
111 |
|
112 |
def user(message, chatbot):
|
113 |
chatbot = chatbot or []
|
114 |
-
print(f"User: {message}")
|
115 |
return "", chatbot + [[message, None]]
|
116 |
|
117 |
def alternative(chatbot, history):
|
@@ -155,7 +155,7 @@ def chat(
|
|
155 |
|
156 |
out, state = model.forward(pipeline.encode(prompt), None)
|
157 |
history = [state, None, []] # [state, state_pre, tokens]
|
158 |
-
print("History reloaded.")
|
159 |
|
160 |
[state, _, all_tokens] = history
|
161 |
state_pre_0 = copy.deepcopy(state)
|
@@ -163,7 +163,7 @@ def chat(
|
|
163 |
out, state = model.forward(pipeline.encode(ctx)[-ctx_limit:], state)
|
164 |
state_pre_1 = copy.deepcopy(state) # For recovery
|
165 |
|
166 |
-
print("Bot:", end='')
|
167 |
|
168 |
begin = len(all_tokens)
|
169 |
out_last = begin
|
@@ -197,7 +197,7 @@ def chat(
|
|
197 |
|
198 |
tmp = pipeline.decode(all_tokens[out_last:])
|
199 |
if '\ufffd' not in tmp:
|
200 |
-
print(tmp, end='', flush=True)
|
201 |
out_last = begin + i + 1
|
202 |
out_str += tmp
|
203 |
|
|
|
111 |
|
112 |
def user(message, chatbot):
|
113 |
chatbot = chatbot or []
|
114 |
+
# print(f"User: {message}")
|
115 |
return "", chatbot + [[message, None]]
|
116 |
|
117 |
def alternative(chatbot, history):
|
|
|
155 |
|
156 |
out, state = model.forward(pipeline.encode(prompt), None)
|
157 |
history = [state, None, []] # [state, state_pre, tokens]
|
158 |
+
# print("History reloaded.")
|
159 |
|
160 |
[state, _, all_tokens] = history
|
161 |
state_pre_0 = copy.deepcopy(state)
|
|
|
163 |
out, state = model.forward(pipeline.encode(ctx)[-ctx_limit:], state)
|
164 |
state_pre_1 = copy.deepcopy(state) # For recovery
|
165 |
|
166 |
+
# print("Bot:", end='')
|
167 |
|
168 |
begin = len(all_tokens)
|
169 |
out_last = begin
|
|
|
197 |
|
198 |
tmp = pipeline.decode(all_tokens[out_last:])
|
199 |
if '\ufffd' not in tmp:
|
200 |
+
# print(tmp, end='', flush=True)
|
201 |
out_last = begin + i + 1
|
202 |
out_str += tmp
|
203 |
|