docstr: Convert text transcript into int labels.
docstr_tok: ["Convert","text","transcript","into","int","labels","."]
code: def _extract_labels(self, samples: List):
      """Convert text transcript into int labels."""
      targets = [self.sp_model.encode(sample[1]) for sample in samples]
      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: 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
  from .dataset import MUSTC
label_desc: Use image node_id 2 for calling the MuSTCRNNTModule obj's underlying member method code with example usage: obj._extract_labels(samples) and returns: targets,  lengths