code: def resnet_to_diffusers_checkpoint(
      resnet, checkpoint, *, diffusers_resnet_prefix, resnet_prefix
  ):
      rv = {
          # norm1
          f"{diffusers_resnet_prefix}.norm1.linear.weight": checkpoint[
              f"{resnet_prefix}.main.0.mapper.weight"
          ],
          f"{diffusers_resnet_prefix}.norm1.linear.bias": checkpoint[
              f"{resnet_prefix}.main.0.mapper.bias"
          ],
          # conv1
          f"{diffusers_resnet_prefix}.conv1.weight": checkpoint[
              f"{resnet_prefix}.main.2.weight"
          ],
          f"{diffusers_resnet_prefix}.conv1.bias": checkpoint[
              f"{resnet_prefix}.main.2.bias"
          ],
          # norm2
          f"{diffusers_resnet_prefix}.norm2.linear.weight": checkpoint[
              f"{resnet_prefix}.main.4.mapper.weight"
          ],
          f"{diffusers_resnet_prefix}.norm2.linear.bias": checkpoint[
              f"{resnet_prefix}.main.4.mapper.bias"
          ],
          # conv2
          f"{diffusers_resnet_prefix}.conv2.weight": checkpoint[
              f"{resnet_prefix}.main.6.weight"
          ],
          f"{diffusers_resnet_prefix}.conv2.bias": checkpoint[
              f"{resnet_prefix}.main.6.bias"
          ],
      }
  
      if resnet.conv_shortcut is not None:
          rv.update(
              {
                  f"{diffusers_resnet_prefix}.conv_shortcut.weight": checkpoint[
                      f"{resnet_prefix}.skip.weight"
                  ],
              }
          )
  
      return rv
  
file_path: diffusers/scripts/convert_k_upscaler_to_diffusers.py
imports: import argparse
  import huggingface_hub
  import k_diffusion
  import torch
  from diffusers import UNet2DConditionModel
label_desc: Use image node_id 1 for calling a global function with example usage: resnet_to_diffusers_checkpoint(resnet, checkpoint) and returns: rv