code: def load_cpc_model(checkpoint_path, layer=None):
      state_dict = torch.load(checkpoint_path)
      weights = state_dict["weights"]
      config = state_dict["config"]
      if layer is not None:
          config["nLevelsGRU"] = layer
  
      encoder = CPCEncoder(config["hiddenEncoder"])
      ar_net = CPCAR(
          config["hiddenEncoder"],
          config["hiddenGar"],
          False,
          config["nLevelsGRU"],
      )
  
      model = CPCModel(encoder, ar_net)
      model.load_state_dict(weights, strict=False)
      model.config = config
  
      return model
  
imports: import soundfile
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: load_cpc_model(checkpoint_path, layer) and returns: model