Spaces:
Runtime error
Runtime error
minor
Browse files- chat/transformerschat.py +5 -5
chat/transformerschat.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
|
5 |
|
6 |
def models():
|
7 |
-
return ["
|
8 |
|
9 |
|
10 |
def load():
|
@@ -38,11 +38,11 @@ def ask(_, system_prompt, pre_prompt, question):
|
|
38 |
{'role': 'system', 'content': f"{system_prompt} {pre_prompt}", },
|
39 |
{'role': 'user', 'content': f"{question}", },
|
40 |
]
|
41 |
-
logger.debug(f"<<
|
42 |
-
|
43 |
-
inputs = tokenizer.apply_chat_template(messages,
|
44 |
|
45 |
outputs = model.generate(inputs, max_length=200)
|
46 |
answer = tokenizer.batch_decode(outputs)[0]
|
47 |
-
logger.debug(f">>
|
48 |
return answer
|
|
|
4 |
|
5 |
|
6 |
def models():
|
7 |
+
return ["mistral-7b-openorca.Q5_K_M.gguf"]
|
8 |
|
9 |
|
10 |
def load():
|
|
|
38 |
{'role': 'system', 'content': f"{system_prompt} {pre_prompt}", },
|
39 |
{'role': 'user', 'content': f"{question}", },
|
40 |
]
|
41 |
+
logger.debug(f"<< transformers << {messages}")
|
42 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
43 |
+
# inputs = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False)
|
44 |
|
45 |
outputs = model.generate(inputs, max_length=200)
|
46 |
answer = tokenizer.batch_decode(outputs)[0]
|
47 |
+
logger.debug(f">> transformers >> {answer}")
|
48 |
return answer
|