From 4cd667875f983819414ca6a19cf612b58e6c138e Mon Sep 17 00:00:00 2001 From: Joshna-Medisetty Date: Tue, 18 Aug 2026 07:03:31 -0700 Subject: [PATCH] [XPU][SDXL] Fix text encoder input device under CPU offload (#6125) Signed-off-by: Joshna Medisetty Co-authored-by: Hongsheng Liu Co-authored-by: Cursor Co-authored-by: Nick Cao --- vllm_omni/diffusion/models/sdxl/pipeline_sdxl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vllm_omni/diffusion/models/sdxl/pipeline_sdxl.py b/vllm_omni/diffusion/models/sdxl/pipeline_sdxl.py index 0bb8a48cd..ac7231fbc 100644 --- a/vllm_omni/diffusion/models/sdxl/pipeline_sdxl.py +++ b/vllm_omni/diffusion/models/sdxl/pipeline_sdxl.py @@ -98,7 +98,7 @@ class StableDiffusionXLPipeline( prefetch_list=sdxl_subfolders, local_files_only=local_files_only, torch_dtype=dtype, - ) + ).to(self.device) self.text_encoder_2 = from_pretrained_with_prefetch( CLIPTextModelWithProjection.from_pretrained, model, @@ -106,7 +106,7 @@ class StableDiffusionXLPipeline( prefetch_list=sdxl_subfolders, local_files_only=local_files_only, torch_dtype=dtype, - ) + ).to(self.device) self.unet = SDXLUNet2DConditionModel(od_config=od_config) self.vae = from_pretrained_with_prefetch( DistributedAutoencoderKL.from_pretrained, @@ -146,7 +146,7 @@ class StableDiffusionXLPipeline( ) text_input_ids = text_inputs.input_ids - text_encoder_device = next(text_encoder.parameters()).device + text_encoder_device = self.device outputs = text_encoder(text_input_ids.to(text_encoder_device), output_hidden_states=True) prompt_embeds = outputs.hidden_states[-2].to(dtype=self.od_config.dtype, device=self.device)