[Bugfix] Reject sampling params unsupported by diffusion models (#45418)

Signed-off-by: Guan-Ming (Wesley) Chiu <105915352+guan404ming@users.noreply.github.com>
This commit is contained in:
Guan-Ming Chiu
2026-07-07 11:25:36 +00:00
committed by GitHub
parent 48fcfc926c
commit ed051fab54
5 changed files with 78 additions and 0 deletions
+23
View File
@@ -745,6 +745,7 @@ class SamplingParams(
self._validate_logits_processors(model_config)
self._validate_allowed_token_ids(tokenizer)
self._validate_spec_decode(speculative_config)
self._validate_diffusion(model_config)
self._validate_structured_outputs(
model_config, structured_outputs_config, tokenizer
)
@@ -878,6 +879,28 @@ class SamplingParams(
"are not yet supported with speculative decoding."
)
def _validate_diffusion(self, model_config: ModelConfig) -> None:
if not model_config.is_diffusion:
return
# Diffusion models denoise a whole canvas per step with a fixed
# temperature schedule, so per-request sampling parameters are not
# supported. Penalties are ignored by the sampler with a warning.
if (
self.temperature != 1.0
or self.min_p > _SAMPLING_EPS
or self.seed is not None
or self.min_tokens > 0
or self.logit_bias
or self.bad_words
or self.allowed_token_ids
):
raise ValueError(
"The temperature, min_p, seed, min_tokens, logit_bias, "
"bad_words, and allowed_token_ids sampling parameters "
"are not yet supported with diffusion models."
)
def _validate_structured_outputs(
self,
model_config: ModelConfig,