class_docstr: Model for end-to-end speech intent classification and slot filling, which is formulated as a speech-to-sequence task
class_docstr_tok: ["Model","for","end-to-end","speech","intent","classification","and","slot","filling",",","which","is","formulated","as","a","speech-to-sequence","task"]
code: def __init__(self, cfg: DictConfig, trainer=None):
      # Convert to Hydra 1.0 compatible DictConfig
      cfg = model_utils.convert_model_config_to_dict_config(cfg)
      cfg = model_utils.maybe_update_config_version(cfg)
  
      if "tokenizer" not in cfg:
          raise ValueError(
              "`cfg` must have `tokenizer` config to create a tokenizer !"
          )
  
      # Setup the tokenizer
      self._setup_tokenizer(cfg.tokenizer)
  
      super().__init__(cfg=cfg, trainer=trainer)
  
      self.preprocessor = self.from_config_dict(self.cfg.preprocessor)
      self.encoder = self.from_config_dict(self.cfg.encoder)
      self.decoder = self.from_config_dict(self.cfg.decoder)
  
      if (
          hasattr(self._cfg, "spec_augment")
          and self._cfg.spec_augment is not None
      ):
          self.spec_augmentation = self.from_config_dict(
              self._cfg.spec_augment
          )
      else:
          self.spec_augmentation = None
  
      # Setup optional Optimization flags
      self.setup_optimization_flags()
  
      # Adapter modules setup (from ASRAdapterModelMixin)
      self.setup_adapters()
  
      self.vocabulary = self.tokenizer.tokenizer.get_vocab()
      vocab_size = len(self.vocabulary)
  
      # Create embedding layer
      self.cfg.embedding["vocab_size"] = vocab_size
      self.embedding = self.from_config_dict(self.cfg.embedding)
  
      # Create token classifier
      self.cfg.classifier["num_classes"] = vocab_size
      self.classifier = self.from_config_dict(self.cfg.classifier)
  
      self.loss = SmoothedNLLLoss(
          label_smoothing=self.cfg.loss.label_smoothing
      )
  
      self.sequence_generator = SequenceGenerator(
          cfg=self.cfg.sequence_generator,
          embedding=self.embedding,
          decoder=self.decoder,
          log_softmax=self.classifier,
          tokenizer=self.tokenizer,
      )
  
      # Setup decoding objects
      decoding_cfg = self.cfg.get("decoding", None)
  
      # In case decoding config not found, use default config
      if decoding_cfg is None:
          decoding_cfg = OmegaConf.structured(CTCBPEDecodingConfig)
          with open_dict(self.cfg):
              self.cfg.decoding = decoding_cfg
  
      self.decoding = CTCBPEDecoding(
          self.cfg.decoding, tokenizer=self.tokenizer
      )
  
      # Setup metric with decoding strategy
      self.wer = WER(
          decoding=self.decoding,
          use_cer=self._cfg.get("use_cer", False),
          dist_sync_on_step=True,
          log_prediction=self._cfg.get("log_prediction", False),
          fold_consecutive=False,
      )
  
imports: import json
  import os
  import tempfile
  from math import ceil
  from typing import Dict, List, Optional, Union
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  from tqdm.auto import tqdm
  from nemo.collections.asr.data import audio_to_text_dataset
  from nemo.collections.asr.data.audio_to_text_dali import DALIOutputs
  from nemo.collections.asr.metrics.wer import WER
  from nemo.collections.asr.models.asr_model import ASRModel, ExportableEncDecModel
  from nemo.collections.asr.parts.mixins import ASRBPEMixin, ASRModuleMixin
  from nemo.collections.asr.parts.preprocessing.perturb import process_augmentations
  from nemo.collections.asr.parts.submodules.ctc_decoding import CTCBPEDecoding, CTCBPEDecodingConfig
  from nemo.collections.asr.parts.utils.slu_utils import SequenceGenerator, SequenceGeneratorConfig, get_seq_mask
  from nemo.collections.common.losses import SmoothedNLLLoss
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types import AudioSignal, LabelsType, LengthsType, LogprobsType, NeuralType, SpectrogramType
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 1 to create a new SLUIntentSlotBPEModel object from inherited base classes: ASRModel, ExportableEncDecModel, ASRModuleMixin, ASRBPEMixin with example: obj = SLUIntentSlotBPEModel(cfg, trainer)