Skip to content

txt2img.py crash if ddim_steps is power of 3 #111

@mvnowak

Description

@mvnowak

There is certain values for the ddim_steps parameter, for which the model crashes with the stack trace appended at the end.

  • 3 => crashes
  • 9 => crashes
  • 27 => crashes
  • 81 => gets changed into 84 by the model

Example that leads to the crash:
python scripts/txt2img.py --prompt "tree" --ddim_steps 9 --n_samples 1

Stacktrace:

 Traceback (most recent call last):
  File "scripts/txt2img.py", line 344, in <module>
    main()
  File "scripts/txt2img.py", line 295, in main
    samples_ddim, _ = sampler.sample(S=opt.ddim_steps,
  File "..\envs\ldm\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "..\ldm\models\diffusion\ddim.py", line 90, in sample
    self.make_schedule(ddim_num_steps=S, ddim_eta=eta, verbose=verbose)
  File "..\ldm\models\diffusion\ddim.py", line 44, in make_schedule
    ddim_sigmas, ddim_alphas, ddim_alphas_prev = make_ddim_sampling_parameters(alphacums=alphas_cumprod.cpu(),
  File "..\ldm\modules\diffusionmodules\util.py", line 65, in make_ddim_sampling_parameters
    alphas = alphacums[ddim_timesteps]
IndexError: index 1000 is out of bounds for dimension 0 with size 1000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions