Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -65,11 +65,15 @@ if not os.path.exists(MODEL_PATH):
|
|
| 65 |
raise RuntimeError(f"Failed to automatically pull weights from Hugging Face Hub: {str(e)}")
|
| 66 |
|
| 67 |
print("Allocating system RAM pool and pinning LLM matrix...")
|
|
|
|
|
|
|
| 68 |
llm = Llama(
|
| 69 |
model_path=MODEL_PATH,
|
| 70 |
-
n_ctx=2048,
|
| 71 |
-
n_threads=4
|
|
|
|
| 72 |
)
|
|
|
|
| 73 |
|
| 74 |
# Populate the RAM cache immediately on server startup
|
| 75 |
refresh_knowledge_cache()
|
|
|
|
| 65 |
raise RuntimeError(f"Failed to automatically pull weights from Hugging Face Hub: {str(e)}")
|
| 66 |
|
| 67 |
print("Allocating system RAM pool and pinning LLM matrix...")
|
| 68 |
+
|
| 69 |
+
# --- ALL CRITICAL ARGUMENTS CONSOLIDATED HERE ---
|
| 70 |
llm = Llama(
|
| 71 |
model_path=MODEL_PATH,
|
| 72 |
+
n_ctx=2048, # Total token capacity for system instructions + chat history
|
| 73 |
+
n_threads=4, # Balanced CPU core assignment for Hugging Face Spaces
|
| 74 |
+
chat_format="chatml" # Forces the model to use ChatML formatting so it doesn't speak gibberish
|
| 75 |
)
|
| 76 |
+
# ------------------------------------------------
|
| 77 |
|
| 78 |
# Populate the RAM cache immediately on server startup
|
| 79 |
refresh_knowledge_cache()
|