code: def __init__(self, cfg):
      super().__init__(cfg)
      self.dict = nn.Embedding(
          cfg["num_embeddings"], cfg["embedding_dim"]
      )
      self.multispkr = cfg.get("multispkr", None)
      self.embedder = cfg.get("embedder_params", None)
  
      self.multistyle = cfg.get("multistyle", None)
  
      if self.multispkr and not self.embedder:
          self.spkr = nn.Embedding(
              cfg.get("num_speakers", 200), cfg["embedding_dim"]
          )
      elif self.embedder:
          self.spkr = nn.Linear(
              cfg.get("embedder_dim", 256), cfg["embedding_dim"]
          )
  
      if self.multistyle:
          self.style = nn.Embedding(
              cfg.get("num_styles", 100), cfg["embedding_dim"]
          )
  
      self.dur_predictor = None
      if cfg.get("dur_predictor_params", None):
          self.dur_predictor = VariancePredictor(
              cfg["dur_predictor_params"]["encoder_embed_dim"],
              cfg["dur_predictor_params"]["var_pred_hidden_dim"],
              cfg["dur_predictor_params"]["var_pred_kernel_size"],
              cfg["dur_predictor_params"]["var_pred_dropout"],
          )
  
      self.f0 = cfg.get("f0", None)
      n_f0_bin = cfg.get("f0_quant_num_bin", 0)
      self.f0_quant_embed = (
          None
          if n_f0_bin <= 0
          else nn.Embedding(n_f0_bin, cfg["embedding_dim"])
      )
  
file_path: textlesslib/textless/vocoders/hifigan/generator.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import Conv1d, ConvTranspose1d
  from torch.nn.utils import remove_weight_norm, weight_norm
  from .resblock import ResBlock, init_weights, LRELU_SLOPE
label_desc: Use image node_id 1 to create a new CodeGenerator object from inherited base classes: Generator with example: obj = CodeGenerator(cfg)