Spaces:
Sleeping
Sleeping
aixsatoshi
commited on
Commit
•
3a0dcd2
1
Parent(s):
922f584
Update app.py
Browse files
app.py
CHANGED
@@ -54,13 +54,13 @@ def stream_chat(message: str, history: list, temperature: float, max_new_tokens:
|
|
54 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
55 |
conversation.append({"role": "user", "content": message})
|
56 |
|
57 |
-
input_ids = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
|
58 |
-
inputs = tokenizer(input_ids, return_tensors="pt").to(0)
|
59 |
|
60 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
61 |
|
62 |
generate_kwargs = dict(
|
63 |
-
|
64 |
streamer=streamer,
|
65 |
top_k=top_k,
|
66 |
top_p=top_p,
|
|
|
54 |
conversation.extend([{"role": "user", "content": prompt}, {"role": "assistant", "content": answer}])
|
55 |
conversation.append({"role": "user", "content": message})
|
56 |
|
57 |
+
input_ids = tokenizer.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True).to(model.device)
|
58 |
+
#inputs = tokenizer(input_ids, return_tensors="pt").to(0)
|
59 |
|
60 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
61 |
|
62 |
generate_kwargs = dict(
|
63 |
+
input_ids,
|
64 |
streamer=streamer,
|
65 |
top_k=top_k,
|
66 |
top_p=top_p,
|