class_docstr: Base `tts` class. Every new `tts` model must inherit this.
  
  It defines common `tts` specific functions on top of `Model` implementation.
class_docstr_tok: ["Base","`","tts","`","class",".","Every","new","`","tts","`","model","must","inherit","this",".","It","defines","common","`","tts","`","specific","functions","on","top","of","`","Model","`","implementation","."]
docstr: Generic test run for `tts` models used by `Trainer`.
  
  You can override this for a different behaviour.
  
  Args:
      assets (dict): A dict of training assets. For `tts` models, it must include `{'audio_processor': ap}`.
  
  Returns:
      Tuple[Dict, Dict]: Test figures and audios to be projected to Tensorboard.
docstr_tok: ["Generic","test","run","for","`","tts","`","models","used","by","`","Trainer","`",".","You","can","override","this","for","a","different","behaviour",".","Args",":","assets","(","dict",")",":","A","dict","of","training","assets",".","For","`","tts","`","models",",","it","must","include","`","{","'audio_processor","'",":","ap","}","`",".","Returns",":","Tuple","[","Dict",",","Dict","]",":","Test","figures","and","audios","to","be","projected","to","Tensorboard","."]
code: def test_run(self, assets: Dict) -> Tuple[Dict, Dict]:
      """Generic test run for `tts` models used by `Trainer`.
  
      You can override this for a different behaviour.
  
      Args:
          assets (dict): A dict of training assets. For `tts` models, it must include `{'audio_processor': ap}`.
  
      Returns:
          Tuple[Dict, Dict]: Test figures and audios to be projected to Tensorboard.
      """
      print(" | > Synthesizing test sentences.")
      test_audios = {}
      test_figures = {}
      test_sentences = self.config.test_sentences
      aux_inputs = self._get_test_aux_input()
      for idx, sen in enumerate(test_sentences):
          if isinstance(sen, list):
              aux_inputs = self.get_aux_input_from_test_sentences(sen)
              sen = aux_inputs["text"]
          outputs_dict = synthesis(
              self,
              sen,
              self.config,
              "cuda" in str(next(self.parameters()).device),
              speaker_id=aux_inputs["speaker_id"],
              d_vector=aux_inputs["d_vector"],
              style_wav=aux_inputs["style_wav"],
              use_griffin_lim=True,
              do_trim_silence=False,
          )
          test_audios["{}-audio".format(idx)] = outputs_dict["wav"]
          test_figures["{}-prediction".format(idx)] = plot_spectrogram(
              outputs_dict["outputs"]["model_outputs"],
              self.ap,
              output_fig=False,
          )
          test_figures["{}-alignment".format(idx)] = plot_alignment(
              outputs_dict["outputs"]["alignments"], output_fig=False
          )
      return test_figures, test_audios
  
imports: import os
  import random
  from typing import Dict, List, Tuple, Union
  import torch
  import torch.distributed
  from coqpit import Coqpit
  from torch import nn
  from torch.utils.data import DataLoader
  from torch.utils.data.sampler import WeightedRandomSampler
  from trainer.torch import DistributedSampler, DistributedSamplerWrapper
  from TTS.model import BaseTrainerModel
  from TTS.tts.datasets.dataset import TTSDataset
  from TTS.tts.utils.data import get_length_balancer_weights
  from TTS.tts.utils.languages import LanguageManager, get_language_balancer_weights
  from TTS.tts.utils.speakers import SpeakerManager, get_speaker_balancer_weights, get_speaker_manager
  from TTS.tts.utils.synthesis import synthesis
  from TTS.tts.utils.visual import plot_alignment, plot_spectrogram
label_desc: Use image node_id 10 for calling the BaseTTS obj's underlying member method code with example usage: obj.test_run(assets) and returns: test_figures,  test_audios