Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -186,15 +186,15 @@ pipe.encode_prompt = custom_encode_prompt.__get__(pipe)
|
|
| 186 |
|
| 187 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
| 188 |
|
| 189 |
-
def patched_time_embed(
|
| 190 |
-
#
|
| 191 |
-
weight =
|
| 192 |
-
bias =
|
| 193 |
-
# Transpose weight
|
| 194 |
-
return F.linear(
|
| 195 |
-
|
| 196 |
-
#
|
| 197 |
-
pipe.transformer.time_text_embed.forward = patched_time_embed
|
| 198 |
# History functions
|
| 199 |
def append_to_history(image, prompt, seed, width, height, guidance_scale, steps, history):
|
| 200 |
"""Store only the final generated image"""
|
|
|
|
| 186 |
|
| 187 |
pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(pipe)
|
| 188 |
|
| 189 |
+
def patched_time_embed(self, timestep, guidance, pooled_projections):
|
| 190 |
+
# 'timestep' and 'guidance' are not used in our patch; we operate on pooled_projections.
|
| 191 |
+
weight = self.weight # shape should be (768, 3072)
|
| 192 |
+
bias = self.bias # shape (768,)
|
| 193 |
+
# Transpose weight so that pooled_projections (shape (B, 3072)) multiplies correctly:
|
| 194 |
+
return F.linear(pooled_projections, weight.t(), bias)
|
| 195 |
+
|
| 196 |
+
# Patch the time embedder on the transformer:
|
| 197 |
+
pipe.transformer.time_text_embed.forward = patched_time_embed.__get__(pipe.transformer.time_text_embed)
|
| 198 |
# History functions
|
| 199 |
def append_to_history(image, prompt, seed, width, height, guidance_scale, steps, history):
|
| 200 |
"""Store only the final generated image"""
|