Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
[Bug]:   Error merging checkpoints: unhashable type: 'list'  
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

AS of today, receiving the following error trying to merge checkpoints.
Error merging checkpoints: unhashable type: 'list'

### Steps to reproduce the problem

1. Go to Checkpoint merger
2. Select 2 models to merge
3. Set weights
4. click Merge


### What should have happened?

New merged CPKT file should have been created.

### Commit where the problem happens

Commit hash: 6faae2323963f9b0e0086a85b9d0472a24fbaa73

### What platforms do you use to access UI ?

Windows

### What browsers do you use to access the UI ?

Brave

### Command Line Arguments

_No response_

### Additional information, context and logs

_No response_


Discussion:
I'm getting the same issue.
Same issue here!
I have the same issue. Thanks. 

Error loading/saving model file:
Traceback (most recent call last):
  File "C:\A1111\stable-diffusion-webui\modules\ui.py", line 1713, in modelmerger
    results = modules.extras.run_modelmerger(*args)
  File "C:\A1111\stable-diffusion-webui\modules\extras.py", line 292, in run_modelmerger
    tertiary_model_info = sd_models.checkpoints_list.get(tertiary_model_name, None)
TypeError: unhashable type: 'list'

Just tried and it's not working right now; it was working last time I booted it up 10 hours ago,
git reset --hard dac59b9

this worked for me, just reverting changes, make sure not to git pull tho!
ill check for commits that fix this
seems to be an issue where the checkpoint merger is demanding a third model even for Weighted sum.
Same issue🙈
I got this issue as well, seems the Tertiary drop down menu needs to have a model selected in order to merge 2 models. If the Tertiary menu is left blank it throws this error.
> I got this issue as well, seems the Tertiary drop down menu needs to have a model selected in order to merge 2 models. If the Tertiary menu is left blank it throws this error.

Can confirm.  Once I put an arbitrary model value into the Tertiary field the merge worked as expected.
Can also confirm it's an issue with the merger expecting a third model in the C slot even for weighted sum, setting one makes it work as usual, C model is ignored for weighted sum.

Resolving patch:
diff --git a/modules/extras.py b/modules/extras.py
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -287,10 +287,19 @@ def get_difference(theta1, theta2):
     def add_difference(theta0, theta1_2_diff, alpha):
         return theta0 + (alpha * theta1_2_diff)
 
+    if not primary_model_name:
+        shared.state.textinfo = "Failed: Merging requires a primary model."
+        shared.state.end()
+        return ["Failed: Merging requires a primary model."] + [gr.Dropdown.update(choices=sd_models.checkpoint_tiles()) for _ in range(4)]
+
     primary_model_info = sd_models.checkpoints_list[primary_model_name]
+
+    if not secondary_model_name:
+        shared.state.textinfo = "Failed: Merging requires a secondary model."
+        shared.state.end()
+        return ["Failed: Merging requires a secondary model."] + [gr.Dropdown.update(choices=sd_models.checkpoint_tiles()) for _ in range(4)]
+    
     secondary_model_info = sd_models.checkpoints_list[secondary_model_name]
-    tertiary_model_info = sd_models.checkpoints_list.get(tertiary_model_name, None)
-    result_is_inpainting_model = False
 
     theta_funcs = {
         "Weighted sum": (None, weighted_sum),
@@ -298,10 +307,14 @@ def add_difference(theta0, theta1_2_diff, alpha):
     }
     theta_func1, theta_func2 = theta_funcs[interp_method]
 
-    if theta_func1 and not tertiary_model_info:
+    if theta_func1 and not tertiary_model_name:
         shared.state.textinfo = "Failed: Interpolation method requires a tertiary model."
         shared.state.end()
-        return ["Failed: Interpolation method requires a tertiary model."] + [gr.Dropdown.update(choices=sd_models.checkpoint_tiles()) for _ in range(4)]
+        return [f"Failed: Interpolation method ({interp_method}) requires a tertiary model."] + [gr.Dropdown.update(choices=sd_models.checkpoint_tiles()) for _ in range(4)]
+    
+    tertiary_model_info = sd_models.checkpoints_list[tertiary_model_name] if theta_func1 else None
+
+    result_is_inpainting_model = False
 
     shared.state.textinfo = f"Loading {secondary_model_info.filename}..."
     print(f"Loading {secondary_model_info.filename}...")


Test patch: