From 7c729e19d767ea57680a8f149d77962cb5710217 Mon Sep 17 00:00:00 2001 From: Boopathy Kannappan <86243143+bkdoeng@users.noreply.github.com> Date: Tue, 2 Jun 2026 06:04:08 -0500 Subject: [PATCH] [Bugfix] Fix SD3 T5 truncation check device mismatch on long prompts (#3949) Signed-off-by: bkannappan --- vllm_omni/diffusion/models/sd3/pipeline_sd3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vllm_omni/diffusion/models/sd3/pipeline_sd3.py b/vllm_omni/diffusion/models/sd3/pipeline_sd3.py index 85027b252..22bb8ff05 100644 --- a/vllm_omni/diffusion/models/sd3/pipeline_sd3.py +++ b/vllm_omni/diffusion/models/sd3/pipeline_sd3.py @@ -389,12 +389,12 @@ class StableDiffusion3Pipeline(nn.Module, CFGParallelMixin, DiffusionPipelinePro truncation=True, add_special_tokens=True, return_tensors="pt", - ).to(self.device) + ) text_input_ids = text_inputs.input_ids untruncated_ids = self.tokenizer_3(prompt, padding="longest", return_tensors="pt").input_ids if untruncated_ids.shape[-1] >= text_input_ids.shape[-1] and not torch.equal(text_input_ids, untruncated_ids): - removed_text = self.tokenizer_3.batch_decode(untruncated_ids[:, self.tokenizer_max_length - 1 : -1]) + removed_text = self.tokenizer_3.batch_decode(untruncated_ids[:, max_sequence_length - 1 : -1]) logger.warning( "The following part of your input was truncated because `max_sequence_length` is set to " f" {max_sequence_length} tokens: {removed_text}"