[Perf] DiffusionGemma: constrained reads over the request's logprob_token_ids (#58216)

Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Lucas Wilkinson <LucasWilkinson@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Misha Goin <mgoin64@gmail.com>
This commit is contained in:
Matt Mastracci
2026-09-24 13:15:08 -07:00
committed by GitHub
co-authored by Claude Fable 5.1 Lucas Wilkinson mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Misha Goin
parent 92e9c6bf13
commit ab3de6edf2
6 changed files with 262 additions and 6 deletions
+12
View File
@@ -94,6 +94,18 @@ def validate_diffusion_sampling_params(
params.max_tokens = min(params.max_tokens or expected_len, expected_len)
params.ignore_eos = True
constrained = extra.get("diffusion_constrained")
if constrained is not None:
check(
isinstance(constrained, (bool, int)) and constrained in (0, 1),
"diffusion_constrained must be a boolean (or 0/1).",
)
if constrained:
check(
bool(params.logprob_token_ids),
"diffusion_constrained needs logprob_token_ids: they are the allowed set.",
)
check(
bool(async_scheduling)
or width is None