Spaces:
Runtime error
Runtime error
ImageStudio Maintainer Claude Opus 4.8 (1M context) commited on
Commit Β·
a2d7150
1
Parent(s): 93f6c29
fix: stop VLM assistant looping into long repeated output
Browse filesGreedy decoding (do_sample=False) with no repetition controls fell into
n-gram repetition loops and ran to max_new_tokens instead of emitting EOS.
Add repetition_penalty=1.3 + no_repeat_ngram_size=3 β breaks the loops and
lets the model stop on its own, decoding stays deterministic.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
app.py
CHANGED
|
@@ -661,6 +661,12 @@ def _vlm_chat_core(message, image, reasoning, max_new_tokens):
|
|
| 661 |
**inputs,
|
| 662 |
max_new_tokens=budget,
|
| 663 |
do_sample=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
streamer=streamer,
|
| 665 |
)
|
| 666 |
except Exception as exc: # noqa: BLE001 - surfaced to the main thread
|
|
|
|
| 661 |
**inputs,
|
| 662 |
max_new_tokens=budget,
|
| 663 |
do_sample=False,
|
| 664 |
+
# Greedy decoding alone loops into repeated/rambling output that
|
| 665 |
+
# runs to max_new_tokens instead of emitting EOS. These penalties
|
| 666 |
+
# break n-gram repetition and let the model stop on its own, while
|
| 667 |
+
# keeping decoding deterministic (important for prompt rewrites).
|
| 668 |
+
repetition_penalty=1.3,
|
| 669 |
+
no_repeat_ngram_size=3,
|
| 670 |
streamer=streamer,
|
| 671 |
)
|
| 672 |
except Exception as exc: # noqa: BLE001 - surfaced to the main thread
|