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
docstr: Runs the model and the beam search to retrieve the phoneme sequence
  corresponding to the provided grapheme sequence
  
  Arguments
  ---------
  grapheme_encoded: speechbrain.dataio.batch.PaddedData
      An encoded grapheme sequence
  
  phn_encoded_bos: speechbrain.dataio.batch.PaddedData
      An encoded phoneme sequence (optional)
  
  char: str
      Raw character input (needed for word embeddings)
  
  Returns
  -------
  hyps: list
      the hypotheses (the beam search result)
  scores: list
      the scores corresponding to the hypotheses
docstr_tok: ["Runs","the","model","and","the","beam","search","to","retrieve","the","phoneme","sequence","corresponding","to","the","provided","grapheme","sequence","Arguments","--","--","--","--","-","grapheme_encoded",":","speechbrain.dataio.batch.PaddedData","An","encoded","grapheme","sequence","phn_encoded_bos",":","speechbrain.dataio.batch.PaddedData","An","encoded","phoneme","sequence","(","optional",")","char",":","str","Raw","character","input","(","needed","for","word","embeddings",")","Returns","--","--","--","-","hyps",":","list","the","hypotheses","(","the","beam","search","result",")","scores",":","list","the","scores","corresponding","to","the","hypotheses"]
code: def _get_phonemes(
      self, grapheme_encoded, phn_encoded=None, char=None
  ):
      """Runs the model and the beam search to retrieve the phoneme sequence
      corresponding to the provided grapheme sequence
  
      Arguments
      ---------
      grapheme_encoded: speechbrain.dataio.batch.PaddedData
          An encoded grapheme sequence
  
      phn_encoded_bos: speechbrain.dataio.batch.PaddedData
          An encoded phoneme sequence (optional)
  
      char: str
          Raw character input (needed for word embeddings)
  
      Returns
      -------
      hyps: list
          the hypotheses (the beam search result)
      scores: list
          the scores corresponding to the hypotheses
      """
      _, char_word_emb = None, None
      if self._grapheme_word_separator_idx is None:
          self._grapheme_word_separator_idx = (
              self.hparams.grapheme_encoder.lab2ind[" "]
          )
      if not phn_encoded:
          grapheme_encoded_data, grapheme_lens = grapheme_encoded
          phn_encoded = (
              torch.ones(len(grapheme_encoded_data), 1).to(
                  grapheme_encoded_data.device
              )
              * self.hparams.bos_index,
              torch.ones(len(grapheme_encoded_data)).to(
                  grapheme_encoded_data.device
              ),
          )
          char_word_emb = self._apply_word_embeddings(
              grapheme_encoded, char
          )
      p_seq, char_lens, encoder_out, _ = self.modules.model(
          grapheme_encoded=grapheme_encoded,
          phn_encoded=phn_encoded,
          word_emb=char_word_emb,
      )
      return self.beam_searcher(encoder_out, char_lens)
  
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 4 for calling the G2PEvaluator obj's underlying member method code with example usage: obj._get_phonemes(grapheme_encoded, phn_encoded, char) and returns: self