Update app.py
Browse files
app.py
CHANGED
|
@@ -3,14 +3,25 @@ from llama_cpp import Llama
|
|
| 3 |
|
| 4 |
llm = Llama(
|
| 5 |
model_path="yugogpt-q4_k_s.gguf",
|
| 6 |
-
n_ctx=4096
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
)
|
| 8 |
|
| 9 |
def chat(message, history):
|
| 10 |
response = llm.create_completion(
|
| 11 |
f"USER: {message}\nASSISTANT:",
|
| 12 |
-
|
| 13 |
-
temperature=0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
)
|
| 15 |
return response['choices'][0]['text']
|
| 16 |
|
|
|
|
| 3 |
|
| 4 |
llm = Llama(
|
| 5 |
model_path="yugogpt-q4_k_s.gguf",
|
| 6 |
+
n_ctx=4096, # Doubled context length
|
| 7 |
+
n_threads=8, # Increased threads
|
| 8 |
+
n_batch=1024, # Increased batch size
|
| 9 |
+
use_mlock=True,
|
| 10 |
+
use_mmap=True,
|
| 11 |
+
n_gpu_layers=0, # Set this to higher number if GPU available
|
| 12 |
+
verbose=False # Reduced logging for better performance
|
| 13 |
)
|
| 14 |
|
| 15 |
def chat(message, history):
|
| 16 |
response = llm.create_completion(
|
| 17 |
f"USER: {message}\nASSISTANT:",
|
| 18 |
+
max_tokens=4096, # Increased max tokens
|
| 19 |
+
temperature=0.1, # Keeping it precise
|
| 20 |
+
top_p=0.1,
|
| 21 |
+
repeat_penalty=1.2,
|
| 22 |
+
top_k=20,
|
| 23 |
+
stop=["USER:", "\n\n"],
|
| 24 |
+
stream=True
|
| 25 |
)
|
| 26 |
return response['choices'][0]['text']
|
| 27 |
|