code: def _filter_state_dict(
      state_dict, remove_model_prefix_offset: int = 1
  ):
      """Makes the state_dict compatible with the model.
  
      Prevents unexpected key error when loading PyTorch-Lightning checkpoints.
      Allows backwards compatability to checkpoints before v1.0.6.
  
      """
  
      prev_backbone = "features"
      curr_backbone = "backbone"
  
      new_state_dict = {}
      for key, item in state_dict.items():
          # remove the "model." prefix from the state dict key
          key_parts = key.split(".")[remove_model_prefix_offset:]
          # with v1.0.6 the backbone of the models will be renamed from
          # "features" to "backbone", ensure compatability with old ckpts
          key_parts = [
              k if k != prev_backbone else curr_backbone
              for k in key_parts
          ]
  
          new_key = ".".join(key_parts)
          new_state_dict[new_key] = item
  
      return new_state_dict
  
imports: import os
  import hydra
  import torch
  from hydra import utils
  from torch import nn
  from lightly.cli._cli_simclr import _SimCLR
  from lightly.embedding import SelfSupervisedEmbedding
  from lightly.models import ZOO
  from lightly.models import ResNetGenerator
  from lightly.models.batchnorm import get_norm_layer
  from lightly.utils.version_compare import version_compare
label_desc: Use image node_id 8 for calling a global function with example usage: _filter_state_dict(state_dict, remove_model_prefix_offset) and returns: new_state_dict