-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Description
Is there an existing issue for this?
- I have searched the existing issues and checked the recent builds/commits
What would your feature do ?
When following the soft inpainting tutorial at stable diffusion art, the following error is thrown when doing the softinpainting:
TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn't support float64. Please use float32 instead.
The reason is due to the following lines that cast an mps tensor into a float 64:
stable-diffusion-webui/extensions-builtin/soft-inpainting/scripts/soft_inpainting.py
Line 82 in 1564ffa
current_magnitude = torch.norm(image_interp, p=2, dim=1, keepdim=True).to(torch.float64).add_(0.00001) stable-diffusion-webui/extensions-builtin/soft-inpainting/scripts/soft_inpainting.py
Line 85 in 1564ffa
a_magnitude = torch.norm(a, p=2, dim=1, keepdim=True).to(torch.float64).pow_( stable-diffusion-webui/extensions-builtin/soft-inpainting/scripts/soft_inpainting.py
Line 87 in 1564ffa
b_magnitude = torch.norm(b, p=2, dim=1, keepdim=True).to(torch.float64).pow_(
Changing to(torch.float64) to to(torch.float32) fixes the problem.
We should consider automating the casting to float64 or float32 depending on the users machine and warn user of the potential problems when casting can only be done to float32.
Proposed workflow
- User starts the web ui
- Web ui checks the architecture it is running on
- If it is an aarm64, warn user
- Any casting is done without user intervention behind the scenes