code: def load_feature(
      feat_dir: Path,
      split: str,
      num_rank: int,
      percent: float,
  ) -> Tuple[Tensor, Tensor]:
      r"""Loading features from pre-saved `.pt` files.
      Args:
          feat_dir (Path): The directory that stores the feature files.
          split (str): The split of data. Options: [``train``, ``valid``].
          num_rank (int): The number of ranks for multi-processing in feature extraction.
          percent (float): The percent of data for training k-means model. If negative, use all data for training.
  
      Returns:
          (Tensor, Tensor)
          Tensor: The concatenated feature tensor of shape `(frame, feature_dim)`.
          Tensor: The lengths tensor of shape `(num_utterance,)`.
      """
      feats = []
      lens = []
      for rank in range(1, num_rank + 1):
          feat_path, len_path = _get_feat_lens_paths(
              feat_dir, split, rank, num_rank
          )
          feat = torch.load(feat_path)
          length = torch.load(len_path).int()
          if percent < 0:
              feats.append(feat)
              lens.append(length)
          else:
              offsets = [0] + torch.cumsum(
                  length, dim=0, dtype=torch.int
              ).tolist()
              nsample = int(length.shape[0] * percent)
              indices = torch.randperm(length.shape[0])[0:nsample]
              indices = torch.sort(indices)[0]
              mask = []
              for i in range(indices.shape[0]):
                  index = indices[i]
                  mask += list(
                      range(
                          offsets[index], offsets[index] + length[index]
                      )
                  )
              mask = torch.tensor(mask, dtype=torch.int)
              feat = torch.index_select(feat, 0, mask)
              feats.append(feat)
              lens.append(length[indices])
      feats = torch.cat(feats)
      lens = torch.cat(lens)
      return feats, lens
  
file_path: audio/examples/hubert/utils/kmeans.py
imports: import logging
  from pathlib import Path
  from typing import Tuple
  import torch
  from sklearn.cluster import MiniBatchKMeans
  from torch import Tensor
  from .common_utils import _get_feat_lens_paths, _get_model_path
label_desc: Use image node_id 1 for calling a global function with example usage: load_feature(feat_dir, split, num_rank, percent) and returns: feats,  lens