How can I use the Inpaint model with diffusers?

#28
by 34ronker - opened

Can this model be used in Inpainting like this?

model_id = "Lykon/DreamShaper"
model = StableDiffusionInpaintPipeline.from_pretrained(model_id, safety_checker=None, torch_dtype=torch.float16).to("cuda")

Doing the above I get the following error:

ValueError: Incorrect configuration settings! The config of `pipeline.unet`: FrozenDict([('sample_size', 64), 
('in_channels', 4), ('out_channels', 4), ('center_input_sample', False), ('flip_sin_to_cos', True), ('freq_shift', 
0), ('down_block_types', ['CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'CrossAttnDownBlock2D', 'DownBlock2D']), 
('mid_block_type', 'UNetMidBlock2DCrossAttn'), ('up_block_types', ['UpBlock2D', 'CrossAttnUpBlock2D', 
'CrossAttnUpBlock2D', 'CrossAttnUpBlock2D']), ('only_cross_attention', False), ('block_out_channels', [320, 640, 
1280, 1280]), ('layers_per_block', 2), ('downsample_padding', 1), ('mid_block_scale_factor', 1), ('act_fn', 
'silu'), ('norm_num_groups', 32), ('norm_eps', 1e-05), ('cross_attention_dim', 768), ('attention_head_dim', 8), 
('dual_cross_attention', False), ('use_linear_projection', False), ('class_embed_type', None), ('num_class_embeds',
None), ('upcast_attention', None), ('resnet_time_scale_shift', 'default'), ('time_embedding_type', 'positional'), 
('timestep_post_act', None), ('time_cond_proj_dim', None), ('conv_in_kernel', 3), ('conv_out_kernel', 3), 
('projection_class_embeddings_input_dim', None), ('_class_name', 'UNet2DConditionModel'), ('_diffusers_version', 
'0.14.0'), ('_name_or_path', 
'/root/.cache/huggingface/hub/models--Lykon--DreamShaper/snapshots/6a1a38f04a235d0ed2acbb083c2a780fc92c16eb/unet')]
) expects 4 but received `num_channels_latents`: 4 + `num_channels_mask`: 1 + `num_channels_masked_image`: 4 = 9. 
Please verify the config of `pipeline.unet` or your `mask_image` or `image` input.

you should probably convert this file https://huggingface.co/Lykon/DreamShaper/blob/main/DreamShaper_3.31_baked_vae-inpainting.inpainting.safetensors
Anyway I also noticed I forgot to upload the inpainting v4 model.

Doing it right now.

Lykon changed discussion status to closed

Sign up or log in to comment