Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,13 +75,13 @@ Rules:
|
|
| 75 |
def load_model():
|
| 76 |
return Llama(
|
| 77 |
model_path=hf_hub_download(
|
| 78 |
-
repo_id="
|
| 79 |
-
filename="
|
| 80 |
token=HF_TOKEN,
|
| 81 |
cache_dir="/data"
|
| 82 |
),
|
| 83 |
n_ctx=512, # β
reduced from 2048 β fits prompt + 80 token reply
|
| 84 |
-
n_threads=
|
| 85 |
n_batch=128, # β
smaller batch = faster for single requests (was 512)
|
| 86 |
use_mmap=True,
|
| 87 |
use_mlock=False, # β
set False β mlock can fail on HF shared infra (was True)
|
|
@@ -132,7 +132,7 @@ async def chat(req: ChatRequest):
|
|
| 132 |
partial(
|
| 133 |
model,
|
| 134 |
prompt,
|
| 135 |
-
max_tokens=
|
| 136 |
temperature=req.temperature,
|
| 137 |
top_p=0.9,
|
| 138 |
top_k=40, # β
added β limits candidates, speeds up sampling
|
|
|
|
| 75 |
def load_model():
|
| 76 |
return Llama(
|
| 77 |
model_path=hf_hub_download(
|
| 78 |
+
repo_id="Valtry/llama3.2-3b-q4-gguf",
|
| 79 |
+
filename="llama3.2-3b-q4.gguf",
|
| 80 |
token=HF_TOKEN,
|
| 81 |
cache_dir="/data"
|
| 82 |
),
|
| 83 |
n_ctx=512, # β
reduced from 2048 β fits prompt + 80 token reply
|
| 84 |
+
n_threads=4, # β
matches HF free tier vCPU count (was 4)
|
| 85 |
n_batch=128, # β
smaller batch = faster for single requests (was 512)
|
| 86 |
use_mmap=True,
|
| 87 |
use_mlock=False, # β
set False β mlock can fail on HF shared infra (was True)
|
|
|
|
| 132 |
partial(
|
| 133 |
model,
|
| 134 |
prompt,
|
| 135 |
+
max_tokens=80, # β
reduced from 2048 β 30 words β 60-80 tokens
|
| 136 |
temperature=req.temperature,
|
| 137 |
top_p=0.9,
|
| 138 |
top_k=40, # β
added β limits candidates, speeds up sampling
|