Spaces:
Running on T4
Running on T4
Serve with greedy decoding: sampling hallucinates on this lightly-tuned checkpoint
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
| 119 |
gen = dict(
|
| 120 |
max_new_tokens=min(int(req.max_new_tokens or MAX_NEW), MAX_NEW),
|
| 121 |
-
do_sample=
|
| 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 |
)
|