code: def collect_unique_labels_from_fragment(
      labels_file: Path,
      start_pos: int,
      lines_per_dataset_fragment: int,
      progress_queue: mp.Queue,
      fragment_idx: int,
  ) -> Tuple[Set[str], Set[str]]:
      """
      Returns a set of unique punctuation labels and a set of unique capitalization labels.
  
      Args:
          labels_file: a path to a file with labels
          start_pos: an index of the first byte of a fragment in ``labels_file``
          lines_per_dataset_fragment: number of lines in dataset fragment. In the last fragment there can be less lines.
          progress_queue: a queue for reporting number of processed lines
          fragment_idx: a processed fragment index
  
      Returns:
          unique_punct: a set of unique punctuation labels
          unique_capit: a set of unique capitalization labels
      """
      unique_punct, unique_capit = set(), set()
      with labels_file.open() as f:
          f.seek(start_pos)
          progress_report = 0
          for i in range(lines_per_dataset_fragment):
              line = f.readline()
              if not line:
                  break
              pairs = line.split()
              if not all([len(p) == 2 for p in pairs]):
                  broken_pairs = [
                      i for i, p in enumerate(pairs) if len(p) != 2
                  ]
                  raise ValueError(
                      f"Found broken labels line in number {fragment_idx * lines_per_dataset_fragment + i} in file "
                      f"{labels_file}. Indices of broken pairs of labels: {broken_pairs}"
                  )
              punct, capit = zip(*pairs)
              unique_punct.update(punct)
              unique_capit.update(capit)
              progress_report += 1
              if progress_report >= PROGRESS_REPORT_PERIOD:
                  progress_queue.put(progress_report)
                  progress_report = 0
          progress_queue.put(progress_report)
      return unique_punct, unique_capit
  
imports: import inspect
  import json
  import multiprocessing
  import os
  import pickle
  import re
  import shutil
  import tempfile
  from collections import deque
  from pathlib import Path
  from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Tuple, Type, Union
  import numpy
  import torch
  import webdataset
  from joblib import Parallel, delayed
  from omegaconf import DictConfig
  from torch.utils.data import IterableDataset
  from nemo.collections.common.tokenizers import TokenizerSpec
  from nemo.collections.nlp.data.token_classification.punctuation_capitalization_dataset import LABEL_ID_DIR_FOR_NEMO_CHECKPOINT, BertPunctuationCapitalizationDataset, Progress, create_label_ids, create_masks_and_segment_ids, load_label_ids, raise_not_equal_labels_error
  from nemo.collections.nlp.modules.common.tokenizer_utils import get_tokenizer
  from nemo.core.neural_types import AudioSignal, ChannelType, LabelsType, LengthsType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: collect_unique_labels_from_fragment(labels_file, start_pos, lines_per_dataset_fragment, progress_queue, fragment_idx) and returns: unique_punct,  unique_capit