1inkusFace commited on
Commit
f177fb8
·
verified ·
1 Parent(s): 4843f86

Update pipeline_stable_diffusion_3_ipa.py

Browse files
Files changed (1) hide show
  1. pipeline_stable_diffusion_3_ipa.py +6 -0
pipeline_stable_diffusion_3_ipa.py CHANGED
@@ -1177,7 +1177,13 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
1177
  # Create a linear layer
1178
  embedding_dim = concatenated_embeds.shape[-1] # Get the embedding dimension
1179
  linear_layer = nn.Linear(embedding_dim * len(image_prompt_embeds_list), embedding_dim)
 
 
 
1180
 
 
 
 
1181
  # Pass the concatenated embeddings through the linear layer
1182
  combined_embeds = linear_layer(concatenated_embeds)
1183
 
 
1177
  # Create a linear layer
1178
  embedding_dim = concatenated_embeds.shape[-1] # Get the embedding dimension
1179
  linear_layer = nn.Linear(embedding_dim * len(image_prompt_embeds_list), embedding_dim)
1180
+ # Move `concatenated_embeds` to the GPU if it's on the CPU
1181
+ if concatenated_embeds.device == 'cpu':
1182
+ concatenated_embeds = concatenated_embeds.to('cuda')
1183
 
1184
+ # Move the `linear_layer` weights and biases to the GPU if they're on the CPU
1185
+ if linear_layer.weight.device == 'cpu':
1186
+ linear_layer.to('cuda')
1187
  # Pass the concatenated embeddings through the linear layer
1188
  combined_embeds = linear_layer(concatenated_embeds)
1189