docstr: Convert text transcript into int labels.
  
  Note:
      There are ``<unk>`` tokens in the training set that are regarded as normal tokens
      by the SentencePiece model. This will impact RNNT decoding since the decoding result
      of ``<unk>`` will be ``?? unk ??`` and will not be excluded from the final prediction.
      To address it, here we replace ``<unk>`` with ``<garbage>`` and set
      ``user_defined_symbols=["<garbage>"]`` in the SentencePiece model training.
      Then we map the index of ``<garbage>`` to the real ``unknown`` index.
code: def _extract_labels(self, samples: List):
      """Convert text transcript into int labels.
  
      Note:
          There are ``<unk>`` tokens in the training set that are regarded as normal tokens
          by the SentencePiece model. This will impact RNNT decoding since the decoding result
          of ``<unk>`` will be ``?? unk ??`` and will not be excluded from the final prediction.
          To address it, here we replace ``<unk>`` with ``<garbage>`` and set
          ``user_defined_symbols=["<garbage>"]`` in the SentencePiece model training.
          Then we map the index of ``<garbage>`` to the real ``unknown`` index.
      """
      targets = [
          self.sp_model.encode(
              sample[2]
              .lower()
              .replace("<unk>", "<garbage>")
              .replace("\n", "")
          )
          for sample in samples
      ]
      targets = [
          [
              ele if ele != 4 else self.sp_model.unk_id()
              for ele in target
          ]
          for target in targets
      ]  # map id of <unk> token to unk_id
      lengths = torch.tensor([len(elem) for elem in targets]).to(
          dtype=torch.int32
      )
      targets = torch.nn.utils.rnn.pad_sequence(
          [torch.tensor(elem) for elem in targets],
          batch_first=True,
          padding_value=1.0,
      ).to(dtype=torch.int32)
      return targets, lengths
  
imports: import os
  from functools import partial
  from typing import List
  import sentencepiece
  import torch
  import torchaudio
  from common import Batch, batch_by_token_count, FunctionalModule, GlobalStatsNormalization, piecewise_linear_log, post_process_hypos, spectrogram_transform, WarmupLR
  from pytorch_lightning import LightningModule
  from torchaudio.models import emformer_rnnt_base, RNNTBeamSearch
label_desc: Use image node_id 2 for calling the TEDLIUM3RNNTModule obj's underlying member method code with example usage: obj._extract_labels(samples) and returns: targets,  lengths