def METHOD_NAME(
    cls, task, model, generator, sample, tgt_lang=None, synthesize_speech=False
) -> Union[str, Tuple[str, Tuple[torch.Tensor, int]]]:
    _tgt_lang = tgt_lang or task.data_cfg.hub.get("tgt_lang", None)
    prefix = cls.get_prefix_token(task, _tgt_lang)
    pred_tokens = generator.generate([model], sample, prefix_tokens=prefix)
    pred = cls.detokenize(task, pred_tokens[0][0]["tokens"])
    if synthesize_speech:
        pfx = f"{_tgt_lang}_" if task.data_cfg.prepend_tgt_lang_tag else ""
        tts_model_id = task.data_cfg.hub.get(f"{pfx}tts_model_id", None)
        if tts_model_id is None:
            logger.warning("TTS model configuration not found")
        else:
            _repo, _id = tts_model_id.split(":")
            tts_model = torch.hub.load(_repo, _id, verbose=False)
            pred = (pred, tts_model.predict(pred))
    return pred