    def _inference(self, eval_mel, eval_pitch=None, use_pitch=False):
        """Inference during training for test audios."""
        if use_pitch:
            eval_pitch = align_length(eval_pitch, eval_mel.shape[1])
            eval_audio = vocoder_inference(
                self.cfg,
                self.model,
                torch.from_numpy(eval_mel).unsqueeze(0),
                f0s=torch.from_numpy(eval_pitch).unsqueeze(0).float(),
                device=next(self.model.parameters()).device,
            ).squeeze(0)
        else:
            eval_audio = vocoder_inference(
                self.cfg,
                self.model,
                torch.from_numpy(eval_mel).unsqueeze(0),
                device=next(self.model.parameters()).device,
            ).squeeze(0)
        return eval_audio
Inference during training for test audios.
models/vocoders/diffusion/diffusion_vocoder_trainer.py