code: def prepare_split_data(
      manifest_filepath, _out_dir, multiscale_args_dict, global_rank
  ):
      """
      This function is needed for preparing diarization training data for multiscale diarization decoder (MSDD).
      Prepare multiscale timestamp data for training. Oracle VAD timestamps from RTTM files are used as VAD timestamps.
      In this function, timestamps for embedding extraction are extracted without extracting the embedding vectors.
  
      Args:
          manifest_filepath (str):
              Input manifest file for creating audio-to-RTTM mapping.
          _out_dir (str):
              Output directory where timestamp json files are saved.
  
      Returns:
          multiscale_args_dict (dict):
              - Dictionary containing two types of arguments: multi-scale weights and subsegment timestamps for each data sample.
              - Each data sample has two keys: `multiscale_weights` and `scale_dict`.
                  - `multiscale_weights` key contains a list containing multiscale weights.
                  - `scale_dict` is indexed by integer keys which are scale index.
              - Each data sample is indexed by using the following naming convention: `<uniq_id>_<start time in ms>_<end time in ms>`
                  Example: `fe_03_00106_mixed_626310_642300`
      """
      speaker_dir = os.path.join(_out_dir, "speaker_outputs")
  
      # Only if this is for the first run of modelPT instance, remove temp folders.
      if global_rank == 0:
          if os.path.exists(speaker_dir):
              shutil.rmtree(speaker_dir)
          os.makedirs(speaker_dir)
      split_audio_rttm_map = audio_rttm_map(
          manifest_filepath, attach_dur=True
      )
  
      # Speech Activity Detection part
      _speaker_manifest_path = os.path.join(
          speaker_dir, f"oracle_vad_manifest.json"
      )
      logging.info(
          f"Extracting oracle VAD timestamps and saving at {speaker_dir}"
      )
      if not os.path.exists(_speaker_manifest_path):
          write_rttm2manifest(
              split_audio_rttm_map,
              _speaker_manifest_path,
              include_uniq_id=True,
          )
  
      multiscale_timestamps_by_scale = {}
  
      # Segmentation
      for scale_idx, (window, shift) in multiscale_args_dict[
          "scale_dict"
      ].items():
          subsegments_manifest_path = os.path.join(
              speaker_dir, f"subsegments_scale{scale_idx}.json"
          )
          if not os.path.exists(subsegments_manifest_path):
              # Sub-segmentation for the current scale (scale_idx)
              segments_manifest_to_subsegments_manifest(
                  segments_manifest_file=_speaker_manifest_path,
                  subsegments_manifest_file=subsegments_manifest_path,
                  window=window,
                  shift=shift,
                  include_uniq_id=True,
              )
              logging.info(
                  f"Subsegmentation for timestamp extracted for: scale-{scale_idx} at {subsegments_manifest_path}"
              )
          multiscale_timestamps = extract_timestamps(
              subsegments_manifest_path
          )
          multiscale_timestamps_by_scale[
              scale_idx
          ] = multiscale_timestamps
  
      multiscale_timestamps_dict = get_timestamps(
          multiscale_timestamps_by_scale, multiscale_args_dict
      )
      return multiscale_timestamps_dict
  
imports: import gc
  import json
  import math
  import os
  import shutil
  from copy import deepcopy
  from typing import Dict, List, Tuple, Union
  import numpy
  import omegaconf
  import soundfile
  import torch
  from pyannote.core import Annotation, Segment
  from tqdm import tqdm
  from nemo.collections.asr.data.audio_to_label import repeat_signal
  from nemo.collections.asr.parts.utils.longform_clustering import LongFormSpeakerClustering
  from nemo.collections.asr.parts.utils.offline_clustering import SpeakerClustering, get_argmin_mat, split_input_data
  from nemo.utils import logging
label_desc: Use image node_id 46 for calling a global function with example usage: prepare_split_data(manifest_filepath, _out_dir, multiscale_args_dict, global_rank) and returns: multiscale_timestamps_dict