visual-chatgpt icon indicating copy to clipboard operation
visual-chatgpt copied to clipboard

Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same

Open Kingwolf123 opened this issue 2 years ago • 2 comments

Any type of image uploading to a free google colab and then executing it produces this error. Apparently the code is trying to execute the model on a cpu when it needs a gpu. This could mean some missing code? Everything else on my end is default, all i have done is hosted a colab notebook and asked it to remove an object from a photo that i have uploaded

Thank

Kingwolf123 avatar Jun 01 '23 03:06 Kingwolf123

No, the model is not executed on CPU, but one tensor is half-precision (cuda.HalfTensor) and the other full (cuda.FloatTensor).

The problem seems to be that the safety checker uses the wrong tensor format for its weights.

You can fix that by replacing ´StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker')´

by

´StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker', torch_dtype=self.torch_dtype)´ in visual_chatgpt.py.

thegenerativegeneration avatar Jun 12 '23 11:06 thegenerativegeneration

#419

thegenerativegeneration avatar Jun 12 '23 11:06 thegenerativegeneration