ComfyUI  >  Nodes  >  ComfyUI-DareMerge >  Model Merger (MBW/DARE)

ComfyUI Node: Model Merger (MBW/DARE)

Class Name

DM_DareModelMergerMBW

Category
DareMerge/unet
Author
54rt1n (Account age: 4079 days)
Extension
ComfyUI-DareMerge
Latest Updated
7/9/2024
Github Stars
0.1K

How to Install ComfyUI-DareMerge

Install this extension via the ComfyUI Manager by searching for  ComfyUI-DareMerge
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-DareMerge in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Model Merger (MBW/DARE) Description

Merge models with weighted consensus for AI art blending, using MBW gradient for control over ratios and sparsity.

Model Merger (MBW/DARE):

The DM_DareModelMergerMBW node is designed to merge two models using a sophisticated method that leverages the weighted consensus of their parameters and sparsity. This node is particularly useful for AI artists who want to blend different models to create unique outputs. By utilizing the MBW (Model Blending Weight) gradient, this node ensures that the merging process is both efficient and effective, allowing for fine-tuned control over the blending ratios and sparsity levels. The primary goal of this node is to provide a seamless and intuitive way to combine models, enhancing the creative possibilities for AI-generated art.

Model Merger (MBW/DARE) Input Parameters:

model_a

This parameter represents the base model to be merged. It is a ModelPatcher instance that serves as the foundation for the merging process. The quality and characteristics of this model will significantly influence the final merged output.

model_b

This parameter is the model that will be merged into the base model (model_a). It is also a ModelPatcher instance. The unique features and attributes of this model will be blended with those of model_a to create a new, combined model.

method

This parameter specifies the method to use for merging the models. The available options are "lerp" (linear interpolation), "slerp" (spherical linear interpolation), and "gradient". Each method offers a different approach to blending the models, affecting the smoothness and characteristics of the final output. The default value is "lerp".

seed

This parameter sets the random seed for the merge process. By specifying a seed, you can ensure that the merging process is reproducible, leading to consistent results across different runs. The default value is None.

clear_cache

This boolean parameter determines whether to clear the CUDA cache after each chunk of the merging process. Clearing the cache can help manage memory usage, especially when working with large models. The default value is False.

iterations

This parameter defines the number of iterations to perform during the merge. More iterations can lead to a more refined and blended model, but will also increase the processing time. The default value is 1.

model_mask

This optional parameter allows you to specify a model mask to protect certain layers of model_a during the merge. By using a mask, you can ensure that specific parts of the base model remain unchanged. The default value is None.

drop_rate

This parameter sets the drop rate for the stochastic mask used in the DARE-TIES sparsification process. It controls the proportion of deltas to be applied during the merge. The default value is 0.1.

ties

This parameter specifies whether to use the TIES-merging method. The available options are "on" and "off". When enabled, it applies additional constraints to the merging process, potentially leading to more coherent results. The default value is "off".

rescale

This parameter determines whether to rescale the remaining deltas during the DARE-TIES sparsification process. The available options are "on" and "off". Rescaling can affect the magnitude of the changes applied during the merge. The default value is "off".

Model Merger (MBW/DARE) Output Parameters:

merged_model

This output parameter is the resulting ModelPatcher instance after the merge process. It represents the new, combined model that incorporates features from both model_a and model_b. The quality and characteristics of this model will reflect the blending ratios and sparsity levels specified during the merge.

Model Merger (MBW/DARE) Usage Tips:

  • Experiment with different merging methods ("lerp", "slerp", "gradient") to see which one produces the best results for your specific models.
  • Use the seed parameter to ensure reproducibility of your merges, especially when you find a combination that works well.
  • Adjust the iterations parameter to refine the blending process. More iterations can lead to a smoother and more integrated model.
  • Utilize the model_mask parameter to protect specific layers of your base model, ensuring that critical features remain unchanged.
  • Manage memory usage by setting clear_cache to True if you encounter memory issues during the merge process.

Model Merger (MBW/DARE) Common Errors and Solutions:

"could not patch. key doesn't exist in model: <key>"

  • Explanation: This error occurs when the specified key is not found in the model being merged.
  • Solution: Ensure that both models (model_a and model_b) have compatible structures and that the keys match.

"CUDA out of memory"

  • Explanation: This error indicates that the GPU memory is insufficient to complete the merge process.
  • Solution: Try reducing the model size, lowering the iterations parameter, or setting clear_cache to True to manage memory usage.

"Invalid merge method: <method>"

  • Explanation: This error occurs when an unsupported merge method is specified.
  • Solution: Ensure that the method parameter is set to one of the supported options: "lerp", "slerp", or "gradient".

"Model mask not found"

  • Explanation: This error indicates that the specified model mask is not available.
  • Solution: Verify that the model_mask parameter is correctly specified and that the mask exists.

"Invalid drop rate: <drop_rate>"

  • Explanation: This error occurs when the drop_rate parameter is set to an invalid value.
  • Solution: Ensure that the drop_rate parameter is within the valid range (0.0 to 1.0).

Model Merger (MBW/DARE) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-DareMerge
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.