Update pipeline.py
Browse files- pipeline.py +12 -0
pipeline.py
CHANGED
@@ -1206,6 +1206,18 @@ class AnimateDiffPipeline(DiffusionPipeline, TextualInversionLoaderMixin, IPAdap
|
|
1206 |
# select the relevent context from the latents
|
1207 |
current_context_latents = latents[:, :, current_context_indexes, :, :]
|
1208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1209 |
# expand the latents if we are doing classifier free guidance
|
1210 |
latent_model_input = torch.cat([current_context_latents] * 2) if do_classifier_free_guidance else current_context_latents
|
1211 |
latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
|
|
|
1206 |
# select the relevent context from the latents
|
1207 |
current_context_latents = latents[:, :, current_context_indexes, :, :]
|
1208 |
|
1209 |
+
if self.controlnet != None:
|
1210 |
+
# if we are using multiple controlnets, select the context window for each controlnet
|
1211 |
+
if isinstance(controlnet, MultiControlNetModel):
|
1212 |
+
for c in range(len(controlnet.nets)):
|
1213 |
+
current_context_conditioning_frames[c] = conditioning_frames[c][current_context_indexes, :, :, :]
|
1214 |
+
else:
|
1215 |
+
# select the relevent context from the conditioning frames of shape (frame_number, channel, height, width)
|
1216 |
+
current_context_conditioning_frames = conditioning_frames[current_context_indexes, :, :, :]
|
1217 |
+
else:
|
1218 |
+
current_context_conditioning_frames = None
|
1219 |
+
|
1220 |
+
|
1221 |
# expand the latents if we are doing classifier free guidance
|
1222 |
latent_model_input = torch.cat([current_context_latents] * 2) if do_classifier_free_guidance else current_context_latents
|
1223 |
latent_model_input = self.scheduler.scale_model_input(latent_model_input, t)
|