stable-diffusion
stable-diffusion copied to clipboard
Stable diffusion with half precision
In img2img, if I change the image to float 16 using sd-v1-4.ckpt:
image = np.array(image).astype(np.float16)
I get this error:
--> init_latent = model.get_first_stage_encoding(model.encode_first_stage(init_image)
...
449 if self.padding_mode != 'zeros':
450 return F.conv2d(F.pad(input, self._reversed_padding_repeated_twice, mode=self.padding_mode),
451 weight, bias, self.stride,
452 _pair(0), self.dilation, self.groups)
--> 453 return F.conv2d(input, weight, bias, self.stride,
454 self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same
Does the current model support fp16 images? If yes, how can I change the weight type to be HalfTensor?
You can change the model to fp16 before inference.