Spaces:
Runtime error
Runtime error
Update model.py
Browse files
model.py
CHANGED
|
@@ -15,9 +15,9 @@ def run(message: str,
|
|
| 15 |
chat_history: list[tuple[str, str]],
|
| 16 |
system_prompt: str,
|
| 17 |
max_new_tokens: int = 1024,
|
| 18 |
-
temperature: float = 0.
|
| 19 |
-
top_p: float = 0.
|
| 20 |
-
top_k: int =
|
| 21 |
history = []
|
| 22 |
print(chat_history)
|
| 23 |
result=""
|
|
@@ -26,7 +26,7 @@ def run(message: str,
|
|
| 26 |
history.append({"role": "assistant", "content": i[1]})
|
| 27 |
print(history)
|
| 28 |
history.append({"role": "user", "content": message})
|
| 29 |
-
for response in llm.create_chat_completion(history,stream=True,max_tokens=-1,temperature=
|
| 30 |
if "content" in response["choices"][0]["delta"]:
|
| 31 |
result = result + response["choices"][0]["delta"]["content"]
|
| 32 |
yield result
|
|
|
|
| 15 |
chat_history: list[tuple[str, str]],
|
| 16 |
system_prompt: str,
|
| 17 |
max_new_tokens: int = 1024,
|
| 18 |
+
temperature: float = 0.3,
|
| 19 |
+
top_p: float = 0.85,
|
| 20 |
+
top_k: int = 5) -> Iterator[str]:
|
| 21 |
history = []
|
| 22 |
print(chat_history)
|
| 23 |
result=""
|
|
|
|
| 26 |
history.append({"role": "assistant", "content": i[1]})
|
| 27 |
print(history)
|
| 28 |
history.append({"role": "user", "content": message})
|
| 29 |
+
for response in llm.create_chat_completion(history,stream=True,max_tokens=-1,temperature=temperature,top_k=top_k,top_p=top_p,repeat_penalty=1.1):
|
| 30 |
if "content" in response["choices"][0]["delta"]:
|
| 31 |
result = result + response["choices"][0]["delta"]["content"]
|
| 32 |
yield result
|