Spaces:
Sleeping
Sleeping
fix: 确保text_encoder_projection_dim在调用时正确初始化
Browse files
utils.py
CHANGED
@@ -284,6 +284,9 @@ def call(
|
|
284 |
|
285 |
# 7. Prepare added time ids & embeddings
|
286 |
add_text_embeds = pooled_prompt_embeds
|
|
|
|
|
|
|
287 |
add_time_ids = self._get_add_time_ids(
|
288 |
original_size, crops_coords_top_left, target_size, dtype=prompt_embeds.dtype
|
289 |
)
|
@@ -306,9 +309,6 @@ def call(
|
|
306 |
add_text_embeds = add_text_embeds.to(device)
|
307 |
add_time_ids = add_time_ids.to(device).repeat(batch_size * num_images_per_prompt, 1)
|
308 |
|
309 |
-
# 确保 text_encoder_projection_dim 被正确初始化
|
310 |
-
if not hasattr(self, 'text_encoder_projection_dim'):
|
311 |
-
self.text_encoder_projection_dim = 128 # 或者其他适当的默认值
|
312 |
|
313 |
# 8. Denoising loop
|
314 |
num_warmup_steps = max(len(timesteps) - num_inference_steps * self.scheduler.order, 0)
|
|
|
284 |
|
285 |
# 7. Prepare added time ids & embeddings
|
286 |
add_text_embeds = pooled_prompt_embeds
|
287 |
+
# 确保 text_encoder_projection_dim 被正确初始化
|
288 |
+
if not hasattr(self, 'text_encoder_projection_dim'):
|
289 |
+
self.text_encoder_projection_dim = 128 # 或者其他适当的默认值
|
290 |
add_time_ids = self._get_add_time_ids(
|
291 |
original_size, crops_coords_top_left, target_size, dtype=prompt_embeds.dtype
|
292 |
)
|
|
|
309 |
add_text_embeds = add_text_embeds.to(device)
|
310 |
add_time_ids = add_time_ids.to(device).repeat(batch_size * num_images_per_prompt, 1)
|
311 |
|
|
|
|
|
|
|
312 |
|
313 |
# 8. Denoising loop
|
314 |
num_warmup_steps = max(len(timesteps) - num_inference_steps * self.scheduler.order, 0)
|