IF icon indicating copy to clipboard operation
IF copied to clipboard

Tensor error for basic example usage

Open abasu0713 opened this issue 2 years ago • 3 comments

Can't seem to run the basic example usage from here. Throws the following error:

`

AttributeError Traceback (most recent call last) in <cell line: 40>() 38 39 # stage 3 ---> 40 image = stage_3(prompt=prompt, image=image, generator=generator, noise_level=100).images 41 pt_to_pil(image)[0].save("./if_stage_III.png")

4 frames /usr/local/lib/python3.10/dist-packages/diffusers/utils/pil_utils.py in numpy_to_pil(images) 41 if images.ndim == 3: 42 images = images[None, ...] ---> 43 images = (images * 255).numpy().round().astype("uint8") 44 if images.shape[-1] == 1: 45 # special case for grayscale (single channel) images

AttributeError: 'Tensor' object has no attribute 'astype'

abasu0713 avatar Aug 23 '23 03:08 abasu0713

I'm getting the same error. I have diffusers v0.20.2.

adavies25 avatar Sep 01 '23 16:09 adavies25

I avoided the error by rolling back diffusers library with "pip install diffusers==0.16" however, the final output image was not what the prompt stated. This colab page does work however here

adavies25 avatar Sep 01 '23 17:09 adavies25

Thank you @adavies25. I got it working too! The stage 3 is where the upscaler is being used.. And that was where it was failing. I was able to use it simply with my own diffuser. And building the diffuser library from source. But this bug should remain Open since the documentation is wrong.. It doesn't mention anything about using an old diffuser version. Just my opinion

abasu0713 avatar Sep 01 '23 20:09 abasu0713