class_docstr: The Transformer decoder from GPT-2
  Args:
      num_layers (int): number of decoder layers.
      d_model (int): size of the model
      heads (int): number of heads
      d_ff (int): size of the inner FF layer
      copy_attn (bool): if using a separate copy attention
      self_attn_type (str): type of self-attention scaled-dot, scaled-dot-flash, average
      dropout (float): dropout in residual, self-attn(dot) and feed-forward
      attention_dropout (float): dropout in context_attn (and self-attn(avg))
      embeddings (onmt.modules.Embeddings):
          embeddings to use, should have positional encodings
      max_relative_positions (int):
          Max distance between inputs in relative positions representations
      relative_positions_buckets (int):
          Number of buckets when using Relative positions bias
      aan_useffn (bool): Turn on the FFN layer in the AAN decoder
      full_context_alignment (bool):
          whether enable an extra full context decoder forward for alignment
      alignment_layer (int): N° Layer to supervise with for alignment guiding
      alignment_heads (int):
          N. of cross attention heads to use for alignment guiding
      pos_ffn_activation_fn (ActivationFunction):
          activation function choice for PositionwiseFeedForward layer
      add_qkvbias (bool): whether to add bias to the Key/Value nn.Linear
      num_kv (int): number of heads for KV when different vs Q (multiquery)
      add_ffnbias (bool): whether to add bias to the FF nn.Linear
      parallel_residual (bool): Use parallel residual connections in each layer block, as used
          by the GPT-J and GPT-NeoX models
      shared_layer_norm (bool): When using parallel residual, share the input and post
          attention layer norms.
      layer_norm (string): type of layer normalization standard/rms
      norm_eps (float): layer norm epsilon
      use_ckpting (List): layers for which we checkpoint for backward
      parallel_gpu (int): Number of gpu for tensor parallelism
      sliding_window (int): Width of the band mask and KV cache (cf Mistral Model)
      rotary_interleave (bool): Interleave the head dimensions when rotary embeddings are applied
      rotary_theta (int): rotary base theta
      rotary_dim (int): in some cases the rotary dim is lower than head dim
      num_experts (int): Number of experts for MoE
      num_experts_per_tok (int): Number of experts choice per token
class_docstr_tok: ["The","Transformer","decoder","from","GPT-2","Args",":","num_layers","(","int",")",":","number","of","decoder","layers",".","d_model","(","int",")",":","size","of","the","model","heads","(","int",")",":","number","of","heads","d_ff","(","int",")",":","size","of","the","inner","FF","layer","copy_attn","(","bool",")",":","if","using","a","separate","copy","attention","self_attn_type","(","str",")",":","type","of","self-attention","scaled-dot",",","scaled-dot-flash",",","average","dropout","(","float",")",":","dropout","in","residual",",","self-attn","(","dot",")","and","feed-forward","attention_dropout","(","float",")",":","dropout","in","context_attn","(","and","self-attn","(","avg",")",")","embeddings","(","onmt.modules.Embeddings",")",":","embeddings","to","use",",","should","have","positional","encodings","max_relative_positions","(","int",")",":","Max","distance","between","inputs","in","relative","positions","representations","relative_positions_buckets","(","int",")",":","Number","of","buckets","when","using","Relative","positions","bias","aan_useffn","(","bool",")",":","Turn","on","the","FFN","layer","in","the","AAN","decoder","full_context_alignment","(","bool",")",":","whether","enable","an","extra","full","context","decoder","forward","for","alignment","alignment_layer","(","int",")",":","N\u00b0","Layer","to","supervise","with","for","alignment","guiding","alignment_heads","(","int",")",":","N.","of","cross","attention","heads","to","use","for","alignment","guiding","pos_ffn_activation_fn","(","ActivationFunction",")",":","activation","function","choice","for","PositionwiseFeedForward","layer","add_qkvbias","(","bool",")",":","whether","to","add","bias","to","the","Key\/Value","nn.Linear","num_kv","(","int",")",":","number","of","heads","for","KV","when","different","vs","Q","(","multiquery",")","add_ffnbias","(","bool",")",":","whether","to","add","bias","to","the","FF","nn.Linear","parallel_residual","(","bool",")",":","Use","parallel","residual","connections","in","each","layer","block",",","as","used","by","the","GPT-J","and","GPT-NeoX","models","shared_layer_norm","(","bool",")",":","When","using","parallel","residual",",","share","the","input","and","post","attention","layer","norms",".","layer_norm","(","string",")",":","type","of","layer","normalization","standard\/rms","norm_eps","(","float",")",":","layer","norm","epsilon","use_ckpting","(","List",")",":","layers","for","which","we","checkpoint","for","backward","parallel_gpu","(","int",")",":","Number","of","gpu","for","tensor","parallelism","sliding_window","(","int",")",":","Width","of","the","band","mask","and","KV","cache","(","cf","Mistral","Model",")","rotary_interleave","(","bool",")",":","Interleave","the","head","dimensions","when","rotary","embeddings","are","applied","rotary_theta","(","int",")",":","rotary","base","theta","rotary_dim","(","int",")",":","in","some","cases","the","rotary","dim","is","lower","than","head","dim","num_experts","(","int",")",":","Number","of","experts","for","MoE","num_experts_per_tok","(","int",")",":","Number","of","experts","choice","per","token"]
code: def detach_state(self):
      pass
  
imports: import torch
  import torch.nn
  from onmt.decoders.decoder import DecoderBase
  from onmt.modules import MultiHeadedAttention, AverageAttention
  from onmt.modules.position_ffn import PositionwiseFeedForward
  from onmt.modules.position_ffn import ActivationFunction
  from onmt.modules.moe import MoE
  from onmt.utils.misc import sequence_mask
  from onmt.modules.rmsnorm import RMSNorm
label_desc: Use image node_id 3 for calling the TransformerLMDecoder obj's underlying member method code with example usage: obj.detach_state() without return types