code: def _prepare_decoder_attention_mask_inference(
      self,
      attention_mask,
      input_shape,
      inputs_embeds,
      past_key_values_length,
  ):
      # [bsz, seq_len]
      if past_key_values_length > 0 and attention_mask is not None:
          attention_mask = torch.cat(
              (
                  torch.full(
                      (input_shape[0], past_key_values_length),
                      True,
                      dtype=attention_mask.dtype,
                      device=attention_mask.device,
                  ),
                  attention_mask,
              ),
              dim=-1,
          )
  
      if attention_mask is not None and torch.all(attention_mask):
          return None
  
file_path: llama-vid/llamavid/train/llama_flash_attn_monkey_patch.py
imports: from typing import Optional, Tuple
  import warnings
  import torch
  import transformers
  from transformers.models.llama.modeling_llama import apply_rotary_pos_emb, repeat_kv, rotate_half
  from flash_attn.bert_padding import unpad_input, pad_input
  from flash_attn import __version__
  from flash_attn.flash_attn_interface import flash_attn_func, flash_attn_varlen_kvpacked_func
label_desc: Use image node_id 5 for calling a global function with example usage: _prepare_decoder_attention_mask_inference(attention_mask, input_shape, inputs_embeds, past_key_values_length) and returns: None