code: def checkpoint_filter_fn(state_dict, model):
      """Remap original checkpoints -> timm"""
      if "stages.0.blocks.0.norm1.weight" in state_dict:
          return state_dict  # already translated checkpoint
      if "model" in state_dict:
          state_dict = state_dict["model"]
  
      import re
  
      out_dict = {}
      for k, v in state_dict.items():
          k = re.sub(
              r"blocks.([0-9]+).([0-9]+).down",
              lambda x: f"stages.{int(x.group(1)) + 1}.downsample.down",
              k,
          )
          k = re.sub(
              r"blocks.([0-9]+).([0-9]+)", r"stages.\1.blocks.\2", k
          )
          k = k.replace("head.", "head.fc.")
          out_dict[k] = v
  
      return out_dict
  
imports: import math
  from functools import partial
  from itertools import accumulate
  from typing import Tuple
  import torch
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, DEFAULT_CROP_PCT
  from timm.layers import lecun_normal_, DropPath, Mlp, PatchEmbed, ClassifierHead
  from ._builder import build_model_with_cfg
  from ._manipulate import named_apply
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 2 for calling a global function with example usage: checkpoint_filter_fn(state_dict, model) and returns: out_dict, state_dict