aboutsummaryrefslogtreecommitdiffstats
path: root/modules/extras.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-14 18:20:28 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-14 18:20:28 +0000
commit2f0e089c7c8e1ad7d2ad658971c6fdec9622e3ab (patch)
treec0204ebdbaf7676c1b1ea97882ee780c763a33fe /modules/extras.py
parent6cdf55627cb4eb156fb7d8c010d396f93011c04e (diff)
downloadstable-diffusion-webui-gfx803-2f0e089c7c8e1ad7d2ad658971c6fdec9622e3ab.tar.gz
stable-diffusion-webui-gfx803-2f0e089c7c8e1ad7d2ad658971c6fdec9622e3ab.tar.bz2
stable-diffusion-webui-gfx803-2f0e089c7c8e1ad7d2ad658971c6fdec9622e3ab.zip
should fix the issue with missing layers in chechpoint merger
Diffstat (limited to 'modules/extras.py')
-rw-r--r--modules/extras.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/extras.py b/modules/extras.py
index 532d869f..2e7b3751 100644
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -209,7 +209,12 @@ def run_modelmerger(primary_model_name, secondary_model_name, teritary_model_nam
for key in tqdm.tqdm(theta_0.keys()):
if 'model' in key and key in theta_1:
- theta_0[key] = theta_func(theta_0[key], theta_1[key], theta_2[key] if theta_2 else None, (float(1.0) - interp_amount)) # Need to reverse the interp_amount to match the desired mix ration in the merged checkpoint
+ t2 = (theta_2 or {}).get(key)
+ if t2 is None:
+ t2 = torch.zeros_like(theta_0[key])
+
+ theta_0[key] = theta_func(theta_0[key], theta_1[key], t2, (float(1.0) - interp_amount)) # Need to reverse the interp_amount to match the desired mix ration in the merged checkpoint
+
if save_as_half:
theta_0[key] = theta_0[key].half()