Files
nanaoto e9237d4152 fix: forward do_sample to inference_speech in both v2 and v2.5
`infer_generator()` parses `do_sample` out of `generation_kwargs` and then
never uses it — the call to `inference_speech()` passes a literal `True`:

    indextts/infer_v2.py:536      do_sample = generation_kwargs.pop("do_sample", True)
    indextts/infer_v2.py:589      do_sample=True,

    indextts/infer_v2_5.py:731    do_sample = generation_kwargs.pop("do_sample", True)
    indextts/infer_v2_5.py:780    do_sample=True,

In both files the parsed local is dead: those two lines are its only mentions.
Because the value is `pop`ped rather than left in `generation_kwargs`, passing
`do_sample=False` is swallowed silently instead of reaching the model, so greedy
decoding has never been reachable through the public `infer()` API.

The value does have somewhere to arrive: `inference_speech()` collects
`**hf_generate_kwargs` and forwards them to `GPT2InferenceModel.generate()`
(`indextts/gpt/model_v2.py:820`, `indextts/gpt/model_v2_5.py:779`), which is
where HuggingFace reads `do_sample`.

Default behaviour is unchanged — the `pop` default is still `True`, and only an
explicit `do_sample=False` now takes effect.

Fixes #577. Supersedes #726, which fixed the v2 site only; 2.5 is the current
default path and had the same defect.

Verified: `uv run --extra test pytest -m "not gpu"` — 151 passed, with two
`test_model_download_reachable` failures from HuggingFace CDN SSL resets that
reproduce on unmodified main.
2026-08-13 18:25:24 +08:00
..
2025-09-08 17:36:39 +08:00
2026-08-11 15:08:26 +08:00
2025-03-25 12:52:52 +08:00
2025-03-25 14:03:29 -04:00