class_docstr: Class that manages the training loop. See speechbrain.core.Brain.
  
  Arguments
  ---------
  modules : dict of str:torch.nn.Module pairs
      These modules are passed to the optimizer by default if they have
      trainable parameters, and will have ``train()``/``eval()`` called on them.
  opt_class : torch.optim class
      A torch optimizer constructor that takes only the list of
      parameters (e.g. a lambda or partial function definition). By default,
      this will be passed all modules in ``modules`` at the
      beginning of the ``fit()`` method. This behavior can be changed
      by overriding the ``configure_optimizers()`` method.
  hparams : dict
      Each key:value pair should consist of a string key and a hyperparameter
      that is used within the overridden methods. These will
      be accessible via an ``hparams`` attribute, using "dot" notation:
      e.g., self.hparams.model(x).
  run_opts : dict
      A set of options to change the runtime environment.
class_docstr_tok: ["Class","that","manages","the","training","loop",".","See","speechbrain.core.Brain",".","Arguments","--","--","--","--","-","modules",":","dict","of","str",":","torch.nn.Module","pairs","These","modules","are","passed","to","the","optimizer","by","default","if","they","have","trainable","parameters",",","and","will","have","``","train","(",")","``","\/","``","eval","(",")","``","called","on","them",".","opt_class",":","torch.optim","class","A","torch","optimizer","constructor","that","takes","only","the","list","of","parameters","(","e.g",".","a","lambda","or","partial","function","definition",")",".","By","default",",","this","will","be","passed","all","modules","in","``","modules","``","at","the","beginning","of","the","``","fit","(",")","``","method",".","This","behavior","can","be","changed","by","overriding","the","``","configure_optimizers","(",")","``","method",".","hparams",":","dict","Each","key",":","value","pair","should","consist","of","a","string","key","and","a","hyperparameter","that","is","used","within","the","overridden","methods",".","These","will","be","accessible","via","an","``","hparams","``","attribute",",","using","``","dot","''","notation",":","e.g.",",","self.hparams.model","(","x",")",".","run_opts",":","dict","A","set","of","options","to","change","the","runtime","environment","."]
docstr: Prepares features for the done detector (a concatenation of one sample
  and a random sample)
  
  Arguments
  ---------
  batch: PaddedBatch
      a single batch of data
  feats: torch.Tensor
      spectrogram features
  lens: torch.Tensor
      feature lengths
  
  Returns
  -------
  feats_done: torch.Tensor
      features for the done detector (a concatenation)
  lens_done: torch.Tensor
      relative lengths of these features
docstr_tok: ["Prepares","features","for","the","done","detector","(","a","concatenation","of","one","sample","and","a","random","sample",")","Arguments","--","--","--","--","-","batch",":","PaddedBatch","a","single","batch","of","data","feats",":","torch.Tensor","spectrogram","features","lens",":","torch.Tensor","feature","lengths","Returns","--","--","--","-","feats_done",":","torch.Tensor","features","for","the","done","detector","(","a","concatenation",")","lens_done",":","torch.Tensor","relative","lengths","of","these","features"]
code: def prepare_features_done(self, batch, feats, lens):
      """Prepares features for the done detector (a concatenation of one sample
      and a random sample)
  
      Arguments
      ---------
      batch: PaddedBatch
          a single batch of data
      feats: torch.Tensor
          spectrogram features
      lens: torch.Tensor
          feature lengths
  
      Returns
      -------
      feats_done: torch.Tensor
          features for the done detector (a concatenation)
      lens_done: torch.Tensor
          relative lengths of these features
  
      """
      wavs_random, lens_random = batch.sig_random
      feats_random, _, lens_random = self.sig_to_feats(
          wavs_random, lens_random
      )
      feats_done, lens_done = data_utils.concat_padded_features(
          feats=[feats, feats_random],
          lens=[lens, lens_random],
          feats_slice_start=[
              0.0,
              self.hparams.done_random_start_offset,
          ],
          feats_slice_end=[0.0, self.hparams.done_random_end_offset],
          dim=2,
      )
      return feats_done, lens_done
  
imports: import logging
  import sys
  import torch
  import speechbrain
  import os
  from collections import namedtuple
  from audiomnist_prepare import prepare_audiomnist
  from hyperpyyaml import load_hyperpyyaml
  from torchaudio import functional
  from speechbrain.dataio.dataio import length_to_mask, write_audio
  from speechbrain.dataio.dataset import apply_overfit_test
  from speechbrain.utils import data_utils
  from speechbrain.utils.train_logger import plot_spectrogram
  from enum import Enum
  from speechbrain.utils.distributed import run_on_main
  from speechbrain.utils.data_utils import dict_value_combinations, dist_stats, masked_mean, masked_min, masked_max, masked_std, match_shape
label_desc: Use image node_id 15 for calling the DiffusionBrain obj's underlying member method code with example usage: obj.prepare_features_done(batch, feats, lens) and returns: feats_done,  lens_done