diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

Add support for converting inpainting,instruct-pix2pix,etc models

Open reimager opened this issue 3 years ago • 0 comments

The conversion scripts can convert ckpt and safetensors models to diffusers format, but it does not work for inpainting or instruct-pix2pix models:

Example: Using this safetensors file: https://huggingface.co/stabilityai/stable-diffusion-2-inpainting/blob/main/512-inpainting-ema.safetensors

python3 convert_original_stable_diffusion_to_diffusers.py --checkpoint_path ~/512-inpainting-ema.safetensors --from_safetensors --dump_path ~/512-inpainting-ema

Results in an error:

RuntimeError: Error(s) in loading state_dict for UNet2DConditionModel: size mismatch for conv_in.weight: copying a param with shape torch.Size([320, 9, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

Similar for instruct-pix2pix (except different size obv)

RuntimeError: Error(s) in loading state_dict for UNet2DConditionModel: size mismatch for conv_in.weight: copying a param with shape torch.Size([320, 8, 3, 3]) from checkpoint, the shape in current model is torch.Size([320, 4, 3, 3]).

If I'm missing something obvious, my apologies.

reimager avatar Feb 16 '23 18:02 reimager