File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1088,8 +1088,10 @@ def __call__(
1088
1088
1089
1089
# perform guidance
1090
1090
if self .do_classifier_free_guidance :
1091
- noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1092
1091
if adaptive_projected_guidance :
1092
+ sigma = self .scheduler .sigmas [self .scheduler .step_index ]
1093
+ noise_pred = latents - sigma * noise_pred
1094
+ noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1093
1095
noise_pred = normalized_guidance (
1094
1096
noise_pred_text ,
1095
1097
noise_pred_uncond ,
@@ -1098,7 +1100,9 @@ def __call__(
1098
1100
eta ,
1099
1101
adaptive_projected_guidance_rescale_factor ,
1100
1102
)
1103
+ noise_pred = (latents - noise_pred ) / sigma
1101
1104
else :
1105
+ noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1102
1106
noise_pred = noise_pred_uncond + self .guidance_scale * (noise_pred_text - noise_pred_uncond )
1103
1107
1104
1108
if self .do_classifier_free_guidance and self .guidance_rescale > 0.0 :
Original file line number Diff line number Diff line change @@ -1281,8 +1281,10 @@ def __call__(
1281
1281
1282
1282
# perform guidance
1283
1283
if self .do_classifier_free_guidance :
1284
- noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1285
1284
if adaptive_projected_guidance :
1285
+ sigma = self .scheduler .sigmas [self .scheduler .step_index ]
1286
+ noise_pred = latents - sigma * noise_pred
1287
+ noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1286
1288
noise_pred = normalized_guidance (
1287
1289
noise_pred_text ,
1288
1290
noise_pred_uncond ,
@@ -1291,7 +1293,9 @@ def __call__(
1291
1293
eta ,
1292
1294
adaptive_projected_guidance_rescale_factor ,
1293
1295
)
1296
+ noise_pred = (latents - noise_pred ) / sigma
1294
1297
else :
1298
+ noise_pred_uncond , noise_pred_text = noise_pred .chunk (2 )
1295
1299
noise_pred = noise_pred_uncond + self .guidance_scale * (noise_pred_text - noise_pred_uncond )
1296
1300
1297
1301
if self .do_classifier_free_guidance and self .guidance_rescale > 0.0 :
You can’t perform that action at this time.
0 commit comments