AbstractPhil commited on
Commit
0bf3e20
·
verified ·
1 Parent(s): 69d3dbb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -186,7 +186,8 @@ def infer(prompt, negative_prompt, adapter_l_file, adapter_g_file, strength, noi
186
 
187
  # Apply CLIP-L adapter
188
  if adapter_l is not None:
189
- anchor_l, delta_l, log_sigma_l, attn_l1, attn_l2, tau_l, g_pred_l, gate_l = adapter_l(t5_seq, clip_embeds["clip_l"])
 
190
  gate_l_scaled = gate_l * gate_prob
191
  delta_l_final = delta_l * strength * gate_l_scaled
192
  clip_l_mod = clip_embeds["clip_l"] + delta_l_final
@@ -203,7 +204,10 @@ def infer(prompt, negative_prompt, adapter_l_file, adapter_g_file, strength, noi
203
 
204
  # Apply CLIP-G adapter
205
  if adapter_g is not None:
206
- anchor_g, delta_g, log_sigma_g, attn_g1, attn_g2, tau_g, g_pred_g, gate_g = adapter_g(t5_seq, clip_embeds["clip_g"])
 
 
 
207
  gate_g_scaled = gate_g * gate_prob
208
  delta_g_final = delta_g * strength * gate_g_scaled
209
  clip_g_mod = clip_embeds["clip_g"] + delta_g_final
 
186
 
187
  # Apply CLIP-L adapter
188
  if adapter_l is not None:
189
+ clip_l_in = clip_embeds["clip_l"].to(torch.float32)
190
+ anchor_l, delta_l, log_sigma_l, attn_l1, attn_l2, tau_l, g_pred_l, gate_l = adapter_l(t5_seq, clip_l_in)
191
  gate_l_scaled = gate_l * gate_prob
192
  delta_l_final = delta_l * strength * gate_l_scaled
193
  clip_l_mod = clip_embeds["clip_l"] + delta_l_final
 
204
 
205
  # Apply CLIP-G adapter
206
  if adapter_g is not None:
207
+ # Float32 adapter input
208
+ clip_g_in = clip_embeds["clip_g"].to(torch.float32)
209
+
210
+ anchor_g, delta_g, log_sigma_g, attn_g1, attn_g2, tau_g, g_pred_g, gate_g = adapter_g(t5_seq, clip_g_in)
211
  gate_g_scaled = gate_g * gate_prob
212
  delta_g_final = delta_g * strength * gate_g_scaled
213
  clip_g_mod = clip_embeds["clip_g"] + delta_g_final