You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/usr/local/lib/python3.8/dist-packages/transformers/models/clip/feature_extraction_clip.py in call(self, images, return_tensors, **kwargs)
150 images = [self.convert_rgb(image) for image in images]
151 if self.do_resize and self.size is not None and self.resample is not None:
--> 152 images = [
153 self.resize(image=image, size=self.size, resample=self.resample, default_to_square=False)
154 for image in images
It seems like this happened at the very end of inference for the NSFW of SD (after generating the image with our method).
What version of diffusers are you using?
I get this error when inferring.
Iteration 0 | Loss: 0.2740
Iteration 1 | Loss: 0.0576
Iteration 2 | Loss: 0.1228
Iteration 3 | Loss: 0.0293
Iteration 4 | Loss: 0.0415
Iteration 5 | Loss: 0.0324
Iteration 6 | Loss: 0.0325
Iteration 7 | Loss: 0.0340
Iteration 8 | Loss: 0.0391
Iteration 9 | Loss: 0.0454
Iteration 10 | Loss: 0.0406
Iteration 11 | Loss: 0.0393
Iteration 12 | Loss: 0.0386
Iteration 13 | Loss: 0.0374
Iteration 14 | Loss: 0.0359
Iteration 15 | Loss: 0.0335
Iteration 16 | Loss: 0.0307
Iteration 17 | Loss: 0.0289
Iteration 18 | Loss: 0.0283
Iteration 19 | Loss: 0.0278
Iteration 20 | Loss: 0.0281
Iteration 21 | Loss: 0.0292
Iteration 22 | Loss: 0.0311
Iteration 23 | Loss: 0.0328
Iteration 24 | Loss: 0.0339
KeyError Traceback (most recent call last)
in
----> 1 generate_images_for_method(
2 prompt="a cat and a frog",
3 seeds=[6141],
4 indices_to_alter=[2,5],
5 is_attend_and_excite=True
8 frames
in generate_images_for_method(prompt, seeds, indices_to_alter, is_attend_and_excite)
10 controller = AttentionStore()
11 run_standard_sd = False if is_attend_and_excite else True
---> 12 image = run_and_display(prompts=prompts,
13 controller=controller,
14 indices_to_alter=token_indices,
in run_and_display(prompts, controller, indices_to_alter, generator, run_standard_sd, scale_factor, thresholds, max_iter_to_alter, display_output)
17 thresholds=thresholds,
18 max_iter_to_alter=max_iter_to_alter)
---> 19 image = run_on_prompt(model=stable,
20 prompt=prompts,
21 controller=controller,
/content/excite/run.py in run_on_prompt(prompt, model, controller, token_indices, seed, config)
41 if controller is not None:
42 ptp_utils.register_attention_control(model, controller)
---> 43 outputs = model(prompt=prompt,
44 attention_store=controller,
45 indices_to_alter=token_indices,
/usr/local/lib/python3.8/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)
25 def decorate_context(*args, **kwargs):
26 with self.clone():
---> 27 return func(*args, **kwargs)
28 return cast(F, decorate_context)
29
/content/excite/pipeline_attend_and_excite.py in call(self, prompt, attention_store, indices_to_alter, attention_res, height, width, num_inference_steps, guidance_scale, eta, generator, latents, output_type, return_dict, max_iter_to_alter, run_standard_sd, thresholds, scale_factor, scale_range, smooth_attentions, sigma, kernel_size, **kwargs)
259 latents = self.scheduler.step(noise_pred, t, latents, **extra_step_kwargs).prev_sample
260
--> 261 outputs = self._prepare_output(latents, output_type, return_dict)
262 return outputs
/content/excite/pipeline_stable_diffusion.py in _prepare_output(self, latents, output_type, return_dict)
160
161 # run safety checker
--> 162 safety_cheker_input = self.feature_extractor(self.numpy_to_pil(image), return_tensors="pt").to(self.device)
163 image, has_nsfw_concept = self.safety_checker(images=image, clip_input=safety_cheker_input.pixel_values)
164
/usr/local/lib/python3.8/dist-packages/transformers/models/clip/feature_extraction_clip.py in call(self, images, return_tensors, **kwargs)
150 images = [self.convert_rgb(image) for image in images]
151 if self.do_resize and self.size is not None and self.resample is not None:
--> 152 images = [
153 self.resize(image=image, size=self.size, resample=self.resample, default_to_square=False)
154 for image in images
/usr/local/lib/python3.8/dist-packages/transformers/models/clip/feature_extraction_clip.py in (.0)
151 if self.do_resize and self.size is not None and self.resample is not None:
152 images = [
--> 153 self.resize(image=image, size=self.size, resample=self.resample, default_to_square=False)
154 for image in images
155 ]
/usr/local/lib/python3.8/dist-packages/transformers/image_utils.py in resize(self, image, size, resample, default_to_square, max_size)
282 # specified size only for the smallest edge
283 short, long = (width, height) if width <= height else (height, width)
--> 284 requested_new_short = size if isinstance(size, int) else size[0]
285
286 if short == requested_new_short:
KeyError: 0
The text was updated successfully, but these errors were encountered: