Stability-AI / stablediffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
39.19k stars 5.05k forks source link

.half call to fix? #46

Open KyonP opened 1 year ago

KyonP commented 1 year ago

I am sorry that I cannot provide my python Traceback log (already reverted my code, sadly).

I was trying to update my previous code based on SD v1, I faced the error message : Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same conv2d

Since I haven't modified the core part of the model, I thought this error came from the compatibility issue between my custom-made code.

However, I couldn't find where HalfTensor came from. And I found this line from SD v2 code a while after reverting my code : return checkpoint(self._forward, (x,), self.parameters(), True) # TODO: check checkpoint usage, is True # TODO: fix the .half call!!!

I am wondering where is the ".half call" to fix; it might solve my 2nd attempt for the patch. 👍

richservo commented 1 year ago

the tensor needs to be .half(). So wherever it's being decoded just add .half() to the end of the final tensor

nguyenmeteorops commented 1 year ago

Last time I got this issue, I fixed by upgrading transformers' lib

pip install --upgrade git+https://github.com/huggingface/diffusers.git transformers accelerate scipy