SeaWolf-AI commited on
Commit
cd0a95c
·
verified ·
1 Parent(s): c00f0fc

Serve with greedy decoding: sampling hallucinates on this lightly-tuned checkpoint

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -115,10 +115,13 @@ def _prep(req: "GenReq"):
115
  if ids is None or not hasattr(ids, "shape"):
116
  ids = tok(prompt, return_tensors="pt").input_ids
117
  ids = ids.to(dev) # batch_size = 1 ONLY
118
- temp = float(req.temperature if req.temperature is not None else 0.7)
 
 
 
119
  gen = dict(
120
  max_new_tokens=min(int(req.max_new_tokens or MAX_NEW), MAX_NEW),
121
- do_sample=temp > 0, temperature=max(temp, 0.01), top_p=0.9,
122
  repetition_penalty=1.3, no_repeat_ngram_size=3, use_cache=False,
123
  pad_token_id=getattr(tok, "eos_token_id", None),
124
  )
 
115
  if ids is None or not hasattr(ids, "shape"):
116
  ids = tok(prompt, return_tensors="pt").input_ids
117
  ids = ids.to(dev) # batch_size = 1 ONLY
118
+ # Greedy decoding is enforced. This checkpoint carries only light instruction
119
+ # tuning, so sampling drifts off-distribution and hallucinates (e.g. inventing a
120
+ # company profile when asked who it is). Deterministic decoding reproduces what
121
+ # was actually trained. `temperature` is accepted for API compatibility but ignored.
122
  gen = dict(
123
  max_new_tokens=min(int(req.max_new_tokens or MAX_NEW), MAX_NEW),
124
+ do_sample=False,
125
  repetition_penalty=1.3, no_repeat_ngram_size=3, use_cache=False,
126
  pad_token_id=getattr(tok, "eos_token_id", None),
127
  )