Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported operand type(s) for %: 'int' and 'NoneType' #8222

Open
fancy45daddy opened this issue Oct 5, 2024 · 0 comments
Open

unsupported operand type(s) for %: 'int' and 'NoneType' #8222

fancy45daddy opened this issue Oct 5, 2024 · 0 comments

Comments

@fancy45daddy
Copy link

fancy45daddy commented Oct 5, 2024

❓ Questions and Help

I follow the https://github.com/pytorch/xla/blob/master/contrib/kaggle/pytorch-xla-2-0-on-kaggle.ipynb

but the code in image = pipeline(prompt, callback=lambda *args: xm.mark_step(), generator=generator).images[0]
get

TypeError                                 Traceback (most recent call last)
Cell In[8], line 4
      1 generator = torch.Generator().manual_seed(0)
      2 # xm.mark_step compiles and executes the graph after each iteration.
      3 # The first few steps will be much slower than the rest.
----> 4 image = pipeline(prompt, callback=lambda *args: xm.mark_step(), generator=generator).images[0]
      5 image

File /usr/local/lib/python3.8/site-packages/torch/utils/_contextlib.py:115, in context_decorator.<locals>.decorate_context(*args, **kwargs)
    112 @functools.wraps(func)
    113 def decorate_context(*args, **kwargs):
    114     with ctx_factory():
--> 115         return func(*args, **kwargs)

File /usr/local/lib/python3.8/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py:1035, in StableDiffusionPipeline.__call__(self, prompt, height, width, num_inference_steps, timesteps, sigmas, guidance_scale, negative_prompt, num_images_per_prompt, eta, generator, latents, prompt_embeds, negative_prompt_embeds, ip_adapter_image, ip_adapter_image_embeds, output_type, return_dict, cross_attention_kwargs, guidance_rescale, clip_skip, callback_on_step_end, callback_on_step_end_tensor_inputs, **kwargs)
   1033 if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
   1034     progress_bar.update()
-> 1035     if callback is not None and i % callback_steps == 0:
   1036         step_idx = i // getattr(self.scheduler, "order", 1)
   1037         callback(step_idx, t, latents)

TypeError: unsupported operand type(s) for %: 'int' and 'NoneType'

how to fix the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant