class_docstr: A logger that outputs samples during training progress, used primarily in speech synthesis but customizable, reusable and applicable to any other generative task
  
  Natively, this logger supports images and raw PyTorch output.
  Other custom formats can be added as needed.
  
  Example:
  
  In hparams.yaml
  progress_sample_logger: !new:speechbrain.utils.progress_samples.ProgressSampleLogger
      output_path: output/samples
      progress_batch_sample_size: 3
      format_defs:
          foo:
              extension: bar
              saver: !speechbrain.dataio.mystuff.save_my_format
              kwargs:
                  baz: qux
      formats:
          foobar: foo
  
  
  
  In the brain:
  
  Run the following to "remember" a sample (e.g. from compute_objectives)
  
  self.hparams.progress_sample_logger.remember(
      target=spectrogram_target,
      output=spectrogram_output,
      alignments=alignments_output,
      my_output=
      raw_batch={
          "inputs": inputs,
          "spectrogram_target": spectrogram_target,
          "spectrogram_output": spectrorgram_outputu,
          "alignments": alignments_output
      }
  )
  
  Run the following at the end of the epoch (e.g. from on_stage_end)
  self.progress_sample_logger.save(epoch)
  
  
  
  Arguments
  ---------
  output_path: str
      the filesystem path to which samples will be saved
  formats: dict
      a dictionary with format identifiers as keys and dictionaries with
      handler callables and extensions as values. The signature of the handler
      should be similar to torch.save
  
      Example:
      {
          "myformat": {
              "extension": "myf",
              "saver": somemodule.save_my_format
          }
      }
  batch_sample_size: int
      The number of items to retrieve when extracting a batch sample
docstr: Saves all items previously saved with remember() calls
  
  Arguments
  ---------
  epoch: int
      The epoch number
docstr_tok: ["Saves","all","items","previously","saved","with","remember","(",")","calls","Arguments","--","--","--","--","-","epoch",":","int","The","epoch","number"]
code: def save(self, epoch):
      """Saves all items previously saved with remember() calls
  
      Arguments
      ---------
      epoch: int
          The epoch number
      """
      for key, data in self.progress_samples.items():
          self.save_item(key, data, epoch)
  
imports: import logging
  import torch
  import os
  from speechbrain.utils.distributed import main_process_only, if_main_process
label_desc: Use image node_id 5 for calling the ProgressSampleLogger obj's underlying member method code with example usage: obj.save(epoch) without return types