aixsatoshi
commited on
Commit
•
c9dfe44
1
Parent(s):
92e7c12
Update app.py
Browse files
app.py
CHANGED
@@ -54,8 +54,7 @@ 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 |
-
|
58 |
-
input_ids = inputs['input_ids'].to(model.device)
|
59 |
|
60 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
61 |
|
|
|
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, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
|
|
58 |
|
59 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
60 |
|