def compute_metrics(self, metric_type, dataset, repeat=None):
        """Generic function to compute metrics ignoring the io processing time"""
        if self.vocoder and not self.vocoder_input:
            self.s2u_output = self.generate_s2u_outputs(dataset)
            self.vocoder_input = self.vocoder.generate_vocoder_input(self.s2u_output)

        s2u_metrics = getattr(self.s2u, metric_type)(
            dataset,
            repeat,
        )
        vocoder_metrics = 0
        if self.vocoder:
            vocoder_metrics = getattr(self.vocoder, metric_type)(
                self.vocoder_input,
                repeat,
            )
        print(
            f"metric_type = {metric_type} s2u_metrics = {s2u_metrics} \t vocoder_metrics = {vocoder_metrics}"
        )
        if metric_type == "max_memory":
            return max(s2u_metrics, vocoder_metrics)
        else:
            return s2u_metrics + vocoder_metrics
Generic function to compute metrics ignoring the io processing time
understand_icl/fairseq/examples/speech_to_speech/benchmarking/core.py