class_docstr: The G2P model evaluation wrapper
  
  Arguments
  ---------
  hparams: dict
      the dictionary from a parsed hyperparameter file
  device: str
      the device identifier
  model_state: dict
      a pre-loaded model state for a "warm start" if applicable
      - could be useful if hyperparameters have changed, but
      the same model can be reused from one run to the next
code: def __init__(self, hparams, device, model_state=None):
      self.hparams = SimpleNamespace(**hparams)
      self.overrides = overrides
      self.device = device
      self.modules = torch.nn.ModuleDict(self.hparams.modules).to(
          self.device
      )
      beam_searcher = (
          self.hparams.beam_searcher_lm
          if self.hparams.use_language_model
          else self.hparams.beam_searcher
      )
      self.beam_searcher = beam_searcher.to(self.device)
      if model_state:
          self.hparams.model.load_state_dict(model_state)
      else:
          self.load()
      self.grapheme_sequence_mode = getattr(
          self.hparams, "grapheme_sequence_mode", "bos"
      )
      self.grapheme_key = get_sequence_key(
          key="grapheme_encoded", mode=self.grapheme_sequence_mode
      )
      self.modules["model"].eval()
      self._word_separator = None
      self._bos = torch.tensor(
          self.hparams.bos_index, device=device
      ).unsqueeze(-1)
      self._eos = torch.tensor(
          self.hparams.eos_index, device=device
      ).unsqueeze(-1)
  
      # When reconstructing sentences word-wise, the process depends
      # on whether spaces are preserved or omitted, as controlled by
      # the phonemes_enable_space hyperparameter
      self._flatten_results = (
          self._flatten_results_separated
          if getattr(self.hparams, "phonemes_enable_space", None)
          else self._flatten_results_jumbled
      )
      self._grapheme_word_separator_idx = None
      if self.hparams.use_word_emb:
          self.modules.word_emb = self.hparams.word_emb().to(
              self.device
          )
  
imports: from hyperpyyaml import load_hyperpyyaml
  from speechbrain.dataio.batch import PaddedBatch
  from speechbrain.lobes.models.g2p.dataio import get_sequence_key
  from speechbrain.utils import hpopt
  from speechbrain.wordemb.util import expand_to_chars
  from train import dataio_prep, load_dependencies
  from types import SimpleNamespace
  from tqdm.auto import tqdm
  import math
  import itertools
  import speechbrain
  import torch
  import sys
  import logging
label_desc: Use image node_id 1 to create a new G2PEvaluator object  with example: obj = G2PEvaluator(hparams, device, model_state)