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 validation_pass(self, batch, batch_idx, dataloader_idx=0):
      if len(batch) == 4:
          signal, signal_len, semantics, semantics_len = batch
      else:
          (
              signal,
              signal_len,
              semantics,
              semantics_len,
              sample_id,
          ) = batch
  
      if isinstance(batch, DALIOutputs) and batch.has_processed_signal:
          log_probs, pred_len, predictions = self.forward(
              processed_signal=signal,
              processed_signal_length=signal_len,
              target_semantics=semantics,
              target_semantics_length=semantics_len,
          )
      else:
          log_probs, pred_len, predictions = self.forward(
              input_signal=signal,
              input_signal_length=signal_len,
              target_semantics=semantics,
              target_semantics_length=semantics_len,
          )
  
      eos_semantics = semantics[:, 1:]
      eos_semantics_len = (
          semantics_len - 1
      )  # subtract 1 for bos&eos tokens
  
      loss_value = self.loss(
          log_probs=log_probs,
          labels=eos_semantics,
          lengths=eos_semantics_len,
      )
  
      self.wer.update(
          predictions=predictions,
          targets=eos_semantics,
          predictions_lengths=pred_len,
          targets_lengths=eos_semantics_len,
      )
      wer, wer_num, wer_denom = self.wer.compute()
      self.wer.reset()
  
      return {
          "val_loss": loss_value,
          "val_wer_num": wer_num,
          "val_wer_denom": wer_denom,
          "val_wer": wer,
      }
  
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 8 for calling the SLUIntentSlotBPEModel obj's underlying member method code with example usage: obj.validation_pass(batch, batch_idx, dataloader_idx) and returns: dict