code: def make_rttm_with_overlap(
      manifest_file_path: str,
      clus_label_dict: Dict[str, List[Union[float, int]]],
      msdd_preds: List[torch.Tensor],
      **params,
  ):
      """
      Create RTTM files that include detected overlap speech. Note that the effect of overlap detection is only
      notable when RTTM files are evaluated with `ignore_overlap=False` option.
  
      Args:
          manifest_file_path (str):
              Path to the input manifest file.
          clus_label_dict (dict):
              Dictionary containing subsegment timestamps in float type and cluster labels in integer type.
              Indexed by `uniq_id` string.
          msdd_preds (list):
              List containing tensors of the predicted sigmoid values.
              Each tensor has shape of: (Session length, estimated number of speakers).
          params:
              Parameters for generating RTTM output and evaluation. Parameters include:
                  infer_overlap (bool): If False, overlap-speech will not be detected.
              See docstrings of `generate_speaker_timestamps` function for other variables in `params`.
  
      Returns:
          all_hypothesis (list):
              List containing Pyannote's `Annotation` objects that are created from hypothesis RTTM outputs.
          all_reference
              List containing Pyannote's `Annotation` objects that are created from ground-truth RTTM outputs
      """
      AUDIO_RTTM_MAP = audio_rttm_map(manifest_file_path)
      manifest_file_lengths_list = []
      all_hypothesis, all_reference = [], []
      no_references = False
      with open(manifest_file_path, "r", encoding="utf-8") as manifest:
          for i, line in enumerate(manifest.readlines()):
              uniq_id = get_uniq_id_from_manifest_line(line)
              manifest_dic = AUDIO_RTTM_MAP[uniq_id]
              clus_labels = clus_label_dict[uniq_id]
              manifest_file_lengths_list.append(len(clus_labels))
              maj_labels, ovl_labels = generate_speaker_timestamps(
                  clus_labels, msdd_preds[i], **params
              )
              if params["infer_overlap"]:
                  hyp_labels = maj_labels + ovl_labels
              else:
                  hyp_labels = maj_labels
              hypothesis = labels_to_pyannote_object(
                  hyp_labels, uniq_name=uniq_id
              )
              if params["out_rttm_dir"]:
                  hyp_labels = sorted(
                      hyp_labels, key=lambda x: float(x.split()[0])
                  )
                  labels_to_rttmfile(
                      hyp_labels, uniq_id, params["out_rttm_dir"]
                  )
              all_hypothesis.append([uniq_id, hypothesis])
              rttm_file = manifest_dic.get("rttm_filepath", None)
              if (
                  rttm_file is not None
                  and os.path.exists(rttm_file)
                  and not no_references
              ):
                  ref_labels = rttm_to_labels(rttm_file)
                  reference = labels_to_pyannote_object(
                      ref_labels, uniq_name=uniq_id
                  )
                  all_reference.append([uniq_id, reference])
              else:
                  no_references = True
                  all_reference = []
      return all_reference, all_hypothesis
  
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 48 for calling a global function with example usage: make_rttm_with_overlap(manifest_file_path, clus_label_dict, msdd_preds) and returns: all_reference,  all_hypothesis