mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tests: add test for probing diffusers model variant type
This commit is contained in:
parent
bbf919a933
commit
2537d260e3
@ -4,7 +4,7 @@ import pytest
|
|||||||
from torch import tensor
|
from torch import tensor
|
||||||
|
|
||||||
from invokeai.backend.model_manager import BaseModelType, ModelRepoVariant
|
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 (
|
from invokeai.backend.model_manager.probe import (
|
||||||
CkptType,
|
CkptType,
|
||||||
ModelProbe,
|
ModelProbe,
|
||||||
@ -78,3 +78,11 @@ def test_probe_handles_state_dict_with_integer_keys():
|
|||||||
}
|
}
|
||||||
with pytest.raises(InvalidModelConfigException):
|
with pytest.raises(InvalidModelConfigException):
|
||||||
ModelProbe.get_model_type_from_checkpoint(Path("embedding.pt"), state_dict_with_integer_keys)
|
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
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
This folder contains config files copied from [Lykon/dreamshaper-8-inpainting](https://huggingface.co/Lykon/dreamshaper-8-inpainting).
|
@ -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"
|
||||||
|
]
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user