if self.cached_control_image_embeddings is None:
img = Image.open(self.images[idx]).convert('RGB')
if self.random_ratio:
ratio = random.choice(["16:9", "default", "1:1", "4:3"])
if ratio != "default":
img = crop_to_aspect_ratio(img, ratio)
img = image_resize(img, self.img_size)
w, h = img.size
new_w = (w // 32) * 32
new_h = (h // 32) * 32
img = img.resize((new_w, new_h))
img = torch.from_numpy((np.array(img) / 127.5) - 1)
img = img.permute(2, 0, 1)
else:
control_img = self.cached_control_image_embeddings[self.images[idx].split('/')[-1]]
missing the variable control img