From 199b1cc17b61be305644a3605cf17c0908fd6e16 Mon Sep 17 00:00:00 2001 From: IDGallagher Date: Sun, 28 Apr 2024 22:11:52 +0100 Subject: [PATCH] Fix error when ipa_weight is set to 0 on base --- SteerableMotion.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/SteerableMotion.py b/SteerableMotion.py index 7fdac30..9d990c9 100644 --- a/SteerableMotion.py +++ b/SteerableMotion.py @@ -533,20 +533,21 @@ class BatchCreativeInterpolationNode: else: big_negative_noise = None - # Fill up bins with image frames. Bins will automatically be created when needed but all the frames should be able to be packed into two bins - active_index = -1 - # Find a bin that we can fit the next image into - for i, bin in enumerate(bins): - if bin.length() <= ipa_frame_numbers[0]: - active_index = i - break - # If we didn't find a suitable bin, add a new one - if active_index == -1: - bins.append(IPBin()) - active_index = len(bins) - 1 + if len(ipa_frame_numbers) > 0: + # Fill up bins with image frames. Bins will automatically be created when needed but all the frames should be able to be packed into two bins + active_index = -1 + # Find a bin that we can fit the next image into + for i, bin in enumerate(bins): + if bin.length() <= ipa_frame_numbers[0]: + active_index = i + break + # If we didn't find a suitable bin, add a new one + if active_index == -1: + bins.append(IPBin()) + active_index = len(bins) - 1 - # Add the image to the bin - bins[active_index].add(prepped_image, image.unsqueeze(0), negative_noise, big_negative_noise, image_index, ipa_frame_numbers, ipa_weights) + # Add the image to the bin + bins[active_index].add(prepped_image, image.unsqueeze(0), negative_noise, big_negative_noise, image_index, ipa_frame_numbers, ipa_weights) # for i, bin in enumerate(bins): # print(f"{i} schedule {bin.image_schedule}")