def _get_generated_ngrams(hypo_idx):
            """Before decoding the next token, prevent decoding of ngrams that have already appeared"""
            ngram_index = tuple(prev_output_tokens[hypo_idx, step + 2 - no_repeat_ngram_size : step + 1].tolist())
            return gen_ngrams[hypo_idx].get(ngram_index, [])
Before decoding the next token, prevent decoding of ngrams that have already appeared
xtune/src/transformers/modeling_bart.py