code: def checkpoint_filter_fn(state_dict, model):
      """preprocess checkpoints"""
      out_dict = {}
      p_blocks = re.compile(r"pools\.(\d)\.")
      for k, v in state_dict.items():
          # FIXME need to update resize for PiT impl
          # if k == 'pos_embed' and v.shape != model.pos_embed.shape:
          #     # To resize pos embedding when using model at different size from pretrained weights
          #     v = resize_pos_embed(v, model.pos_embed)
          k = p_blocks.sub(
              lambda exp: f"transformers.{int(exp.group(1)) + 1}.pool.",
              k,
          )
          out_dict[k] = v
      return out_dict
  
imports: import math
  import re
  from functools import partial
  from typing import Sequence, Tuple
  import torch
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import trunc_normal_, to_2tuple, LayerNorm
  from ._builder import build_model_with_cfg
  from ._registry import register_model, generate_default_cfgs
  from .vision_transformer import Block
label_desc: Use image node_id 1 for calling a global function with example usage: checkpoint_filter_fn(state_dict, model) and returns: out_dict