Spaces:
Runtime error
Runtime error
Update pipeline_stable_diffusion_3_ipa.py
Browse files
pipeline_stable_diffusion_3_ipa.py
CHANGED
@@ -1176,14 +1176,16 @@ class StableDiffusion3Pipeline(DiffusionPipeline, SD3LoraLoaderMixin, FromSingle
|
|
1176 |
|
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.type == '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.type == 'cpu':
|
1186 |
linear_layer.to('cuda')
|
|
|
1187 |
# Pass the concatenated embeddings through the linear layer
|
1188 |
combined_embeds = linear_layer(concatenated_embeds)
|
1189 |
|
|
|
1176 |
|
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, dtype=torch.bfloat16).to('cuda')
|
1180 |
# Move `concatenated_embeds` to the GPU if it's on the CPU
|
1181 |
+
'''
|
1182 |
if concatenated_embeds.device.type == 'cpu':
|
1183 |
concatenated_embeds = concatenated_embeds.to('cuda')
|
1184 |
|
1185 |
# Move the `linear_layer` weights and biases to the GPU if they're on the CPU
|
1186 |
if linear_layer.weight.device.type == 'cpu':
|
1187 |
linear_layer.to('cuda')
|
1188 |
+
'''
|
1189 |
# Pass the concatenated embeddings through the linear layer
|
1190 |
combined_embeds = linear_layer(concatenated_embeds)
|
1191 |
|