Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Kingwolf123 opened this issue Jun 1, 2023 · 2 comments

Comments

@Kingwolf123
Copy link

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

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

#419

vsching added a commit to vsching/TaskMatrix that referenced this issue Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants