diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-10 11:08:29 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-10 11:08:29 +0000 |
commit | 0c3feb202c5714abd50d879c1db2cd9a71ce93e3 (patch) | |
tree | 02dc6ac945bde441302f1be5e6878c8394566b23 /modules/sd_models.py | |
parent | ef75c980536471c0729a2319440e3083cd57a4f0 (diff) | |
download | stable-diffusion-webui-gfx803-0c3feb202c5714abd50d879c1db2cd9a71ce93e3.tar.gz stable-diffusion-webui-gfx803-0c3feb202c5714abd50d879c1db2cd9a71ce93e3.tar.bz2 stable-diffusion-webui-gfx803-0c3feb202c5714abd50d879c1db2cd9a71ce93e3.zip |
disable torch weight initialization and CLIP downloading/reading checkpoint to speedup creating sd model from config
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r-- | modules/sd_models.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index 0a6d55ca..ee241032 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -13,7 +13,7 @@ import ldm.modules.midas as midas from ldm.util import instantiate_from_config
-from modules import shared, modelloader, devices, script_callbacks, sd_vae
+from modules import shared, modelloader, devices, script_callbacks, sd_vae, sd_disable_initialization
from modules.paths import models_path
from modules.sd_hijack_inpainting import do_inpainting_hijack, should_hijack_inpainting
@@ -319,7 +319,8 @@ def load_model(checkpoint_info=None): if shared.cmd_opts.no_half:
sd_config.model.params.unet_config.params.use_fp16 = False
- sd_model = instantiate_from_config(sd_config.model)
+ with sd_disable_initialization.DisableInitialization():
+ sd_model = instantiate_from_config(sd_config.model)
load_model_weights(sd_model, checkpoint_info)
|