code: def _load_state(
      model: Module, checkpoint_path: Path, device=_DEFAULT_DEVICE
  ) -> Module:
      """Load weights from HuBERTPretrainModel checkpoint into hubert_pretrain_base model.
      Args:
          model (Module): The hubert_pretrain_base model.
          checkpoint_path (Path): The model checkpoint.
          device (torch.device, optional): The device of the model. (Default: ``torch.device("cpu")``)
  
      Returns:
          (Module): The pretrained model.
      """
      state_dict = torch.load(checkpoint_path, map_location=device)
      state_dict = {
          k.replace("model.", ""): v
          for k, v in state_dict["state_dict"].items()
      }
      model.load_state_dict(state_dict)
      return model
  
file_path: audio/examples/hubert/utils/feature_utils.py
imports: import logging
  from pathlib import Path
  from typing import Optional, Tuple, Union
  import torch
  import torchaudio
  from torch import Tensor
  from torch.nn import Module
  from .common_utils import _get_feat_lens_paths
label_desc: Use image node_id 4 for calling a global function with example usage: _load_state(model, checkpoint_path, device) and returns: model