Iâm following along this notebook sd_dreambooth_inference created by HuggingFace.
I got an error âexpected scalar type Half but found Floatâ when trying to do inference
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
p = pipe(prompt, num_images_per_prompt=num_samples, num_inference_steps=50, guidance_scale=7.5)
I tried adding revision=âfp16â in the pipe declaration but that doesnât help either, seeing the same error
pipe = StableDiffusionPipeline.from_pretrained(model_id, revision="fp16", torch_dtype=torch.float16).to("cuda")
My initial guess was this has to do with the version of Pytorch. Because I can run this with no error on Google Colab, but face this error when running on Paperspace.
For reference, here are the specifications on each:
On Paperspace with diffusers 0.4.1 and pytorch versions:
torch==1.12.0+cu116
torchaudio==0.12.0+cu116
torchvision==0.13.0+cu116
Works fine on Google Colab using the same diffusers version and slightly more updated version torchvision
torch @ (link)/whl/cu113/torch-1.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
torchaudio @ (link)/whl/cu113/torchaudio-0.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
torchsummary==1.5.1
torchtext==0.13.1
torchvision @ https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp37-cp37m-linux_x86_64.whl
I have then tried to upgrade pytorch but that doesnât work (same error)
My current version of pytorch after upgrading:
torch==1.13.0
torchaudio==0.12.0+cu116
torchvision==0.14.0
What should I do now? Is this due to the specific GPU type used, or cuda some how? How do I fix this
Thanks in advance for any help and suggestion!