code: def increase_block_input_in_encoder_downsampler(
      unet: UNet2DConditionModel, block_no, by
  ):
      """Increase channels sizes to allow for additional concatted information from base model"""
      old_down = unet.down_blocks[block_no].downsamplers[0].conv
  
      args = [
          "in_channels",
          "out_channels",
          "kernel_size",
          "stride",
          "padding",
          "dilation",
          "groups",
          "bias",
          "padding_mode",
      ]
      if not USE_PEFT_BACKEND:
          args.append("lora_layer")
  
      for a in args:
          assert hasattr(old_down, a)
      kwargs = {a: getattr(old_down, a) for a in args}
      kwargs["bias"] = (
          "bias" in kwargs
      )  # as param, bias is a boolean, but as attr, it's a tensor.
      kwargs["in_channels"] += by  # surgery done here
      # swap old with new modules
      unet.down_blocks[block_no].downsamplers[0].conv = (
          nn.Conv2d(**kwargs)
          if USE_PEFT_BACKEND
          else LoRACompatibleConv(**kwargs)
      )
      unet.down_blocks[block_no].downsamplers[0].channels += by
  
imports: import math
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import functional
  from torch.nn.modules.normalization import GroupNorm
  from diffusers.configuration_utils import ConfigMixin, register_to_config
  from diffusers.models.attention_processor import USE_PEFT_BACKEND, AttentionProcessor
  from diffusers.models.autoencoders import AutoencoderKL
  from diffusers.models.lora import LoRACompatibleConv
  from diffusers.models.modeling_utils import ModelMixin
  from diffusers.models.unet_2d_blocks import CrossAttnDownBlock2D, CrossAttnUpBlock2D, DownBlock2D, Downsample2D, ResnetBlock2D, Transformer2DModel, UpBlock2D, Upsample2D
  from diffusers.models.unet_2d_condition import UNet2DConditionModel
  from diffusers.utils import BaseOutput, logging
label_desc: Use image node_id 3 for calling a global function with example usage: increase_block_input_in_encoder_downsampler(unet, block_no, by) without return types