class_docstr: Inference model Class for offline speaker diarization. 
  This class handles required functionality for diarization : Speech Activity Detection, Segmentation, 
  Extract Embeddings, Clustering, Resegmentation and Scoring. 
  All the parameters are passed through config file 
docstr: Diarize files provided through paths2audio_files or manifest file
  input:
  paths2audio_files (List[str]): list of paths to file containing audio file
  batch_size (int): batch_size considered for extraction of speaker embeddings and VAD computation
docstr_tok: ["Diarize","files","provided","through","paths2audio_files","or","manifest","file","input",":","paths2audio_files","(","List","[","str","]",")",":","list","of","paths","to","file","containing","audio","file","batch_size","(","int",")",":","batch_size","considered","for","extraction","of","speaker","embeddings","and","VAD","computation"]
code: def diarize(
      self, paths2audio_files: List[str] = None, batch_size: int = 0
  ):
      """
      Diarize files provided through paths2audio_files or manifest file
      input:
      paths2audio_files (List[str]): list of paths to file containing audio file
      batch_size (int): batch_size considered for extraction of speaker embeddings and VAD computation
      """
  
      self._out_dir = self._diarizer_params.out_dir
  
      self._speaker_dir = os.path.join(
          self._diarizer_params.out_dir, "speaker_outputs"
      )
  
      if os.path.exists(self._speaker_dir):
          logging.warning(
              "Deleting previous clustering diarizer outputs."
          )
          shutil.rmtree(self._speaker_dir, ignore_errors=True)
      os.makedirs(self._speaker_dir)
  
      if not os.path.exists(self._out_dir):
          os.mkdir(self._out_dir)
  
      self._vad_dir = os.path.join(self._out_dir, "vad_outputs")
      self._vad_out_file = os.path.join(self._vad_dir, "vad_out.json")
  
      if batch_size:
          self._cfg.batch_size = batch_size
  
      if paths2audio_files:
          if type(paths2audio_files) is list:
              self._diarizer_params.manifest_filepath = os.path.join(
                  self._out_dir, "paths2audio_filepath.json"
              )
              self.path2audio_files_to_manifest(
                  paths2audio_files,
                  self._diarizer_params.manifest_filepath,
              )
          else:
              raise ValueError(
                  "paths2audio_files must be of type list of paths to file containing audio file"
              )
  
      self.AUDIO_RTTM_MAP = audio_rttm_map(
          self._diarizer_params.manifest_filepath
      )
  
      out_rttm_dir = os.path.join(self._out_dir, "pred_rttms")
      os.makedirs(out_rttm_dir, exist_ok=True)
  
      # Speech Activity Detection
      self._perform_speech_activity_detection()
  
      # Segmentation
      scales = self.multiscale_args_dict["scale_dict"].items()
      for scale_idx, (window, shift) in scales:
          # Segmentation for the current scale (scale_idx)
          self._run_segmentation(
              window, shift, scale_tag=f"_scale{scale_idx}"
          )
  
          # Embedding Extraction for the current scale (scale_idx)
          self._extract_embeddings(
              self.subsegments_manifest_path, scale_idx, len(scales)
          )
  
          self.multiscale_embeddings_and_timestamps[scale_idx] = [
              self.embeddings,
              self.time_stamps,
          ]
  
      embs_and_timestamps = get_embs_and_timestamps(
          self.multiscale_embeddings_and_timestamps,
          self.multiscale_args_dict,
      )
  
      # Clustering
      all_reference, all_hypothesis = perform_clustering(
          embs_and_timestamps=embs_and_timestamps,
          AUDIO_RTTM_MAP=self.AUDIO_RTTM_MAP,
          out_rttm_dir=out_rttm_dir,
          clustering_params=self._cluster_params,
          device=self._speaker_model.device,
          verbose=self.verbose,
      )
      logging.info(
          "Outputs are saved in {} directory".format(
              os.path.abspath(self._diarizer_params.out_dir)
          )
      )
  
      # Scoring
      return score_labels(
          self.AUDIO_RTTM_MAP,
          all_reference,
          all_hypothesis,
          collar=self._diarizer_params.collar,
          ignore_overlap=self._diarizer_params.ignore_overlap,
          verbose=self.verbose,
      )
  
imports: import json
  import os
  import pickle
  import shutil
  import tarfile
  import tempfile
  from copy import deepcopy
  from typing import Any, List, Optional, Union
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning.utilities import rank_zero_only
  from tqdm import tqdm
  from nemo.collections.asr.metrics.der import score_labels
  from nemo.collections.asr.models.classification_models import EncDecClassificationModel
  from nemo.collections.asr.models.label_models import EncDecSpeakerLabelModel
  from nemo.collections.asr.parts.mixins.mixins import DiarizationMixin
  from nemo.collections.asr.parts.utils.speaker_utils import audio_rttm_map, get_embs_and_timestamps, get_uniqname_from_filepath, parse_scale_configs, perform_clustering, segments_manifest_to_subsegments_manifest, validate_vad_manifest, write_rttm2manifest
  from nemo.collections.asr.parts.utils.vad_utils import generate_overlap_vad_seq, generate_vad_segment_table, get_vad_stream_status, prepare_manifest
  from nemo.core.classes import Model
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 12 for calling the ClusteringDiarizer obj's underlying member method code with example usage: obj.diarize(paths2audio_files, batch_size) and returns: score_labels