class_docstr: CTC-based grapheme-to-phoneme model.
class_docstr_tok: ["CTC-based","grapheme-to-phoneme","model","."]
code: def _setup_encoder(self):
      if self.mode == "byt5":
          config = AutoConfig.from_pretrained(
              self._cfg.tokenizer_grapheme.pretrained
          )
          if self._cfg.encoder.dropout is not None:
              config.dropout_rate = self._cfg.encoder.dropout
              print(f"\nDROPOUT: {config.dropout_rate}")
          self.encoder = AutoModel.from_pretrained(
              self._cfg.encoder.transformer, config=config
          ).encoder
          # add encoder hidden dim size to the config
          if self.cfg.decoder.feat_in is None:
              self._cfg.decoder.feat_in = self.encoder.config.d_model
      elif self.mode == "conformer_bpe":
          self.embedding = torch.nn.Embedding(
              embedding_dim=self._cfg.embedding.d_model,
              num_embeddings=self.tokenizer.vocab_size,
              padding_idx=0,
          )
          self.encoder = EncDecCTCModel.from_config_dict(
              self._cfg.encoder
          )
          with open_dict(self._cfg):
              if "feat_in" not in self._cfg.decoder or (
                  not self._cfg.decoder.feat_in
                  and hasattr(self.encoder, "_feat_out")
              ):
                  self._cfg.decoder.feat_in = self.encoder._feat_out
              if (
                  "feat_in" not in self._cfg.decoder
                  or not self._cfg.decoder.feat_in
              ):
                  raise ValueError(
                      "param feat_in of the decoder's config is not set!"
                  )
      else:
          raise ValueError(
              f"{self.mode} is not supported. Choose from {self.supported_modes}"
          )
  
imports: import os
  import string
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Union
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig, ListConfig, OmegaConf, open_dict
  from pytorch_lightning import Trainer
  from transformers import AutoConfig, AutoModel, AutoTokenizer
  from nemo.collections.tts.g2p.data.ctc import CTCG2PBPEDataset
  from nemo.collections.tts.models.base import G2PModel
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the CTCG2PModel obj's underlying member method code with example usage: obj._setup_encoder() without return types