55 RETURN_NAMES = ("IMAGE", "LOOP IDX (INT)", "IDX_IN_BATCH (INT)") 56 57 def execute(self, key, batch_size, loop_idx, opt_pipeline=None): 58 key = key.strip() 59 assert GLOBAL_IMAGE_STORAGE[key], f"Image storage {key} doesn't exist." 60 dataloader = DataLoader(torch.cat(GLOBAL_IMAGE_STORAGE[key], dim=0), batch_size=batch_size) 61 return (list(dataloader)[loop_idx], loop_idx, loop_idx % batch_size) 62
120 folder = os.path.join(folder_paths.get_input_directory(), folder) 121 images = filter(lambda f: os.path.splitext(f)[1] in IMAGE_EXTENSIONS, os.listdir(folder)) 122 images = sorted(list(images)) 123 124 assert len(images), "No image is found in folder {folder}" 125 126 GLOBAL_IMAGE_STORAGE[key] = [] 127
194 RETURN_NAMES = ("LATENT", "LOOP IDX (INT)", "IDX_IN_BATCH (INT)") 195 196 def execute(self, key, batch_size, loop_idx, opt_pipeline=None): 197 key = key.strip() 198 assert GLOBAL_LATENT_STORAGE[key], f"Latent storage {key} doesn't exist." 199 dataloader = DataLoader(torch.cat(GLOBAL_LATENT_STORAGE[key], dim=0), batch_size=batch_size) 200 return (list(dataloader)[loop_idx], loop_idx, loop_idx % batch_size) 201