
    ^je                        d dl Z d dlmZ d dlmZ d dlZd dlmZ ddlmZ	 ddl
mZ ddlmZmZ dd	lmZ dd
lmZmZmZ ddlmZ ddlmZmZmZmZ ddlmZmZ ddlm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddl'm(Z(m)Z)m*Z* ddl+m,Z,m-Z- ddl.m/Z/ ddl0m1Z1  G d dejd                        Z3 G d dejd                        Z4d Z5 ed      d?d       Z6dejn                  de8dejn                  fd Z9	 d@d!ejd                  d"ejn                  d#ejn                  d$ejn                  d%ejn                  dz  d&e:d'e:d(e&e(   fd)Z;d* Z< ee6       G d+ d,ejd                               Z= ed-       G d. d/ejd                               Z> G d0 d1e      Z?e) G d2 d3e$             Z@e) G d4 d5e@             ZAe) G d6 d7e@e             ZB G d8 d9ee@      ZC G d: d;ee@      ZD G d< d=ee@      ZEg d>ZFy)A    N)Callable)Optional)nn   )initialization)ACT2FN)CacheDynamicCache)GenerationMixin)use_kernel_forward_from_hubuse_kernel_func_from_hubuse_kernelized_func)create_causal_mask)GenericForQuestionAnswering GenericForSequenceClassificationGenericForTokenClassificationGradientCheckpointingLayer)BaseModelOutputWithPastCausalLMOutputWithPast)ROPE_INIT_FUNCTIONSdynamic_rope_update)ALL_ATTENTION_FUNCTIONSPreTrainedModel)Unpack)TransformersKwargsauto_docstringcan_return_tuple)maybe_autocastmerge_with_config_defaults)capture_outputs   )DiffLlamaConfigc                   $     e Zd Z fdZd Z xZS )DiffLlamaMLPc                    t         |           || _        |j                  | _        |j                  | _        t        j                  | j                  | j                  d      | _        t        j                  | j                  | j                  d      | _        t        j                  | j                  | j                  d      | _	        t        |j                     | _        y NFbias)super__init__confighidden_sizeintermediate_sizer   Linear	gate_projup_proj	down_projr   
hidden_actact_fnselfr+   	__class__s     {/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/transformers/models/diffllama/modeling_diffllama.pyr*   zDiffLlamaMLP.__init__5   s    !--!'!9!94#3#3T5K5KRWXyy!1!143I3IPUV4#9#94;K;KRWXV../    c                     | j                  | j                  | j                  |            | j                  |      z        }|S N)r1   r3   r/   r0   )r5   xr1   s      r7   forwardzDiffLlamaMLP.forward?   s6    NN4;;t~~a/@#ADLLQRO#ST	r8   )__name__
__module____qualname__r*   r<   __classcell__r6   s   @r7   r$   r$   4   s    0r8   r$   c                        e Zd ZU ej                  ed<   ddef fdZe	 	 	 ddedz  de	d   de
dz  ded	ef   fd
       Z ej                         ed               Z xZS )DiffLlamaRotaryEmbeddinginv_freqNr+   c                    t         |           |j                  | _        |j                  | _        || _        | j
                  j                  d   | _        | j                  }| j                  dk7  rt        | j                     } || j
                  |      \  }| _
        | j                  d|d       | j                  d|j                         d       y )N	rope_typedefaultrD   F)
persistentoriginal_inv_freq)r)   r*   max_position_embeddingsmax_seq_len_cachedoriginal_max_seq_lenr+   rope_parametersrF   compute_default_rope_parametersr   attention_scalingregister_bufferclone)r5   r+   devicerope_init_fnrD   r6   s        r7   r*   z!DiffLlamaRotaryEmbedding.__init__G   s    "("@"@$*$B$B!44[A!%!E!E>>Y&.t~~>L+7V+L($(ZeD0(..2BuUr8   rR   ztorch.deviceseq_lenreturnztorch.Tensorc                    | j                   d   }t        | dd      xs | j                  | j                  z  }d}d|t	        j
                  d|dt        j                        j                  |t        j                        |z  z  z  }||fS )	a  
        Computes the inverse frequencies according to the original RoPE implementation
        Args:
            config ([`~transformers.PreTrainedConfig`]):
                The model configuration.
            device (`torch.device`):
                The device to use for initialization of the inverse frequencies.
            seq_len (`int`, *optional*):
                The current sequence length. Unused for this type of RoPE.
        Returns:
            Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
            post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
        
rope_thetahead_dimNg      ?r      dtype)rR   r[   )	rM   getattrr,   num_attention_headstorcharangeint64tofloat)r+   rR   rT   basedimattention_factorrD   s          r7   rN   z8DiffLlamaRotaryEmbedding.compute_default_rope_parametersW   s    & %%l3fj$/c63E3EIcIc3c U\\!S!5;;?BB&X]XcXcBdgjjk
 )))r8   c                 N   | j                   d d d d f   j                         j                  |j                  d   dd      j	                  |j
                        }|d d d d d f   j                         }t        |j
                  j                  t              r/|j
                  j                  dk7  r|j
                  j                  nd}t        |d      5  |j                         |j                         z  j                  dd      }t        j                  ||fd	      }|j                         | j                  z  }|j                         | j                  z  }	d d d        j	                  |j                   
      	j	                  |j                   
      fS # 1 sw Y   AxY w)Nr   r!   mpscpuF)device_typeenabledrY   rd   rZ   )rD   rb   expandshapera   rR   
isinstancetypestrr   	transposer^   catcosrO   sinr[   )
r5   r;   position_idsinv_freq_expandedposition_ids_expandedrj   freqsembrt   ru   s
             r7   r<   z DiffLlamaRotaryEmbedding.forwardu   sR    !MM$4-8>>@GGHZHZ[\H]_acdehhijiqiqr ,QaZ 8 > > @'1!((--'E!((--[`J`ahhmmfkUC 	5&,,.1F1L1L1NNYYZ[]^_E))UEN3C'')d444C'')d444C		5 vvAGGv$cff177f&;;;	5 	5s   BFF$r:   )NNN)r=   r>   r?   r^   Tensor__annotations__r"   r*   staticmethodr   inttuplerb   rN   no_gradr   r<   r@   rA   s   @r7   rC   rC   D   s    llV V  )-+/"*$&*(* t* 
~u$	%	* *: U]]_<  <r8   rC   c                     | dd| j                   d   dz  f   }| d| j                   d   dz  df   }t        j                  | |fd      S )z*Rotates half the hidden dims of the input..Nrg   rY   rl   )rn   r^   rs   )r;   x1x2s      r7   rotate_halfr      sZ    	
3"!''"+"""	#B	
3q ""	#B99rc2YB''r8   rotary_pos_embc                     |j                  |      }|j                  |      }| |z  t        |       |z  z   }||z  t        |      |z  z   }||fS )a  Applies Rotary Position Embedding to the query and key tensors.

    Args:
        q (`torch.Tensor`): The query tensor.
        k (`torch.Tensor`): The key tensor.
        cos (`torch.Tensor`): The cosine part of the rotary embedding.
        sin (`torch.Tensor`): The sine part of the rotary embedding.
        unsqueeze_dim (`int`, *optional*, defaults to 1):
            The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
            sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
            that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
            k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
            cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
            the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
    Returns:
        `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
    )	unsqueezer   )qkrt   ru   unsqueeze_dimq_embedk_embeds          r7   apply_rotary_pos_embr      sY    & --
&C
--
&C3w;q>C/0G3w;q>C/0GGr8   hidden_statesn_reprU   c                     | j                   \  }}}}|dk(  r| S | dddddddddf   j                  |||||      } | j                  |||z  ||      S )z
    This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
    num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
    r!   N)rn   rm   reshape)r   r   batchnum_key_value_headsslenrX   s         r7   	repeat_kvr      so    
 2?1D1D.Ehz!!Qa"23::5BUW\^bdlmM  (;e(CT8TTr8   modulequerykeyvalueattention_maskscalingdropoutkwargsc                    t        || j                        }t        || j                        }	t        j                  ||j	                  dd            |z  }
||
|z   }
t
        j                  j                  |
dt        j                        j                  |j                        }
t
        j                  j                  |
|| j                        }
t        j                  |
|	      }|j	                  dd      j                         }||
fS )NrY   r   rg   rd   r[   )ptrainingr!   )r   num_key_value_groupsr^   matmulrr   r   
functionalsoftmaxfloat32ra   r[   r   r   
contiguous)r   r   r   r   r   r   r   r   
key_statesvalue_statesattn_weightsattn_outputs               r7   eager_attention_forwardr      s     3 ; ;<JUF$?$?@L<<z';';Aq'ABWLL!#n4==((2U]](SVVW\WbWbcL==((6??([L,,|\:K''1-88:K$$r8   c                 >    ddt        j                  d| z        z  z
  S )Ng?g333333?g333333ӿ)mathexp)	layer_idxs    r7   lambda_init_fnr      s     txxy 01111r8   c                        e Zd ZdZddededz  f fdZ	 	 ddej                  de	ej                  ej                  f   dej                  dz  d	e
dz  d
e	ej                  ej                  f   f
dZ xZS )DiffLlamaAttentionu  Multi-headed differential attention (https://huggingface.co/papers/2410.05258).

    Computes ``(softmax(Q1 K1ᵀ) - λ · softmax(Q2 K2ᵀ)) · V`` as two standard attention calls
    sharing Q and K over the two halves of V. The two-call structure is ~30% faster than the
    V-doubling shortcut at production shapes, since asymmetric V (``head_dim_v != head_dim_q``)
    forces SDPA off Flash/cuDNN onto the memory-efficient/math kernel; Flash Attention 2 also
    requires ``head_dim_v == head_dim_q``.
    Nr+   r   c                    t         |           || _        || _        t	        |d|j
                  |j                  z        | _        |j                  |j                  z  | _	        | j                  dz  | _
        |j                  | _        d| _        t        j                  |j
                  |j                  | j                  z  |j                        | _        t        j                  |j
                  |j                  | j                  z  |j                        | _        t        j                  |j
                  |j                  | j                  z  |j                        | _        t        j                  |j                  | j                  z  |j
                  |j                        | _        |j                  dkD  rt)        d      |j                  |j                  dz  dk7  rt)        d	|j                   d
      t+        |      | _        t        j.                  t1        j2                  d|j4                  | j                  f            | _        t        j.                  t1        j2                  d|j4                  | j                  f            | _        t        j.                  t1        j2                  d|j4                  | j                  f            | _        t        j.                  t1        j2                  d|j4                  | j                  f            | _        t        j>                  d| j                  z  |j@                  d      | _!        y )NrX   g      Tr'           zDiffLlama does not support `attention_dropout > 0`: the differential attention mechanism has no paper-defined dropout semantics.rY   r   zDiffLlama requires `num_key_value_heads` to be even (and at least 2): the two-call differential attention splits the value tensor along KV heads, got .)sizeF)epselementwise_affine)"r)   r*   r+   r   r\   r,   r]   rX   r   r   r   attention_dropout	is_causalr   r.   attention_biasq_projk_projv_projo_proj
ValueErrorr   lambda_init	Parameterr^   normallambda_std_dev	lambda_q1	lambda_k1	lambda_q2	lambda_k2RMSNormrms_norm_eps	groupnormr5   r+   r   r6   s      r7   r*   zDiffLlamaAttention.__init__   s   "
F4F4F&JdJd4de$*$>$>&B\B\$\!}}d*!'!9!9ii : :T]] JQWQfQf
 ii : :T]] JQWQfQf
 ii : :T]] JQWQfQf
 ii&&68J8JQWQfQf
 ##c)D  %%-1K1Ka1OST1TVV\VpVpUqqrt  *)4ell1f6K6KSWS`S`Rb&cdell1f6K6KSWS`S`Rb&cdell1f6K6KSWS`S`Rb&cdell1f6K6KSWS`S`Rb&cdA$56;N;Nchir8   r   position_embeddingsr   past_key_valuesrU   c                    |j                   d d }g |d| j                  }| j                  |      j                  |      j	                  dd      }| j                  |      j                  |      j	                  dd      }	| j                  |      j                  |      j	                  dd      }
|\  }}t        ||	||      \  }}	| |j                  |	|
| j                        \  }	}
d t        j                  |
dd      D        \  }}t        j                  | j                  j                  t               } || ||	||fd| j"                  d|\  }} || ||	||fd| j"                  d|\  }}t        j$                  ||gd      }t        j                  |dd      \  }}t        j&                  t        j(                  | j*                  | j,                  z  dt        j.                              j1                  |j2                        }t        j&                  t        j(                  | j4                  | j6                  z  dt        j.                              j1                  |j2                        }||z
  | j8                  z   }|||z  z
  }d| j8                  z
  | j;                  |      z  } |j<                  g |d }| j?                  |      }||fS )	Nrg   r!   rY   c              3   D   K   | ]  }|j                  d dd d         yw)r!   rY   N)repeat).0vs     r7   	<genexpr>z-DiffLlamaAttention.forward.<locals>.<genexpr>  s     'jAq!(<'js    rl   r   )r   r   r   ) rn   rX   r   viewrr   r   r   r   updater   r^   chunkr   get_interfacer+   _attn_implementationr   r   rs   r   sumr   r   r   ra   r[   r   r   r   r   r   r   )r5   r   r   r   r   r   input_shapehidden_shapequery_statesr   r   rt   ru   value_states1value_states2attention_interfaceattn_output1r   attn_output2_r   lambda_1lambda_2lambda_fulls                           r7   r<   zDiffLlamaAttention.forward  s    $))#2.88b8$--8{{=166|DNNqRST[[/44\BLLQPQR
{{=166|DNNqRST&S#7jRUWZ#[ j&'6'='=j,X\XfXf'g$J (kekkR^`aghFi'j$}(?(M(MKK,,.E)
 &9	&
 LL	&
 	&
"l .	
 LL	
 	
a ii| <"E &+[[aQ%G"l99UYYt~~'FBV[VcVcdehh
 99UYYt~~'FBV[VcVcdehh
 )D,<,<<"[<%??4+++t~~k/JJ)k));;;;kk+.L((r8   r:   )NN)r=   r>   r?   __doc__r"   r~   r*   r^   r{   r   r	   r<   r@   rA   s   @r7   r   r      s    +j +j3: +jb /3(,C)||C) #5<<#=>C) t+	C)
 C) 
u||U\\)	*C)r8   r   r   c                   h     e Zd Zddeddf fdZdej                  dej                  fdZd Z xZ	S )	DiffLlamaRMSNormr   rU   Nc                     t         |           t        j                  t	        j
                  |            | _        || _        y)z?
        DiffLlamaRMSNorm is equivalent to T5LayerNorm
        N)r)   r*   r   r   r^   onesweightvariance_epsilon)r5   r,   r   r6   s      r7   r*   zDiffLlamaRMSNorm.__init__O  s1     	ll5::k#:; #r8   r   c                 "   |j                   }|j                  t        j                        }|j	                  d      j                  dd      }|t        j                  || j                  z         z  }| j                  |j                  |      z  S )NrY   rg   T)keepdim)	r[   ra   r^   r   powmeanrsqrtr   r   )r5   r   input_dtypevariances       r7   r<   zDiffLlamaRMSNorm.forwardW  sy    #))%((7 $$Q',,R,>%Ht?T?T4T(UU{{]--k:::r8   c                 ^    t        | j                  j                         d| j                   S )Nz, eps=)r   r   rn   r   )r5   s    r7   
extra_reprzDiffLlamaRMSNorm.extra_repr^  s*    ))*+6$2G2G1HIIr8   )gư>)
r=   r>   r?   rb   r*   r^   r{   r<   r   r@   rA   s   @r7   r   r   M  s7    $ $$ $;U\\ ;ell ;Jr8   r   c                       e Zd Zdedef fdZ	 	 	 	 	 ddej                  dej                  dz  dej                  dz  de	dz  d	e
dz  d
eej                  ej                  f   dz  dee   dej                  fdZ xZS )DiffLlamaDecoderLayerr+   r   c                     t         |           |j                  | _        t        ||      | _        t        |      | _        t        |j                  |j                        | _	        t        |j                  |j                        | _
        y )N)r+   r   r   )r)   r*   r,   r   	self_attnr$   mlpr   r   input_layernormpost_attention_layernormr   s      r7   r*   zDiffLlamaDecoderLayer.__init__c  sm    !--+6YO'/0B0BH[H[\(89K9KQWQdQd(e%r8   Nr   r   rv   r   	use_cacher   r   rU   c           
          |}| j                  |      } | j                  d||||||d|\  }}	||z   }|}| j                  |      }| j                  |      }||z   }|S )N)r   r   rv   r   r   r    )r   r   r   r   )
r5   r   r   rv   r   r   r   r   residualr   s
             r7   r<   zDiffLlamaDecoderLayer.forwardm  s     !,,];)4>> 
')%+ 3
 
q !=0 !55mD/ =0r8   )NNNFN)r=   r>   r?   r"   r~   r*   r^   r{   
LongTensorr	   boolr   r   r   r<   r@   rA   s   @r7   r   r   b  s    f f3 f /304(,!&HL|| t+ &&-	
  $; #5<<#=>E +, 
r8   r   c                        e Zd ZU eed<   dZdZdgZdgZdZ	dZ
dZdZdZeedZ ej$                          fd       Z xZS )DiffLlamaPreTrainedModelr+   modelTr   r   )r   
attentionsc                    t         |   |       t        |t              rt	        j
                  |j                  d| j                  j                         t	        j
                  |j                  d| j                  j                         t	        j
                  |j                  d| j                  j                         t	        j
                  |j                  d| j                  j                         y y )Nr   )r)   _init_weightsro   r   initnormal_r   r+   r   r   r   r   )r5   r   r6   s     r7   r  z&DiffLlamaPreTrainedModel._init_weights  s    f%f01LL))1dkk.H.HILL))1dkk.H.HILL))1dkk.H.HILL))1dkk.H.HI	 2r8   )r=   r>   r?   r"   r|   base_model_prefixsupports_gradient_checkpointing_no_split_modules_skip_keys_device_placement_supports_flash_attn_supports_sdpa_supports_flex_attn_can_compile_fullgraph_supports_attention_backendr   r   _can_record_outputsr^   r   r  r@   rA   s   @r7   r  r    sp    &*#01#4"5N!"&.(
 U]]_J Jr8   r  c                        e Zd Zdef fdZeee	 	 	 	 	 	 ddej                  dz  dej                  dz  dej                  dz  dedz  dej                  dz  d	edz  d
ee   defd                     Z xZS )DiffLlamaModelr+   c           	         t         |   |       |j                  | _        |j                  | _        t        j                  |j                  |j                  | j                        | _        t        j                  t        |j                        D cg c]  }t        ||       c}      | _        t        |j                  |j                        | _        t#        |      | _        d| _        | j)                          y c c}w )Nr   r+   F)r)   r*   pad_token_idpadding_idx
vocab_sizer   	Embeddingr,   embed_tokens
ModuleListrangenum_hidden_layersr   layersr   r   normrC   
rotary_embgradient_checkpointing	post_initr   s      r7   r*   zDiffLlamaModel.__init__  s     !.. ++LL):):F<N<NPTP`P`ammGLVMeMeGfg)"695g
 %V%7%7V=P=PQ	2&A&+# 	 hs   DN	input_idsr   rv   r   inputs_embedsr   r   rU   c           
      <   |d u |d uz  rt        d      || j                  |      }|r|t        | j                        }|V||j	                         nd}t        j                  |j                  d   |j                        |z   }|j                  d      }t        | j                  ||||      }	|}
| j                  |
|      }| j                  d | j                  j                   D ]  } ||
f|	||||d|}
 | j                  |
      }
t        |
|	      S )
Nz:You must specify exactly one of input_ids or inputs_embedsr  r   r!   )rR   )r+   r*  r   r   rv   )rv   )r   r   rv   r   r   )last_hidden_stater   )r   r   r
   r+   get_seq_lengthr^   r_   rn   rR   r   r   r&  r$  r#  r%  r   )r5   r)  r   rv   r   r*  r   r   past_seen_tokenscausal_maskr   r   decoder_layers                r7   r<   zDiffLlamaModel.forward  sL    -t";<YZZ *.*;*;I*FM0*$++>OCRC^==?de <<(;(;A(>}G[G[\_ooL'11!4L(;;')+%
 &"oom,oW![[)H4;;+H+HI 		M)*$7) /# M		 		-0&++
 	
r8   )NNNNNN)r=   r>   r?   r"   r*   r   r    r   r^   r  r{   r	   FloatTensorr  r   r   r   r<   r@   rA   s   @r7   r  r    s         .2.204(,26!%2
##d*2
 t+2
 &&-	2

 2
 ((4/2
 $;2
 +,2
 
!2
    2
r8   r  c                   B    e Zd ZddiZddiZddgdgfiZ fdZee	 	 	 	 	 	 	 	 dd	e	j                  dz  d
e	j                  dz  de	j                  dz  dedz  de	j                  dz  de	j                  dz  dedz  dee	j                  z  dee   defd              Z xZS )DiffLlamaForCausalLMzlm_head.weightzmodel.embed_tokens.weightlm_headcolwise_gather_outputr   logitsc                     t         |   |       t        |      | _        |j                  | _        t        j                  |j                  |j                  d      | _        | j                          y r&   )
r)   r*   r  r  r  r   r.   r,   r4  r(  r4   s     r7   r*   zDiffLlamaForCausalLM.__init__  sU     #F+
 ++yy!3!3V5F5FUS 	r8   Nr)  r   rv   r   r*  labelsr   logits_to_keepr   rU   c	           
      x    | j                   d||||||d|	}
|
j                  }t        |t              rt	        | d      n|}| j                  |dd|ddf         }d}|* | j                  d||| j                  j                  d|	}t        |||
j                  |
j                  |
j                        S )a  
        Example:

        ```python
        >>> from transformers import AutoTokenizer, DiffLlamaForCausalLM

        >>> model = DiffLlamaForCausalLM.from_pretrained("google/diffllama-7b")
        >>> tokenizer = AutoTokenizer.from_pretrained("google/diffllama-7b")

        >>> prompt = "What is your favorite condiment?"
        >>> inputs = tokenizer(prompt, return_tensors="pt")

        >>> # Generate
        >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
        >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
        "What is your favorite condiment?"
        ```)r)  r   rv   r   r*  r   N)r6  r8  r  )lossr6  r   r   r	  r  )r  r,  ro   r~   slicer4  loss_functionr+   r  r   r   r   r	  )r5   r)  r   rv   r   r*  r8  r   r9  r   outputsr   slice_indicesr6  r;  s                  r7   r<   zDiffLlamaForCausalLM.forward  s    > ,64:: ,
)%+',
 ,
  118B>SV8W~ot4]kmA}a,?@A%4%%pVFt{{OeOepiopD%#33!//))
 	
r8   )NNNNNNNr   )r=   r>   r?   _tied_weights_keys_tp_plan_pp_planr*   r   r   r^   r  r{   r	   r1  r  r~   r   r   r   r<   r@   rA   s   @r7   r3  r3    s   *,GH23H_-z:;H  .2.204(,26*.!%-.6
##d*6
 t+6
 &&-	6

 6
 ((4/6
   4'6
 $;6
 ell*6
 +,6
 
 6
  6
r8   r3  c                       e Zd Zy)"DiffLlamaForSequenceClassificationNr=   r>   r?   r  r8   r7   rD  rD  =      r8   rD  c                       e Zd ZdZy)DiffLlamaForQuestionAnsweringtransformerN)r=   r>   r?   r  r  r8   r7   rH  rH  A  s    %r8   rH  c                       e Zd Zy)DiffLlamaForTokenClassificationNrE  r  r8   r7   rK  rK  E  rF  r8   rK  )r  r  r3  rD  rH  rK  )r!   )r   )Gr   collections.abcr   typingr   r^   r    r   r  activationsr   cache_utilsr	   r
   
generationr   integrationsr   r   r   masking_utilsr   modeling_layersr   r   r   r   modeling_outputsr   r   modeling_rope_utilsr   r   modeling_utilsr   r   processing_utilsr   utilsr   r   r   utils.genericr   r   utils.output_capturingr    configuration_diffllamar"   Moduler$   rC   r   r   r{   r~   r   rb   r   r   r   r   r   r  r  r3  rD  rH  rK  __all__r  r8   r7   <module>r_     s(  .  $    & ! . ) f f /  P K F & I I G 5 4299  ><ryy ><B( *+ ,2	UU\\ 	U# 	U%,, 	U& %II%<<% 
% <<	%
 LL4'% % % '(%22 )*z) z) +z)z Y'Jryy J (J((6 (V J J J6 F
- F
 F
R F
3_ F
 F
R	)IKc 	&$?AY &	&CE] 	r8   