class_docstr: FastPitch based model that can synthesize mel spectrograms from content and speaker embeddings
  obtained from SSLDisentangler. This model can be used for voice conversion by swapping the speaker embedding 
  of a given source utterance, with the speaker embedding of a target speaker.
class_docstr_tok: ["FastPitch","based","model","that","can","synthesize","mel","spectrograms","from","content","and","speaker","embeddings","obtained","from","SSLDisentangler",".","This","model","can","be","used","for","voice","conversion","by","swapping","the","speaker","embedding","of","a","given","source","utterance",",","with","the","speaker","embedding","of","a","target","speaker","."]
code: def __init__(
      self, cfg: DictConfig, trainer: Trainer = None, vocoder=None
  ):
      # Convert to Hydra 1.0 compatible DictConfig
      cfg = model_utils.convert_model_config_to_dict_config(cfg)
      cfg = model_utils.maybe_update_config_version(cfg)
  
      self.learn_alignment = False
  
      self._parser = None
      self._tb_logger = None
      super().__init__(cfg=cfg, trainer=trainer)
  
      self.bin_loss_warmup_epochs = cfg.get(
          "bin_loss_warmup_epochs", 100
      )
      self.log_train_images = False
  
      # Same defaults as FastPitch
      loss_scale = 0.1 if self.learn_alignment else 1.0
      dur_loss_scale = loss_scale
      pitch_loss_scale = loss_scale
      if "dur_loss_scale" in cfg:
          dur_loss_scale = cfg.dur_loss_scale
      if "pitch_loss_scale" in cfg:
          pitch_loss_scale = cfg.pitch_loss_scale
  
      self.mel_loss = MelLoss()
      self.pitch_loss = PitchLoss(loss_scale=pitch_loss_scale)
      self.duration_loss = DurationLoss(loss_scale=dur_loss_scale)
  
      input_fft = None
      self.use_encoder = use_encoder = cfg.get("use_encoder", False)
      if use_encoder:
          self.encoder = instantiate(self._cfg.encoder)
  
      output_fft = instantiate(self._cfg.output_fft)
  
      duration_predictor = None
      self.use_duration_predictor = cfg.get(
          "use_duration_predictor", False
      )
      if self.use_duration_predictor:
          assert (
              self.encoder is not None
          ), "use_encoder must be True if use_duration_predictor is True"
          # this means we are using unique tokens
          duration_predictor = instantiate(self._cfg.duration_predictor)
  
      self.pitch_conditioning = pitch_conditioning = cfg.get(
          "pitch_conditioning", True
      )
      if pitch_conditioning:
          pitch_predictor = instantiate(self._cfg.pitch_predictor)
      else:
          pitch_predictor = None
  
      self.content_projection_layer = torch.nn.Linear(
          self._cfg.content_emb_indim, self._cfg.content_emb_outdim
      )
      self.speaker_projection_layer = torch.nn.Linear(
          self._cfg.speaker_emb_indim, self._cfg.speaker_emb_outdim
      )
  
      self.num_datasets = cfg.get("n_datasets", 1)
      if self.num_datasets > 1:
          # Data ID conditioning if num_datasets > 1. During inference, can set data_id to be that of the cleaner dataset.
          # Maybe useful if we have clean and noisy datasets
          self.dataset_embedding_layer = torch.nn.Embedding(
              self.num_datasets, self._cfg.symbols_embedding_dim
          )
  
      self.fastpitch = FastPitchSSLModule(
          input_fft,
          output_fft,
          duration_predictor,
          pitch_predictor,
          cfg.symbols_embedding_dim,
          cfg.pitch_embedding_kernel_size,
          cfg.n_mel_channels,
      )
  
      self.non_trainable_models = {}
      self.non_trainable_models["vocoder"] = vocoder
  
imports: import random
  from typing import Iterable
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from pytorch_lightning.loggers import TensorBoardLogger
  from nemo.collections.tts.losses.fastpitchloss import DurationLoss, MelLoss, PitchLoss
  from nemo.collections.tts.modules.fastpitch import FastPitchSSLModule, average_features
  from nemo.collections.tts.modules.transformer import mask_from_lens
  from nemo.collections.tts.parts.utils.helpers import plot_multipitch_to_numpy, plot_spectrogram_to_numpy
  from nemo.core.classes import ModelPT
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging, model_utils
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 1 to create a new FastPitchModel_SSL object from inherited base classes: ModelPT with example: obj = FastPitchModel_SSL(cfg, trainer, vocoder)