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 training_step(self, batch, batch_idx):
      content_embedding = batch["content_embedding"]
      encoded_len = batch["encoded_len"]
      speaker_embedding = batch["speaker_embedding"]
      mels = batch["mel_spectrogram"]
      pitch = batch["pitch_contour"]
      dataset_id = batch["dataset_id"]
      durs = batch["duration"]
  
      enc_out = self.compute_encoding(
          content_embedding, speaker_embedding, dataset_id
      )
      if self.use_encoder:
          enc_out, _ = self.encoder(input=enc_out, seq_lens=encoded_len)
  
      enc_mask = mask_from_lens(encoded_len)
      enc_mask = enc_mask[:, :, None]
  
      mels_pred, _, _, log_durs_pred, pitch_pred, pitch = self(
          enc_out=enc_out,
          enc_mask=enc_mask,
          durs=durs,
          pitch=pitch,
          pace=1.0,
      )
  
      loss = 0
      mel_loss = self.mel_loss(
          spect_predicted=mels_pred, spect_tgt=mels
      )
      loss += mel_loss
      if self.use_duration_predictor:
          dur_loss = self.duration_loss(
              log_durs_predicted=log_durs_pred,
              durs_tgt=durs,
              len=encoded_len,
          )
          self.log("t_dur_loss", dur_loss)
          loss += dur_loss
  
      if self.pitch_conditioning:
          pitch_loss = self.pitch_loss(
              pitch_predicted=pitch_pred,
              pitch_tgt=pitch,
              len=encoded_len,
          )
          loss += pitch_loss
          self.log("t_pitch_loss", pitch_loss)
  
      self.log("t_loss", loss)
      self.log("t_mel_loss", mel_loss)
  
      # Log images to tensorboard
      if self.log_train_images and isinstance(
          self.logger, TensorBoardLogger
      ):
          self.log_train_images = False
  
          self.tb_logger.add_image(
              "train_mel_target",
              plot_spectrogram_to_numpy(
                  mels[0].data.cpu().float().numpy()
              ),
              self.global_step,
              dataformats="HWC",
          )
          spec_predict = mels_pred[0].data.cpu().float().numpy()
          self.tb_logger.add_image(
              "train_mel_predicted",
              plot_spectrogram_to_numpy(spec_predict),
              self.global_step,
              dataformats="HWC",
          )
  
      return loss
  
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 6 for calling the FastPitchModel_SSL obj's underlying member method code with example usage: obj.training_step(batch, batch_idx) and returns: loss