Skip to content

The Stable Diffusion notebook is broken. #8899

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

Open
zhanyong-wan opened this issue Mar 27, 2025 · 0 comments
Open

The Stable Diffusion notebook is broken. #8899

zhanyong-wan opened this issue Mar 27, 2025 · 0 comments
Assignees
Labels
bug Something isn't working documentation

Comments

@zhanyong-wan
Copy link
Collaborator

📚 Documentation

The README points to a Stable Diffusion notebook to help a user get started. However, this notebook cannot be run successfully:

  1. The import torch_xla step results in an error:
oduleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_27/3499457412.py in <module>
----> 1 import torch_xla
      2 torch_xla.__version__

ModuleNotFoundError: No module named 'torch_xla'

This can be fixed by

!pip install torch~=2.6.0 'torch_xla[tpu]~=2.6.0' \
  -f https://storage.googleapis.com/libtpu-releases/index.html \
  -f [https://storage.googleapis.com/libtpu-wheels/index.html](https://storage.googleapis.com/libtpu-wheels/index.html%60)
  1. Later, the image = pipeline(prompt, callback=lambda *args: xm.mark_step(), generator=generator).images[0] step failed with
/usr/local/lib/python3.11/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py:894: FutureWarning: `callback` is deprecated and will be removed in version 1.0.0. Passing `callback` as an input argument to `__call__` is deprecated, consider using `callback_on_step_end`
  deprecate(
  2%
 1/50 [01:16<1:02:27, 76.48s/it]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-10-049c86b52afd>](https://localhost:8080/#) in <cell line: 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

1 frames
[/usr/local/lib/python3.11/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion.py](https://localhost:8080/#) in __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)
   1068                 if i == len(timesteps) - 1 or ((i + 1) > num_warmup_steps and (i + 1) % self.scheduler.order == 0):
   1069                     progress_bar.update()
-> 1070                     if callback is not None and i % callback_steps == 0:
   1071                         step_idx = i // getattr(self.scheduler, "order", 1)
   1072                         callback(step_idx, t, latents)

TypeError: unsupported operand type(s) for %: 'int' and 'NoneType'
@qihqi qihqi self-assigned this Mar 27, 2025
@ysiraichi ysiraichi added bug Something isn't working documentation labels Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation
Projects
None yet
Development

No branches or pull requests

3 participants