From bac2ff40ffef1eec8cb7470964c435cea44048d3 Mon Sep 17 00:00:00 2001 From: Cheng-Ping Hsieh <37269846+hsiehjackson@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:28:00 -0700 Subject: [PATCH] Remove mask if use fusion mask (#9723) * Remove mask if use fusion mask Signed-off-by: Cheng-Ping Hsieh * Apply isort and black reformatting Signed-off-by: hsiehjackson --------- Signed-off-by: Cheng-Ping Hsieh Signed-off-by: hsiehjackson Co-authored-by: hsiehjackson Signed-off-by: tonyjie --- nemo/collections/nlp/modules/common/text_generation_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nemo/collections/nlp/modules/common/text_generation_utils.py b/nemo/collections/nlp/modules/common/text_generation_utils.py index 1bd5b618de35f..d4b67d3e3783f 100644 --- a/nemo/collections/nlp/modules/common/text_generation_utils.py +++ b/nemo/collections/nlp/modules/common/text_generation_utils.py @@ -794,6 +794,9 @@ def generate( if random_seed is not None: seed_everything(random_seed) + if hasattr(model, 'get_attention_mask_from_fusion') and model.get_attention_mask_from_fusion: + compute_attention_mask = False + output = synced_generate( model, inference_strategy,