HPeace
Results
2
comments of
HPeace
解决了,谢谢! > 解决了, 是 权重类型不匹配导致, from safetensors.torch import load_model,load_file unet = UNet2DConditionModel.from_pretrained( os.path.join(self.checkpoint_dir, "runwayml_stable-diffusion-v1-5"), subfolder="unet", revision=None, torch_dtype=weight_dtype, local_files_only=local_files_only, ) 加载的时候权重类型是torch.float16,但是PowerPaint_Brushnet/diffusion_pytorch_model.safetensors 原始类型是torch.float32(有一个key对应的是torch.float16),load_model()函数会检查模型与权重对应的值类型是否一样,导致加载错误。 以下代码可以正常加载(原理是内部执行自动类型转换加载) brushnet_weights_path = os.path.join( checkpoint_dir, "PowerPaint_Brushnet/diffusion_pytorch_model.safetensors", ) weights =...