aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_models.py
diff options
context:
space:
mode:
authorw-e-w <40751091+w-e-w@users.noreply.github.com>2023-02-05 14:02:30 +0000
committerGitHub <noreply@github.com>2023-02-05 14:02:30 +0000
commit47b298d58af290c5c6be6d0716e0216d6e4649d1 (patch)
treec7d059a650ea1d424d0224eac089e1396bdb7b50 /modules/sd_models.py
parentdd20fc0fda5ac7cbb93af0b93222ee5a17f7705e (diff)
parentea9bd9fc7409109adcd61b897abc2c8881161256 (diff)
downloadstable-diffusion-webui-gfx803-47b298d58af290c5c6be6d0716e0216d6e4649d1.tar.gz
stable-diffusion-webui-gfx803-47b298d58af290c5c6be6d0716e0216d6e4649d1.tar.bz2
stable-diffusion-webui-gfx803-47b298d58af290c5c6be6d0716e0216d6e4649d1.zip
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r--modules/sd_models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index af1731e5..d847d358 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -354,6 +354,9 @@ def repair_config(sd_config):
sd_config.model.params.unet_config.params.use_fp16 = True
+sd1_clip_weight = 'cond_stage_model.transformer.text_model.embeddings.token_embedding.weight'
+sd2_clip_weight = 'cond_stage_model.model.transformer.resblocks.0.attn.in_proj_weight'
+
def load_model(checkpoint_info=None, already_loaded_state_dict=None, time_taken_to_load_state_dict=None):
from modules import lowvram, sd_hijack
checkpoint_info = checkpoint_info or select_checkpoint()
@@ -374,6 +377,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, time_taken_
state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
checkpoint_config = sd_models_config.find_checkpoint_config(state_dict, checkpoint_info)
+ clip_is_included_into_sd = sd1_clip_weight in state_dict or sd2_clip_weight in state_dict
timer.record("find config")
@@ -386,7 +390,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, time_taken_
sd_model = None
try:
- with sd_disable_initialization.DisableInitialization():
+ with sd_disable_initialization.DisableInitialization(disable_clip=clip_is_included_into_sd):
sd_model = instantiate_from_config(sd_config.model)
except Exception as e:
pass