code: def main():
      parser = get_parser()
      args = parser.parse_args()
  
      model_file = f"{args.pca_path}/pca_{args.dim}.pkl"
      pca = pickle.load(open(model_file, "rb"))
  
      os.makedirs(args.save_dir, exist_ok=True)
  
      x = []
      length_file = f"{args.save_dir}/{args.split}.lengths"
  
      with open(args.feats_scp, "r") as f_scp, open(
          length_file, "w"
      ) as lf:
          for line in f_scp.readlines():
              utt_id, feats_path = line.split()
              feats = np.load(feats_path)
              x.append(feats)
              lf.write(f"{utt_id} {feats.shape[0]}\n")
  
      features = np.vstack(x)
  
      save_path = osp.join(args.save_dir, args.split)
      npaa = NpyAppendArray(save_path + ".npy")
  
      batches = math.ceil(features.shape[0] / args.batch_size)
      for b in tqdm.trange(batches):
          start = b * args.batch_size
          end = start + args.batch_size
          x = features[start:end]
          x = pca.transform(x)
          npaa.append(x)
  
file_path: espnet/egs2/aishell/asr1/pyscripts/feats/apply_pca_cuml.py
imports: import argparse
  import math
  import os
  import os.path
  import pickle
  from shutil import copyfile
  import numpy
  import tqdm
  from npy_append_array import NpyAppendArray
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types