Valtry commited on
Commit
fb1699f
Β·
verified Β·
1 Parent(s): 4a5a3dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -75,13 +75,13 @@ Rules:
75
  def load_model():
76
  return Llama(
77
  model_path=hf_hub_download(
78
- repo_id="Qwen/Qwen2.5-1.5B-Instruct-GGUF",
79
- filename="qwen2.5-1.5b-instruct-q4_k_m.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=2, # βœ… 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,7 +132,7 @@ async def chat(req: ChatRequest):
132
  partial(
133
  model,
134
  prompt,
135
- max_tokens=100, # βœ… 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
 
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