class_docstr: GPTBigCode flash attention module. This module inherits from `GPTBigCodeAttention` as the weights of the module
  stays untouched. The only required change would be on the forward pass where it needs to correctly call the public
  API of flash attention and deal with padding tokens in case the input contains any of them.
class_docstr_tok: ["GPTBigCode","flash","attention","module",".","This","module","inherits","from","`","GPTBigCodeAttention","`","as","the","weights","of","the","module","stays","untouched",".","The","only","required","change","would","be","on","the","forward","pass","where","it","needs","to","correctly","call","the","public","API","of","flash","attention","and","deal","with","padding","tokens","in","case","the","input","contains","any","of","them","."]
code: def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)
  
      # TODO: Should be removed once Flash Attention for RoCm is bumped to 2.1.
      # flash_attn<2.1 generates top-left aligned causal mask, while what is needed here is bottom-right alignement, that was made default for flash_attn>=2.1. This attribute is used to handle this difference. Reference: https://github.com/Dao-AILab/flash-attention/releases/tag/v2.1.0.
      # Beware that with flash_attn<2.1, using q_seqlen != k_seqlen (except for the case q_seqlen == 1) produces a wrong mask (top-left).
      self._flash_attn_uses_top_left_mask = (
          not is_flash_attn_greater_or_equal_2_10()
      )
  
imports: import math
  from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_attn_mask_utils import AttentionMaskConverter
  from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, SequenceClassifierOutputWithPast, TokenClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, is_flash_attn_2_available, is_flash_attn_greater_or_equal_2_10, logging
  from .configuration_gpt_bigcode import GPTBigCodeConfig
label_desc: Use image node_id 1 to create a new GPTBigCodeFlashAttention2 object from inherited base classes: GPTBigCodeAttention with example: obj = GPTBigCodeFlashAttention2()