diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-10-18 12:33:24 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-10-18 12:33:32 +0000 |
commit | e20b7e30fe17744acb74ad33c87c0963525ea921 (patch) | |
tree | a552272b2d28f11b18af9a74024e036aa95f214a | |
parent | 2f448d97a9427f9a7bad19cf608561b2878ab2da (diff) | |
download | stable-diffusion-webui-gfx803-e20b7e30fe17744acb74ad33c87c0963525ea921.tar.gz stable-diffusion-webui-gfx803-e20b7e30fe17744acb74ad33c87c0963525ea921.tar.bz2 stable-diffusion-webui-gfx803-e20b7e30fe17744acb74ad33c87c0963525ea921.zip |
fix for add difference model merging
-rw-r--r-- | modules/extras.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/extras.py b/modules/extras.py index c908b43e..03f6085e 100644 --- a/modules/extras.py +++ b/modules/extras.py @@ -216,8 +216,11 @@ def run_modelmerger(primary_model_name, secondary_model_name, teritary_model_nam if theta_func1:
for key in tqdm.tqdm(theta_1.keys()):
if 'model' in key:
- t2 = theta_2.get(key, torch.zeros_like(theta_1[key]))
- theta_1[key] = theta_func1(theta_1[key], t2)
+ if key in theta_2:
+ t2 = theta_2.get(key, torch.zeros_like(theta_1[key]))
+ theta_1[key] = theta_func1(theta_1[key], t2)
+ else:
+ theta_1[key] = 0
del theta_2, teritary_model
for key in tqdm.tqdm(theta_0.keys()):
|