bbc-mc / sdweb-merge-board

Multi-step automation merge tool. Extension/Script for Stable Diffusion UI by AUTOMATIC1111 https://github.com/AUTOMATIC1111/stable-diffusion-webui
73 stars 12 forks source link

Fix for recent A1111 updates (May 2023) #18

Closed dwraco closed 1 year ago

dwraco commented 1 year ago

The addition of the option to save metadata in model merges is what broke merge board.

I have a hackish fix. Hopefully someone with more skill can implement a checkbox in the merge board UI to make it legit.

Add "save_metadata = True" in the run_merge function within merge board's recipe.py file and add save_metadata to the very end of the first extras.run_modelmerger() call. I found that setting the value to True was necessary to avoid issues when saving the model to .safetensors. If you only want to use .ckpt, you can set safe_metadata to False.

Here's my implementation. Starts at line 114 in recipe.py:

 try:
      discard_weights = ""
      save_metadata = True
      bake_in_vae = "None"
      # backward compatibility for change of run_model_merger
      # 2023/01/22
      # https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/112416d04171e4bee673f0adc9bd3aeba87ec71a
      # def run_modelmerger(id_task, primary_model_name, secondary_model_name, tertiary_model_name, interp_method, multiplier, save_as_half, custom_name, checkpoint_format, config_source, bake_in_vae, discard_weights):
      results = extras.run_modelmerger(id_task, self.A, self.B, self.C, self.S, self.M, self.F, self.O, self.CF, config_source, bake_in_vae, discard_weights, save_metadata)
bbc-mc commented 1 year ago

Thank you for report.

Check new commit and checkbox for 'save metadata'

dwraco commented 1 year ago

Works great now. Thanks for the quick update, @bbc-mc!