code: def compute_accuracy(
      self, enc_input, enc_mask, encoder_input, labels
  ):
      predicted_token_ids, log_probs = self.frozen_model.decode(
          tokens_enc=enc_input,
          enc_mask=enc_mask,
          num_tokens_to_generate=self.decoder_seq_length,
          encoder_input=encoder_input,
      )
  
      processed_inputs, processed_preds, processed_labels = [], [], []
      preds = predicted_token_ids.cpu().numpy().tolist()
      labels = labels.cpu().numpy().tolist()
      enc_inputs = enc_input.cpu().numpy().tolist()
  
      for i, (enc_input, pred, label) in enumerate(
          zip(enc_inputs, preds, labels)
      ):
          if self.tokenizer.eos_id in pred:
              idx = pred.index(self.tokenizer.eos_id)
              pred = pred[:idx]
  
          additional_special_tokens_ids = []
          if hasattr(
              self.tokenizer.tokenizer, "additional_special_tokens_ids"
          ):
              additional_special_tokens_ids = (
                  self.tokenizer.tokenizer.additional_special_tokens_ids
              )
  
          pred = [
              id
              for id in pred
              if id not in additional_special_tokens_ids
          ]
          label = [
              id
              for id in label
              if id not in additional_special_tokens_ids
          ]
          enc_input = [
              id
              for id in enc_input
              if id not in additional_special_tokens_ids
          ]
  
          pred = self.tokenizer.ids_to_text(pred)
          label = self.tokenizer.ids_to_text(label)
          enc_input = self.tokenizer.ids_to_text(enc_input)
  
          processed_preds.append(pred)
          processed_labels.append(label)
          processed_inputs.append(enc_input)
  
      return {
          "predicted_token_ids": processed_preds,
          "labels": processed_labels,
          "enc_inputs": processed_inputs,
      }
  
imports: import itertools
  from typing import Any
  import torch
  from omegaconf.dictconfig import DictConfig
  from omegaconf.omegaconf import open_dict
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.common.parts.adapter_modules import LinearAdapterConfig
  from nemo.collections.nlp.models.language_modeling.megatron_t5_model import MegatronT5Model
  from nemo.collections.nlp.models.language_modeling.megatron_t5_prompt_learning_model import MegatronT5PromptLearningModel
  from nemo.collections.nlp.models.language_modeling.megatron_t5_sft_model import MegatronT5SFTModel
  from nemo.collections.nlp.modules.common import VirtualPromptStyle
  from nemo.collections.nlp.modules.common.megatron.adapters.parallel_adapters import AdapterName, InfusedAdapterConfig, LoraKQVAdapterConfig, LoraKVAdapterConfig, LoraQAdapterConfig, MLPInfusedAdapterConfig, ParallelLinearAdapterConfig
  from nemo.collections.nlp.parts.utils_funcs import get_last_rank
  from nemo.core.classes.mixins import adapter_mixins
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 5 for calling the MegatronT5BaseAdapterModel obj's underlying member method code with example usage: obj.compute_accuracy(enc_input, enc_mask, encoder_input, labels) and returns: dict