code: def compute_encoder_accuracy(dataset_items, encoder_manager):
      class_name_key = encoder_manager.encoder_config.class_name_key
      map_classid_to_classname = getattr(
          encoder_manager.encoder_config,
          "map_classid_to_classname",
          None,
      )
  
      class_acc_dict = {}
  
      # compute embeddings for all wav_files
      for item in tqdm(dataset_items):
          class_name = item[class_name_key]
          wav_file = item["audio_file"]
  
          # extract the embedding
          embedd = encoder_manager.compute_embedding_from_clip(wav_file)
          if (
              encoder_manager.encoder_criterion is not None
              and map_classid_to_classname is not None
          ):
              embedding = torch.FloatTensor(embedd).unsqueeze(0)
              if encoder_manager.use_cuda:
                  embedding = embedding.cuda()
  
              class_id = (
                  encoder_manager.encoder_criterion.softmax.inference(
                      embedding
                  ).item()
              )
              predicted_label = map_classid_to_classname[str(class_id)]
          else:
              predicted_label = None
  
          if class_name is not None and predicted_label is not None:
              is_equal = int(class_name == predicted_label)
              if class_name not in class_acc_dict:
                  class_acc_dict[class_name] = [is_equal]
              else:
                  class_acc_dict[class_name].append(is_equal)
          else:
              raise RuntimeError(
                  "Error: class_name or/and predicted_label are None"
              )
  
      acc_avg = 0
      for key, values in class_acc_dict.items():
          acc = sum(values) / len(values)
          print("Class", key, "Accuracy:", acc)
          acc_avg += acc
  
      print("Average Accuracy:", acc_avg / len(class_acc_dict))
  
imports: import argparse
  from argparse import RawTextHelpFormatter
  import torch
  from tqdm import tqdm
  from TTS.config import load_config
  from TTS.tts.datasets import load_tts_samples
  from TTS.tts.utils.speakers import SpeakerManager
label_desc: Use image node_id 1 for calling a global function with example usage: compute_encoder_accuracy(dataset_items, encoder_manager) without return types