pyglide icon indicating copy to clipboard operation
pyglide copied to clipboard

AttributeError: 'SpacedDiffusion' object has no attribute 'plms_sample_loop'

Open illtellyoulater opened this issue 3 years ago • 3 comments

Windows 10, Python = 3.8 I tried with different version of torch (and cuda-toolkit) but I'm always getting the same error:

(pyglide) PS C:\Users\my-name\Downloads\pyglide> python .\tgd.py --prompt "point of no return" --sr
Using seed 0
Selected device: cuda:0.
Creating model and diffusion.
Done.
Loading GLIDE upsampling diffusion model.
Done.
Running base GLIDE text2im model.
Traceback (most recent call last):
  File ".\tgd.py", line 178, in <module>
    run()
  File ".\tgd.py", line 122, in run
    low_res_samples = util.run_glide_text2im(
  File "C:\Users\my-name\Downloads\pyglide\util.py", line 179, in run_glide_text2im
    looper = diffusion.plms_sample_loop
AttributeError: 'SpacedDiffusion' object has no attribute 'plms_sample_loop'

In this case the GPU was being used but I also tried with CPU mode and the same error shows up. Also, the same error was reported by @SomeOrdinaryDude at https://github.com/afiaka87/pyglide/issues/1#issuecomment-1073072852

illtellyoulater avatar Mar 29 '22 17:03 illtellyoulater

plms_sample_loop() doesn't exist and closest to that is p_sample_loop() which @afiaka87 already used at line 183. Maybe there was some misspelling with the names?

Anyway, the CLI doesn't take those methods in consideration yet so as a temporary fix I just replaced plms_sample_loop with p_sample_loop at line 179.

https://github.com/afiaka87/pyglide/blob/c95b7d3920a947f3597b28aae19e4b61f814fefa/util.py#L178-L185

illtellyoulater avatar Mar 29 '22 18:03 illtellyoulater

Thanks illtellyoulater, that totally worked! I'm struggling now to have it use my CUDA cores instead of my old cpu

Walking-Dust avatar May 09 '22 00:05 Walking-Dust

  • python tgd.py --prompt "the beach at sunset"
  • Using seed 0
  • Selected device: cpu.
  • Creating model and diffusion.
  • Done.
  • Loading GLIDE upsampling diffusion model.
  • Done.
  • Running base GLIDE text2im model.
  • Traceback (most recent call last):
  • File "tgd.py", line 178, in
  • run()
  • File "tgd.py", line 134, in run
  • cls_guidance_scale=style_guidance_scale
  • File "..pathtoproject..\pyglide\util.py", line 179, in run_glide_text2im
  • looper = diffusion.plms_sample_loop
  • AttributeError: 'SpacedDiffusion' object has no attribute 'plms_sample_loop'`

1 - runs on CPU for some reason: why? how to change to GPU? what's required? 2 - errors in the same file. I've tried to make the changes in different variants as illtellyoulater suggested, but no luck of getting any further.

(help?)

Pirog17000 avatar Jun 06 '22 20:06 Pirog17000