stablediffusion icon indicating copy to clipboard operation
stablediffusion copied to clipboard

Number of steps - range() arg 3 must not be zero

Open horsto opened this issue 3 years ago • 0 comments

I am trying to improve the quality of my output by increasing the number of steps (assuming that is the (one?) way to do it).

python scripts/txt2img.py --prompt "my super unique prompt" \
--ckpt "v2-1_768-ema-pruned.ckpt" --config configs/stable-diffusion/v2-inference-v.yaml \
--H 325 --W 768 --n_samples 1 --steps 5000

But increasing number of steps beyond 500 runs into the error:

  File "scripts/txt2img.py", line 291, in <module>
    main(opt)
  File "scripts/txt2img.py", line 250, in main
    samples, _ = sampler.sample(S=opt.steps,
  File "C:\Users\hoben\miniconda3\envs\ldm\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "c:\code\stablediffusion\ldm\models\diffusion\ddim.py", line 97, in sample
    self.make_schedule(ddim_num_steps=S, ddim_eta=eta, verbose=verbose)
  File "c:\code\stablediffusion\ldm\models\diffusion\ddim.py", line 24, in make_schedule
    self.ddim_timesteps = make_ddim_timesteps(ddim_discr_method=ddim_discretize, num_ddim_timesteps=ddim_num_steps,
  File "c:\code\stablediffusion\ldm\modules\diffusionmodules\util.py", line 50, in make_ddim_timesteps
    ddim_timesteps = np.asarray(list(range(0, num_ddpm_timesteps, c)))
ValueError: range() arg 3 must not be zero

horsto avatar Dec 25 '22 21:12 horsto