ComfyUI  >  Nodes  >  ComfyUI >  PatchModelAddDownscale (Kohya Deep Shrink)

ComfyUI Node: PatchModelAddDownscale (Kohya Deep Shrink)

Class Name

PatchModelAddDownscale

Category
_for_testing
Author
ComfyAnonymous (Account age: 598 days)
Extension
ComfyUI
Latest Updated
8/12/2024
Github Stars
45.9K

How to Install ComfyUI

Install this extension via the ComfyUI Manager by searching for  ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI 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

PatchModelAddDownscale (Kohya Deep Shrink) Description

Modify model with downscaling and upscaling operations on specific blocks for AI artists to control resolution and optimize performance.

PatchModelAddDownscale (Kohya Deep Shrink):

The PatchModelAddDownscale node, also known as "PatchModelAddDownscale (Kohya Deep Shrink)," is designed to modify a model by applying downscaling and subsequent upscaling operations to specific blocks within the model. This node is particularly useful for AI artists who want to manipulate the resolution of intermediate features within a model, allowing for more control over the model's behavior and potentially improving performance or visual quality. By specifying parameters such as the block number, downscale factor, and the range of operation, you can fine-tune how and when the downscaling occurs. This node provides a flexible way to experiment with different downscaling and upscaling methods, making it a valuable tool for optimizing models for various tasks.

PatchModelAddDownscale (Kohya Deep Shrink) Input Parameters:

model

This parameter represents the model to which the downscaling and upscaling patches will be applied. It is a required input and should be a valid model object that you wish to modify.

block_number

This integer parameter specifies the block number within the model where the downscaling operation will be applied. The default value is 3, with a minimum of 1 and a maximum of 32. Adjusting this parameter allows you to target specific layers of the model for downscaling.

downscale_factor

This float parameter determines the factor by which the selected block will be downscaled. The default value is 2.0, with a minimum of 0.1 and a maximum of 9.0. A higher downscale factor will reduce the resolution more significantly.

start_percent

This float parameter defines the starting point of the downscaling operation as a percentage of the model's processing. The default value is 0.0, with a range from 0.0 to 1.0. This allows you to control when the downscaling begins during the model's execution.

end_percent

This float parameter sets the ending point of the downscaling operation as a percentage of the model's processing. The default value is 0.35, with a range from 0.0 to 1.0. This parameter helps you define the duration of the downscaling effect.

downscale_after_skip

This boolean parameter indicates whether the downscaling should occur after a skip connection within the model. The default value is True. Setting this parameter helps you control the exact point of downscaling in relation to skip connections.

downscale_method

This parameter specifies the method used for downscaling. Available options are "bicubic," "nearest-exact," "bilinear," "area," and "bislerp." Choosing the appropriate method can affect the quality and performance of the downscaling operation.

upscale_method

This parameter defines the method used for upscaling after the downscaling operation. Available options are "bicubic," "nearest-exact," "bilinear," "area," and "bislerp." Selecting the right method ensures that the upscaled features match the desired quality and resolution.

PatchModelAddDownscale (Kohya Deep Shrink) Output Parameters:

model

The output is the modified model with the applied downscaling and upscaling patches. This model can then be used for further processing or evaluation, incorporating the changes specified by the input parameters.

PatchModelAddDownscale (Kohya Deep Shrink) Usage Tips:

  • Experiment with different downscale_factor values to find the optimal balance between performance and visual quality.
  • Use the start_percent and end_percent parameters to fine-tune the timing of the downscaling operation within the model's execution.
  • Select appropriate downscale_method and upscale_method options based on the specific requirements of your task, as different methods can produce varying results.

PatchModelAddDownscale (Kohya Deep Shrink) Common Errors and Solutions:

"Invalid block number"

  • Explanation: The specified block number is outside the valid range.
  • Solution: Ensure that the block_number parameter is set between 1 and 32.

"Downscale factor out of range"

  • Explanation: The downscale_factor value is not within the allowed range.
  • Solution: Adjust the downscale_factor to be between 0.1 and 9.0.

"Invalid start or end percent"

  • Explanation: The start_percent or end_percent values are not within the range of 0.0 to 1.0.
  • Solution: Set the start_percent and end_percent parameters to values within the 0.0 to 1.0 range.

"Unsupported downscale or upscale method"

  • Explanation: The specified method for downscaling or upscaling is not recognized.
  • Solution: Choose from the available methods: "bicubic," "nearest-exact," "bilinear," "area," or "bislerp."

PatchModelAddDownscale (Kohya Deep Shrink) Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI
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.