Error 'expected scalar type Half but found Float'
I’m following along this notebooksd_dreambooth_inferencecreated by HuggingFace.I got an error  ‘expected scalar type Half but found Float’  when trying to do inferencepipe = 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 errorpipe = 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+cu116torchaudio==0.12.0+cu116torchvision==0.13.0+cu116Works fine on Google Colab using the same diffusers version and slightly more updated version torchvisiontorch @ (link)/whl/cu113/torch-1.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whltorchaudio @ (link)/whl/cu113/torchaudio-0.12.1%2Bcu113-cp37-cp37m-linux_x86_64.whltorchsummary==1.5.1torchtext==0.13.1torchvision @https://download.pytorch.org/whl/cu113/torchvision-0.13.1%2Bcu113-cp37-cp37m-linux_x86_64.whlI have then tried to upgrade pytorch but that doesn’t work (same error)My current version of pytorch after upgrading:torch==1.13.0torchaudio==0.12.0+cu116torchvision==0.14.0What should I do now? Is this due to the specific GPU type used, or cuda some how? How do I fix thisThanks in advance for any help and suggestion!
2022-11-07T16:27:07Z
Perhaps you need to upgrade thetransformersversion in Paperspace?
2022-11-08T00:04:10Z
Thank you so much, that works!!It didn’t occur to me that the pipeline called transformersFor reference , the version of transformers was 4.20.1 before, and is 4.24.0 after upgrading, works now with the new transformers package version