chenfei-wu / TaskMatrix

Other
34.51k stars 3.32k forks source link

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

Open Kingwolf123 opened 1 year ago

Kingwolf123 commented 1 year ago

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

thegenerativegeneration commented 1 year ago

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 commented 1 year ago

419