diff --git a/tests/test_model_probe.py b/tests/test_model_probe.py index 8be7089cf5..95929e3aa3 100644 --- a/tests/test_model_probe.py +++ b/tests/test_model_probe.py @@ -4,7 +4,7 @@ import pytest from torch import tensor from invokeai.backend.model_manager import BaseModelType, ModelRepoVariant -from invokeai.backend.model_manager.config import InvalidModelConfigException +from invokeai.backend.model_manager.config import InvalidModelConfigException, MainDiffusersConfig, ModelVariantType from invokeai.backend.model_manager.probe import ( CkptType, ModelProbe, @@ -78,3 +78,11 @@ def test_probe_handles_state_dict_with_integer_keys(): } with pytest.raises(InvalidModelConfigException): ModelProbe.get_model_type_from_checkpoint(Path("embedding.pt"), state_dict_with_integer_keys) + + +def test_probe_sd1_diffusers_inpainting(datadir: Path): + config = ModelProbe.probe(datadir / "sd-1/main/dreamshaper-8-inpainting") + assert isinstance(config, MainDiffusersConfig) + assert config.base is BaseModelType.StableDiffusion1 + assert config.variant is ModelVariantType.Inpaint + assert config.repo_variant is ModelRepoVariant.FP16 diff --git a/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/README b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/README new file mode 100644 index 0000000000..15349b5f0a --- /dev/null +++ b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/README @@ -0,0 +1 @@ +This folder contains config files copied from [Lykon/dreamshaper-8-inpainting](https://huggingface.co/Lykon/dreamshaper-8-inpainting). diff --git a/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/model_index.json b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/model_index.json new file mode 100644 index 0000000000..e4e983f7ba --- /dev/null +++ b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/model_index.json @@ -0,0 +1,34 @@ +{ + "_class_name": "StableDiffusionInpaintPipeline", + "_diffusers_version": "0.21.0.dev0", + "_name_or_path": "lykon-models/dreamshaper-8-inpainting", + "feature_extractor": [ + "transformers", + "CLIPFeatureExtractor" + ], + "requires_safety_checker": true, + "safety_checker": [ + "stable_diffusion", + "StableDiffusionSafetyChecker" + ], + "scheduler": [ + "diffusers", + "DEISMultistepScheduler" + ], + "text_encoder": [ + "transformers", + "CLIPTextModel" + ], + "tokenizer": [ + "transformers", + "CLIPTokenizer" + ], + "unet": [ + "diffusers", + "UNet2DConditionModel" + ], + "vae": [ + "diffusers", + "AutoencoderKL" + ] +} diff --git a/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/scheduler/scheduler_config.json b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/scheduler/scheduler_config.json new file mode 100644 index 0000000000..a63f334bd6 --- /dev/null +++ b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/scheduler/scheduler_config.json @@ -0,0 +1,23 @@ +{ + "_class_name": "DEISMultistepScheduler", + "_diffusers_version": "0.21.0.dev0", + "algorithm_type": "deis", + "beta_end": 0.012, + "beta_schedule": "scaled_linear", + "beta_start": 0.00085, + "clip_sample": false, + "dynamic_thresholding_ratio": 0.995, + "lower_order_final": true, + "num_train_timesteps": 1000, + "prediction_type": "epsilon", + "sample_max_value": 1.0, + "set_alpha_to_one": false, + "skip_prk_steps": true, + "solver_order": 2, + "solver_type": "logrho", + "steps_offset": 1, + "thresholding": false, + "timestep_spacing": "leading", + "trained_betas": null, + "use_karras_sigmas": false +} diff --git a/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/unet/config.json b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/unet/config.json new file mode 100644 index 0000000000..d9f3b21d92 --- /dev/null +++ b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/unet/config.json @@ -0,0 +1,66 @@ +{ + "_class_name": "UNet2DConditionModel", + "_diffusers_version": "0.21.0.dev0", + "_name_or_path": "/home/patrick/.cache/huggingface/hub/models--lykon-models--dreamshaper-8-inpainting/snapshots/15dcb9dec91a39ee498e3917c9ef6174b103862d/unet", + "act_fn": "silu", + "addition_embed_type": null, + "addition_embed_type_num_heads": 64, + "addition_time_embed_dim": null, + "attention_head_dim": 8, + "attention_type": "default", + "block_out_channels": [ + 320, + 640, + 1280, + 1280 + ], + "center_input_sample": false, + "class_embed_type": null, + "class_embeddings_concat": false, + "conv_in_kernel": 3, + "conv_out_kernel": 3, + "cross_attention_dim": 768, + "cross_attention_norm": null, + "down_block_types": [ + "CrossAttnDownBlock2D", + "CrossAttnDownBlock2D", + "CrossAttnDownBlock2D", + "DownBlock2D" + ], + "downsample_padding": 1, + "dual_cross_attention": false, + "encoder_hid_dim": null, + "encoder_hid_dim_type": null, + "flip_sin_to_cos": true, + "freq_shift": 0, + "in_channels": 9, + "layers_per_block": 2, + "mid_block_only_cross_attention": null, + "mid_block_scale_factor": 1, + "mid_block_type": "UNetMidBlock2DCrossAttn", + "norm_eps": 1e-05, + "norm_num_groups": 32, + "num_attention_heads": null, + "num_class_embeds": null, + "only_cross_attention": false, + "out_channels": 4, + "projection_class_embeddings_input_dim": null, + "resnet_out_scale_factor": 1.0, + "resnet_skip_time_act": false, + "resnet_time_scale_shift": "default", + "sample_size": 64, + "time_cond_proj_dim": null, + "time_embedding_act_fn": null, + "time_embedding_dim": null, + "time_embedding_type": "positional", + "timestep_post_act": null, + "transformer_layers_per_block": 1, + "up_block_types": [ + "UpBlock2D", + "CrossAttnUpBlock2D", + "CrossAttnUpBlock2D", + "CrossAttnUpBlock2D" + ], + "upcast_attention": null, + "use_linear_projection": false +} diff --git a/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/unet/diffusion_pytorch_model.fp16.safetensors b/tests/test_model_probe/sd-1/main/dreamshaper-8-inpainting/unet/diffusion_pytorch_model.fp16.safetensors new file mode 100644 index 0000000000..e69de29bb2