def compute_metrics(self, metric_type, dataset, repeat=None):
        """Generic function to compute metrics ignoring the io processing time"""
        if not self.tts_inputs:
            s2t_outputs = self.generate_s2t_outputs(dataset)
            self.tts_inputs = self.generate_tts_inputs(s2t_outputs)

        s2t_metrics = getattr(self.s2t, metric_type)(
            dataset,
            repeat,
        )

        tts_metrics = getattr(self.tts, metric_type)(
            self.tts_inputs,
            repeat,
        )
        print(
            f"metric_type = {metric_type} s2t_metrics = {s2t_metrics} \t tts_metrics = {tts_metrics}"
        )
        if metric_type == "max_memory":
            return max(s2t_metrics, tts_metrics)
        else:
            return s2t_metrics + tts_metrics
Generic function to compute metrics ignoring the io processing time
structured_prompting/fairseq-version/fairseq/examples/speech_to_speech/benchmarking/core.py