+
    œ°³jùp ã                   óÔ  € R t ^ RIt^ RIHt ^ RIt^ RIHt ^ RIHtHtH	t	 ^RI
Ht ^RIHtHt ^RIHt ^RIHt ^R	IHtHt ^R
IHt ^RIHt ^RIHtHtHt ^RIH t  ]PB                  ! ]"4      t#]! RR7      ] ! R R]4      4       4       t$]! RR7      ] ! R R]4      4       4       t%]! RR7      ] ! R R]4      4       4       t&]! RR7      ] ! R R]4      4       4       t']! RR7      ] ! R R]4      4       4       t(]! RR7      ] ! R R]4      4       4       t)]! R R7      ] ! R! R"]4      4       4       t*]! R#R7      ] ! R$ R%]4      4       4       t+]! R&R7      ] ! R' R(]4      4       4       t,]! R)R7      ] ! R* R+]4      4       4       t- ! R, R-]P\                  4      t/ ! R. R/]P\                  4      t0 ! R0 R1]P\                  4      t1 ! R2 R3]P\                  4      t2 ! R4 R5]P\                  4      t3 ! R6 R7]P\                  4      t4 ! R8 R9]P\                  4      t5 ! R: R;]4      t6 ! R< R=]P\                  4      t7 ! R> R?]P\                  4      t8 ! R@ RA]P\                  4      t9 ! RB RC]P\                  4      t:] ! RD RE]4      4       t;]! RFR7       ! RG RH];4      4       t<RI t= ! RJ RK]P\                  4      t>]! RLR7       ! RM RN];4      4       t?]! ROR7       ! RP RQ];4      4       t@]! RRR7       ! RS RT];4      4       tA]! RUR7       ! RV RW];4      4       tB]! RXR7       ! RY RZ];4      4       tC]! R[R7       ! R\ R]];4      4       tD] ! R^ R_];4      4       tE] ! R` Ra];4      4       tF. RbOtGR# )czPyTorch LUKE model.N)Ú	dataclass)Únn)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELoss)Úinitialization)ÚACT2FNÚgelu)Úcreate_bidirectional_mask)ÚGradientCheckpointingLayer)ÚBaseModelOutputÚBaseModelOutputWithPooling)ÚPreTrainedModel)Úapply_chunking_to_forward)ÚModelOutputÚauto_docstringÚlogging©Ú
LukeConfigz3
    Base class for outputs of the LUKE model.
    )Úcustom_introc                   ó8   a € ] tR t^%t o RtRtRtV 3R ltRtV t	R# )ÚBaseLukeModelOutputWithPoolingaP  
pooler_output (`torch.FloatTensor` of shape `(batch_size, hidden_size)`):
    Last layer hidden-state of the first token of the sequence (classification token) further processed by a
    Linear layer and a Tanh activation function.
entity_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, entity_length, hidden_size)`):
    Sequence of entity hidden-states at the output of the last layer of the model.
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                óŠ   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   # ©é   NÚentity_last_hidden_state.Úentity_hidden_states©ÚtorchÚFloatTensorÚtuple)ÚformatÚ__classdict__s   "€Úg/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/luke/modeling_luke.pyÚ__annotate__Ú+BaseLukeModelOutputWithPooling.__annotate__%   s?   ø‡ ‚ ñ& $×/Ñ/°$Õ6Ñ=ñ' ñ(  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEò) ó    © ©
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__©r"   s   @r#   r   r   %   s   ø‡ € ñ
ð :>ÐØAEÐ÷) ƒ r&   r   zV
    Base class for model's outputs, with potential hidden states and attentions.
    c                   ó8   a € ] tR t^<t o RtRtRtV 3R ltRtV t	R# )ÚBaseLukeModelOutputah  
entity_last_hidden_state (`torch.FloatTensor` of shape `(batch_size, entity_length, hidden_size)`):
    Sequence of entity hidden-states at the output of the last layer of the model.
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                óŠ   <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   # r   r   )r!   r"   s   "€r#   r$   Ú BaseLukeModelOutput.__annotate__<   s?   ø‡ ‚ ñ  $×/Ñ/°$Õ6Ñ=ñ! ñ"  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEò# r&   r'   r(   r1   s   @r#   r3   r3   <   s   ø‡ € ñð :>ÐØAEÐ÷# ƒ r&   r3   c                   óP   a € ] tR t^Pt o RtRtRtRtRtRt	Rt
RtRtV 3R ltRtV tR# )ÚLukeMaskedLMOutputaþ  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    The sum of masked language modeling (MLM) loss and entity prediction loss.
mlm_loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Masked language modeling (MLM) loss.
mep_loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Masked entity prediction (MEP) loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
    Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).
entity_logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
    Prediction scores of the entity prediction head (scores for each entity vocabulary token before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                óÂ  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  ,          R,          ;R&   S[S[ P                  R3,          R,          ;R	&   S[S[ P                  R3,          R,          ;R
&   # )r   NÚlossÚmlm_lossÚmep_lossÚlogitsÚentity_logitsÚhidden_states.r   Ú
attentionsr   )r!   r"   s   "€r#   r$   ÚLukeMaskedLMOutput.__annotate__P   sÞ   ø‡ ‚ ñ0 ×
Ñ
˜dÕ
"Ñ)ñ1 ñ2 ×Ñ $Õ&Ñ-ñ3 ñ4 ×Ñ $Õ&Ñ-ñ5 ñ6 ×Ñ Õ$Ñ+ñ7 ñ8 ×$Ñ$ tÕ+Ñ2ñ9 ñ: ™×*Ñ*Õ+¨dÕ2Ñ9ñ; ñ<  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEñ= ñ> ‘e×'Ñ'¨Ð,Õ-°Õ4Ñ;ò? r&   r'   )r)   r*   r+   r,   r-   r9   r:   r;   r<   r=   r>   r   r?   r.   r/   r0   r1   s   @r#   r7   r7   P   s<   ø‡ € ñð" &*€DØ)-€HØ)-€HØ'+€FØ.2€MØ59€MØAEÐØ7;€J÷? ƒ r&   r7   z2
    Outputs of entity classification models.
    c                   óD   a € ] tR t^rt o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚEntityClassificationOutputá›  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`):
    Classification scores (before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # ©r   Nr9   r<   .r>   r   r?   r   )r!   r"   s   "€r#   r$   Ú'EntityClassificationOutput.__annotate__r   ó›   ø‡ ‚ ñ$ ×
Ñ
˜dÕ
"Ñ)ñ% ñ& ×Ñ Õ$Ñ+ñ' ñ( ™×*Ñ*¨CÐ/Õ0°4Õ7Ñ>ñ) ñ*  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEñ+ ñ, ‘e×'Ñ'¨Ð,Õ-°Õ4Ñ;ò- r&   r'   ©r)   r*   r+   r,   r-   r9   r<   r>   r   r?   r.   r/   r0   r1   s   @r#   rB   rB   r   ó-   ø‡ € ñ	ð &*€DØ'+€FØ:>€MØAEÐØ7;€J÷- ƒ r&   rB   z7
    Outputs of entity pair classification models.
    c                   óD   a € ] tR t^‹t o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚEntityPairClassificationOutputrC   Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # rE   r   )r!   r"   s   "€r#   r$   Ú+EntityPairClassificationOutput.__annotate__‹   rG   r&   r'   rH   r1   s   @r#   rK   rK   ‹   rI   r&   rK   z7
    Outputs of entity span classification models.
    c                   óD   a € ] tR t^¤t o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚEntitySpanClassificationOutputaª  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, entity_length, config.num_labels)`):
    Classification scores (before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # rE   r   )r!   r"   s   "€r#   r$   Ú+EntitySpanClassificationOutput.__annotate__¤   rG   r&   r'   rH   r1   s   @r#   rO   rO   ¤   rI   r&   rO   z4
    Outputs of sentence classification models.
    c                   óD   a € ] tR t^½t o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚLukeSequenceClassifierOutputaë  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Classification (or regression if config.num_labels==1) loss.
logits (`torch.FloatTensor` of shape `(batch_size, config.num_labels)`):
    Classification (or regression if config.num_labels==1) scores (before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # rE   r   )r!   r"   s   "€r#   r$   Ú)LukeSequenceClassifierOutput.__annotate__½   rG   r&   r'   rH   r1   s   @r#   rS   rS   ½   rI   r&   rS   z@
    Base class for outputs of token classification models.
    c                   óD   a € ] tR t^Öt o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚLukeTokenClassifierOutputa¬  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.num_labels)`):
    Classification scores (before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # rE   r   )r!   r"   s   "€r#   r$   Ú&LukeTokenClassifierOutput.__annotate__Ö   rG   r&   r'   rH   r1   s   @r#   rW   rW   Ö   rI   r&   rW   z/
    Outputs of question answering models.
    c                   óH   a € ] tR t^ït o RtRtRtRtRtRt	Rt
V 3R ltRtV tR# )Ú LukeQuestionAnsweringModelOutputak  
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
    Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ój  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # )	r   Nr9   Ústart_logitsÚ
end_logits.r>   r   r?   r   )r!   r"   s   "€r#   r$   Ú-LukeQuestionAnsweringModelOutput.__annotate__ï   s³   ø‡ ‚ ñ  ×
Ñ
˜dÕ
"Ñ)ñ! ñ" ×#Ñ# dÕ*Ñ1ñ# ñ$ ×!Ñ! DÕ(Ñ/ñ% ñ& ™×*Ñ*¨CÐ/Õ0°4Õ7Ñ>ñ' ñ(  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEñ) ñ* ‘e×'Ñ'¨Ð,Õ-°Õ4Ñ;ò+ r&   r'   )r)   r*   r+   r,   r-   r9   r]   r^   r>   r   r?   r.   r/   r0   r1   s   @r#   r[   r[   ï   s2   ø‡ € ñð &*€DØ-1€LØ+/€JØ:>€MØAEÐØ7;€J÷+ ƒ r&   r[   z,
    Outputs of multiple choice models.
    c                   óD   a € ] tR tRt o RtRtRtRtRtRt	V 3R lt
RtV tR# )ÚLukeMultipleChoiceModelOutputi  aï  
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided):
    Classification loss.
logits (`torch.FloatTensor` of shape `(batch_size, num_choices)`):
    *num_choices* is the second dimension of the input tensors. (see *input_ids* above).

    Classification scores (before SoftMax).
entity_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
    Tuple of `torch.FloatTensor` (one for the output of the embeddings + one for the output of each layer) of
    shape `(batch_size, entity_length, hidden_size)`. Entity hidden-states of the model at the output of each
    layer plus the initial entity embedding outputs.
Nc                ó<  <€ V ^8„  d   Qh/ S[ P                  R,          ;R&   S[ P                  R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   S[S[ P                  R3,          R,          ;R&   # rE   r   )r!   r"   s   "€r#   r$   Ú*LukeMultipleChoiceModelOutput.__annotate__  s›   ø‡ ‚ ñ( ×
Ñ
˜dÕ
"Ñ)ñ) ñ* ×Ñ Õ$Ñ+ñ+ ñ, ™×*Ñ*¨CÐ/Õ0°4Õ7Ñ>ñ- ñ.  ¡× 1Ñ 1°3Ð 6Õ7¸$Õ>ÑEñ/ ñ0 ‘e×'Ñ'¨Ð,Õ-°Õ4Ñ;ò1 r&   r'   rH   r1   s   @r#   ra   ra     s-   ø‡ € ñð &*€DØ'+€FØ:>€MØAEÐØ7;€J÷1 ƒ r&   ra   c                   óF   a a€ ] tR tRt oRtV 3R ltRR ltR tRtVt	V ;t
# )ÚLukeEmbeddingsi"  zN
Same as BertEmbeddings with a tiny tweak for positional embeddings indexing.
c                ó¢  <€ \         SV `  4        \        P                  ! VP                  VP
                  VP                  R 7      V n        \        P                  ! VP                  VP
                  4      V n	        \        P                  ! VP                  VP
                  4      V n        \        P                  ! VP
                  VP                  R7      V n        \        P                  ! VP                  4      V n        VP                  V n        \        P                  ! VP                  VP
                  V P"                  R 7      V n	        R# )©Úpadding_idx©ÚepsN)ÚsuperÚ__init__r   Ú	EmbeddingÚ
vocab_sizeÚhidden_sizeÚpad_token_idÚword_embeddingsÚmax_position_embeddingsÚposition_embeddingsÚtype_vocab_sizeÚtoken_type_embeddingsÚ	LayerNormÚlayer_norm_epsÚDropoutÚhidden_dropout_probÚdropoutrh   ©ÚselfÚconfigÚ	__class__s   &&€r#   rl   ÚLukeEmbeddings.__init__'  sã   ø€ Ü‰ÑÔÜ!Ÿ|š|¨F×,=Ñ,=¸v×?QÑ?QÐ_e×_rÑ_rÔsˆÔÜ#%§<¢<°×0NÑ0NÐPV×PbÑPbÓ#cˆÔ Ü%'§\¢\°&×2HÑ2HÈ&×J\ÑJ\Ó%]ˆÔ"äŸš f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z’z &×"<Ñ"<Ó=ˆŒð "×.Ñ.ˆÔÜ#%§<¢<Ø×*Ñ*¨F×,>Ñ,>ÈD×L\ÑL\ô$
ˆÖ r&   c                ó4  € VfE   Ve0   \        WP                  4      P                  VP                  4      pMV P	                  V4      pVe   VP                  4       pMVP                  4       R R pVf<   \        P                  ! V\        P                  V P                  P                  R7      pVf   V P                  V4      pV P                  V4      pV P                  V4      pWF,           V,           pV P                  V4      pV P                  V4      pV# )N©ÚdtypeÚdeviceéÿÿÿÿ)Ú"create_position_ids_from_input_idsrh   Útorƒ   Ú&create_position_ids_from_inputs_embedsÚsizer   ÚzerosÚlongÚposition_idsrq   rs   ru   rv   rz   )	r|   Ú	input_idsÚtoken_type_idsr‹   Úinputs_embedsÚinput_shapers   ru   Ú
embeddingss	   &&&&&    r#   ÚforwardÚLukeEmbeddings.forward6  sù   € ð ÒØÒ$äAÀ)×M]ÑM]Ó^×aÑaÐbk×brÑbrÓs‘à#×JÑJÈ=ÓY�àÒ Ø#Ÿ.™.Ó*‰Kà'×,Ñ,Ó.¨s°Ð3ˆKàÒ!Ü"Ÿ[š[¨¼E¿J¹JÈt×O`ÑO`×OgÑOgÔhˆNàÒ Ø ×0Ñ0°Ó;ˆMà"×6Ñ6°|ÓDÐØ $× :Ñ :¸>Ó JÐà"Õ8Ð;PÕPˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
ØÐr&   c                ó.  € VP                  4       RR pV^,          p\        P                  ! V P                  ^,           W0P                  ,           ^,           \        P                  VP
                  R7      pVP                  ^ 4      P                  V4      # )z¯
We are provided embeddings directly. We cannot infer which are padded so just generate sequential position ids.

Args:
    inputs_embeds: torch.Tensor

Returns: torch.Tensor
Nr�   r„   )rˆ   r   Úarangerh   rŠ   rƒ   Ú	unsqueezeÚexpand)r|   rŽ   r�   Úsequence_lengthr‹   s   &&   r#   r‡   Ú5LukeEmbeddings.create_position_ids_from_inputs_embedsW  s~   € ð $×(Ñ(Ó*¨3¨BÐ/ˆØ% a�.ˆä—|’|Ø×Ñ˜qÕ  /×4DÑ4DÕ"DÀqÕ"HÔPU×PZÑPZÐcp×cwÑcwô
ˆð ×%Ñ% aÓ(×/Ñ/°Ó<Ð<r&   )rv   rz   rh   rs   ru   rq   )NNNN)r)   r*   r+   r,   r-   rl   r‘   r‡   r/   r0   Ú__classcell__©r~   r"   s   @@r#   re   re   "  s   ù‡ € ñõ
ô÷B=ò =r&   re   c                   óT   a a€ ] tR tRt oV3R lV 3R lltRV3R lR lltRtVtV ;t# )ÚLukeEntityEmbeddingsii  c                ó    <€ V ^8„  d   QhRS[ /# ©r   r}   r   )r!   r"   s   "€r#   r$   Ú!LukeEntityEmbeddings.__annotate__j  s   ø€ ÷ >ñ >™zñ >r&   c                óš  <€ \         SV `  4        Wn        \        P                  ! VP
                  VP                  ^ R7      V n        VP                  VP                  8w  d3   \        P                  ! VP                  VP                  RR7      V n
        \        P                  ! VP                  VP                  4      V n        \        P                  ! VP                  VP                  4      V n        \        P                  ! VP                  VP                   R7      V n        \        P"                  ! VP$                  4      V n        R# )é    rg   F©Úbiasri   N)rk   rl   r}   r   rm   Úentity_vocab_sizeÚentity_emb_sizeÚentity_embeddingsro   ÚLinearÚentity_embedding_denserr   rs   rt   ru   rv   rw   rx   ry   rz   r{   s   &&€r#   rl   ÚLukeEntityEmbeddings.__init__j  sÞ   ø€ Ü‰ÑÔØŒä!#§¢¨f×.FÑ.FÈ×H^ÑH^ÐlmÔ!nˆÔØ×!Ñ! V×%7Ñ%7Ô7Ü*,¯)ª)°F×4JÑ4JÈF×L^ÑL^ÐejÔ*kˆDÔ'ä#%§<¢<°×0NÑ0NÐPV×PbÑPbÓ#cˆÔ Ü%'§\¢\°&×2HÑ2HÈ&×J\ÑJ\Ó%]ˆÔ"äŸš f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z’z &×"<Ñ"<Ó=ˆŽr&   c                óv   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  R,          /# )r   Ú
entity_idsr‹   r�   N)r   Ú
LongTensor)r!   r"   s   "€r#   r$   rŸ   x  s@   ø€ ÷ ñ á×$Ñ$ðñ ×&Ñ&ðñ ×(Ñ(¨4Õ/ñ	r&   c                óx  € Vf   \         P                  ! V4      pV P                  V4      pV P                  P                  V P                  P
                  8w  d   V P                  V4      pV P                  VP                  ^ R7      4      pVR8g  P                  V4      P                  R4      pWV,          p\         P                  ! VRR7      pWVP                  RR7      P                  RR7      ,          pV P                  V4      pWE,           V,           pV P                  V4      pV P                  V4      pV# )N)Úmin©ÚdimgH¯¼šò×z>r„   éþÿÿÿ)r   Ú
zeros_liker¦   r}   r¥   ro   r¨   rs   ÚclampÚtype_asr•   Úsumru   rv   rz   )	r|   r«   r‹   r�   r¦   rs   Úposition_embedding_maskru   r�   s	   &&&&     r#   r‘   ÚLukeEntityEmbeddings.forwardx  s  € ð Ò!Ü"×-Ò-¨jÓ9ˆNà ×2Ñ2°:Ó>ÐØ�;‰;×&Ñ&¨$¯+©+×*AÑ*AÔAØ $× ;Ñ ;Ð<MÓ NÐà"×6Ñ6°|×7IÑ7IÈaÐ7IÓ7PÓQÐØ#/°2Ñ#5×">Ñ">Ð?RÓ"S×"]Ñ"]Ð^`Ó"aÐØ1ÕKÐÜ#ŸišiÐ(;ÀÔDÐØ1×4OÑ4OÐTVÐ4OÓ4W×4]Ñ4]ÐbfÐ4]Ó4gÕgÐà $× :Ñ :¸>Ó JÐà&Õ<Ð?TÕTˆ
Ø—^‘^ JÓ/ˆ
Ø—\‘\ *Ó-ˆ
àÐr&   )rv   r}   rz   r¨   r¦   rs   ru   ©N©	r)   r*   r+   r,   rl   r‘   r/   r0   r™   rš   s   @@r#   rœ   rœ   i  s   ù‡ € ÷>ó >÷÷ ò r&   rœ   c                   óB   a a€ ] tR tRt oV 3R ltR tRR ltRtVtV ;t	# )ÚLukeSelfAttentioni”  c                ód  <€ \         SV `  4        VP                  VP                  ,          ^ 8w  d9   \	        VR4      '       g'   \        RVP                   RVP                   R24      hVP                  V n        \        VP                  VP                  ,          4      V n        V P                  V P                  ,          V n        VP                  V n	        \        P                  ! VP                  V P                  4      V n        \        P                  ! VP                  V P                  4      V n        \        P                  ! VP                  V P                  4      V n        V P                  '       d‘   \        P                  ! VP                  V P                  4      V n        \        P                  ! VP                  V P                  4      V n        \        P                  ! VP                  V P                  4      V n        \        P$                  ! VP&                  4      V n        R# )r¡   Úembedding_sizezThe hidden size z4 is not a multiple of the number of attention heads Ú.N)rk   rl   ro   Únum_attention_headsÚhasattrÚ
ValueErrorÚintÚattention_head_sizeÚall_head_sizeÚuse_entity_aware_attentionr   r§   ÚqueryÚkeyÚvalueÚ	w2e_queryÚ	e2w_queryÚ	e2e_queryrx   Úattention_probs_dropout_probrz   r{   s   &&€r#   rl   ÚLukeSelfAttention.__init__•  s“  ø€ Ü‰ÑÔØ×Ñ × :Ñ :Õ:¸aÔ?ÌÐPVÐXh×HiÒHiÜØ" 6×#5Ñ#5Ð"6ð 7Ø×3Ñ3Ð4°Að7óð ð
 $*×#=Ñ#=ˆÔ Ü#& v×'9Ñ'9¸F×<VÑ<VÕ'VÓ#WˆÔ Ø!×5Ñ5¸×8PÑ8PÕPˆÔØ*0×*KÑ*KˆÔ'ä—Y’Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
Ü—9’9˜V×/Ñ/°×1CÑ1CÓDˆŒÜ—Y’Y˜v×1Ñ1°4×3EÑ3EÓFˆŒ
à×*×*Ð*ÜŸYšY v×'9Ñ'9¸4×;MÑ;MÓNˆDŒNÜŸYšY v×'9Ñ'9¸4×;MÑ;MÓNˆDŒNÜŸYšY v×'9Ñ'9¸4×;MÑ;MÓNˆDŒNä—z’z &×"EÑ"EÓFˆŽr&   c                óª   € VP                  4       R R V P                  V P                  3,           pVP                  ! V!  pVP	                  ^ ^^^4      # )Nr„   )rˆ   r¿   rÃ   ÚviewÚpermute)r|   ÚxÚnew_x_shapes   && r#   Útranspose_for_scoresÚ&LukeSelfAttention.transpose_for_scores­  sL   € Ø—f‘f“h˜s �m t×'?Ñ'?À×AYÑAYÐ&ZÕZˆØ�FŠF�KÑ ˆØ�y‰y˜˜A˜q !Ó$Ð$r&   c                ó  € VP                  ^4      pVf   TpM\        P                  ! W.^R7      pV P                  V P	                  V4      4      pV P                  V P                  V4      4      pV P                  '       Edª   VEe¥   V P                  V P                  V4      4      p	V P                  V P                  V4      4      p
V P                  V P                  V4      4      pV P                  V P                  V4      4      pVRRRV1R3,          pVRRRV1R3,          pVRRVR1R3,          pVRRVR1R3,          p\        P                  ! W�P                  RR4      4      p\        P                  ! W¯P                  RR4      4      p\        P                  ! W¾P                  RR4      4      p\        P                  ! VVP                  RR4      4      p\        P                  ! VV.^R7      p\        P                  ! VV.^R7      p\        P                  ! VV.^R7      pMGV P                  V P                  V4      4      p\        P                  ! VVP                  RR4      4      pV\        P                  ! V P                  4      ,          pVe
   VV,           p\         P"                  P%                  VRR7      pV P'                  V4      p\        P                  ! VV4      pVP)                  ^ ^^^4      P+                  4       pVP                  4       RR V P,                  3,           pVP.                  ! V!  pVRRV1R3,          pVf   RpMVRVR1R3,          pV'       d   VVV3pV# VV3pV# )é   Nr¯   ºNNNr„   r±   )rˆ   r   ÚcatrÓ   rÇ   rÈ   rÅ   rÆ   rÉ   rÊ   rË   ÚmatmulÚ	transposeÚmathÚsqrtrÃ   r   Ú
functionalÚsoftmaxrz   rÐ   Ú
contiguousrÄ   rÏ   )r|   Úword_hidden_statesr   Úattention_maskÚoutput_attentionsÚ	word_sizeÚconcat_hidden_statesÚ	key_layerÚvalue_layerÚw2w_query_layerÚw2e_query_layerÚe2w_query_layerÚe2e_query_layerÚw2w_key_layerÚe2w_key_layerÚw2e_key_layerÚe2e_key_layerÚw2w_attention_scoresÚw2e_attention_scoresÚe2w_attention_scoresÚe2e_attention_scoresÚword_attention_scoresÚentity_attention_scoresÚattention_scoresÚquery_layerÚattention_probsÚcontext_layerÚnew_context_layer_shapeÚoutput_word_hidden_statesÚoutput_entity_hidden_statesÚoutputss   &&&&&                          r#   r‘   ÚLukeSelfAttention.forward²  s^  € ð '×+Ñ+¨AÓ.ˆ	àÒ'Ø#5Ñ ä#(§9¢9Ð.@Ð-WÐ]^Ô#_Ð à×-Ñ-¨d¯h©hÐ7KÓ.LÓMˆ	Ø×/Ñ/°·
±
Ð;OÓ0PÓQˆà×*×*Ñ*Ð/CÓ/Oð #×7Ñ7¸¿
¹
ÐCUÓ8VÓWˆOØ"×7Ñ7¸¿¹ÐGYÓ8ZÓ[ˆOØ"×7Ñ7¸¿¹ÐG[Ó8\Ó]ˆOØ"×7Ñ7¸¿¹ÐG[Ó8\Ó]ˆOð & a¨¨J¨Y¨J¸Ð&9Õ:ˆMØ% a¨¨J¨Y¨J¸Ð&9Õ:ˆMØ% a¨¨I©J¸Ð&9Õ:ˆMØ% a¨¨I©J¸Ð&9Õ:ˆMô $)§<¢<°×AXÑAXÐY[Ð]_ÓA`Ó#aÐ Ü#(§<¢<°×AXÑAXÐY[Ð]_ÓA`Ó#aÐ Ü#(§<¢<°×AXÑAXÐY[Ð]_ÓA`Ó#aÐ Ü#(§<¢<°À×AXÑAXÐY[Ð]_ÓA`Ó#aÐ ô %*§I¢IÐ/CÐEYÐ.ZÐ`aÔ$bÐ!Ü&+§i¢iÐ1EÐG[Ð0\ÐbcÔ&dÐ#Ü$ŸyšyÐ*?ÐAXÐ)YÐ_`ÔaÑð ×3Ñ3°D·J±JÐ?SÓ4TÓUˆKÜ$Ÿ|š|¨K¸×9LÑ9LÈRÐQSÓ9TÓUÐà+¬d¯iªi¸×8PÑ8PÓ.QÕQÐØÒ%à/°.Õ@Ðô Ÿ-™-×/Ñ/Ð0@ÀbÐ/ÓIˆð Ÿ,™, Ó7ˆäŸš _°kÓBˆà%×-Ñ-¨a°°A°qÓ9×DÑDÓFˆØ"/×"4Ñ"4Ó"6°s¸Ð";¸t×?QÑ?QÐ>SÕ"SÐØ%×*Ò*Ð,CÑDˆà$1°!°Z°i°ZÀÐ2BÕ$CÐ!ØÒ'Ø*.Ñ'à*7¸¸9¹:ÀqÐ8HÕ*IÐ'çØ0Ð2MÈÐ_ˆGð ˆð 1Ð2MÐNˆGàˆr&   )rÄ   rÃ   rz   rË   rÊ   rÇ   r¿   rÆ   rÅ   rÈ   rÉ   ©NF)
r)   r*   r+   r,   rl   rÓ   r‘   r/   r0   r™   rš   s   @@r#   r»   r»   ”  s   ù‡ € õGò0%÷
Kô Kr&   r»   c                   óD   a a€ ] tR tRt oV 3R ltV3R lR ltRtVtV ;t# )ÚLukeSelfOutputi  c                ó0  <€ \         SV `  4        \        P                  ! VP                  VP                  4      V n        \        P                  ! VP                  VP                  R 7      V n        \        P                  ! VP                  4      V n
        R# ©ri   N)rk   rl   r   r§   ro   Údenserv   rw   rx   ry   rz   r{   s   &&€r#   rl   ÚLukeSelfOutput.__init__  s`   ø€ Ü‰ÑÔÜ—Y’Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸš f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z’z &×"<Ñ"<Ó=ˆŽr&   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# ©r   r>   Úinput_tensorÚreturn©r   ÚTensor)r!   r"   s   "€r#   r$   ÚLukeSelfOutput.__annotate__  ó1   ø€ ÷ ñ ¡U§\¡\ð ÁÇÁð ÑRW×R^ÑR^ñ r&   c                óx   € V P                  V4      pV P                  V4      pV P                  W,           4      pV# r¸   ©r  rz   rv   ©r|   r>   r  s   &&&r#   r‘   ÚLukeSelfOutput.forward  ó5   € ØŸ
™
 =Ó1ˆØŸ™ ]Ó3ˆØŸ™ }Õ'CÓDˆØÐr&   ©rv   r  rz   r¹   rš   s   @@r#   r   r     ó   ù‡ € õ>÷÷ ð r&   r   c                   ó<   a a€ ] tR tRt oV 3R ltRR ltRtVtV ;t# )ÚLukeAttentioni  c                ód   <€ \         SV `  4        \        V4      V n        \	        V4      V n        R # r¸   )rk   rl   r»   r|   r   Úoutputr{   s   &&€r#   rl   ÚLukeAttention.__init__  s&   ø€ Ü‰ÑÔÜ% fÓ-ˆŒ	Ü$ VÓ,ˆŽr&   c                ój  € VP                  ^4      pV P                  VVVV4      pVf   V^ ,          pTpM8\        P                  ! VR,          ^R7      p\        P                  ! W.^R7      pV P	                  Wx4      p	V	RRV1R3,          p
Vf   RpMV	RVR1R3,          pW«3VR,          ,           pV# )rÖ   NºNr   Nr¯   r×   ºr   NN)rˆ   r|   r   rØ   r  )r|   rà   r   rá   râ   rã   Úself_outputsÚconcat_self_outputsrä   Úattention_outputÚword_attention_outputÚentity_attention_outputrü   s   &&&&&        r#   r‘   ÚLukeAttention.forward  sÒ   € ð '×+Ñ+¨AÓ.ˆ	Ø—y‘yØØ ØØó	
ˆð  Ò'Ø".¨q¥/ÐØ#5Ñ ä"'§)¢)¨L¸Õ,<À!Ô"DÐÜ#(§9¢9Ð.@Ð-WÐ]^Ô#_Ð àŸ;™;Ð':ÓQÐà 0°°J°Y°JÀÐ1AÕ BÐØÒ'Ø&*Ñ#à&6°q¸)¹*ÀaÐ7GÕ&HÐ#ð )ÐBÀ\ÐRTÕEUÕUˆàˆr&   )r  r|   rþ   r¹   rš   s   @@r#   r  r    s   ù‡ € õ-÷
 ô  r&   r  c                   óD   a a€ ] tR tRt oV 3R ltV3R lR ltRtVtV ;t# )ÚLukeIntermediatei9  c                ó"  <€ \         SV `  4        \        P                  ! VP                  VP
                  4      V n        \        VP                  \        4      '       d   \        VP                  ,          V n        R # VP                  V n        R # r¸   )rk   rl   r   r§   ro   Úintermediate_sizer  Ú
isinstanceÚ
hidden_actÚstrr   Úintermediate_act_fnr{   s   &&€r#   rl   ÚLukeIntermediate.__init__:  s`   ø€ Ü‰ÑÔÜ—Y’Y˜v×1Ñ1°6×3KÑ3KÓLˆŒ
Ü�f×'Ñ'¬×-Ò-Ü'-¨f×.?Ñ.?Õ'@ˆDÖ$à'-×'8Ñ'8ˆDÖ$r&   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r   r>   r  r	  )r!   r"   s   "€r#   r$   ÚLukeIntermediate.__annotate__B  s#   ø€ ÷ ñ ¡U§\¡\ð ±e·l±lñ r&   c                óJ   € V P                  V4      pV P                  V4      pV# r¸   ©r  r)  ©r|   r>   s   &&r#   r‘   ÚLukeIntermediate.forwardB  s&   € ØŸ
™
 =Ó1ˆØ×0Ñ0°Ó?ˆØÐr&   r/  r¹   rš   s   @@r#   r#  r#  9  s   ù‡ € õ9÷÷ ð r&   r#  c                   óD   a a€ ] tR tRt oV 3R ltV3R lR ltRtVtV ;t# )Ú
LukeOutputiI  c                ó0  <€ \         SV `  4        \        P                  ! VP                  VP
                  4      V n        \        P                  ! VP
                  VP                  R 7      V n        \        P                  ! VP                  4      V n        R# r  )rk   rl   r   r§   r%  ro   r  rv   rw   rx   ry   rz   r{   s   &&€r#   rl   ÚLukeOutput.__init__J  s`   ø€ Ü‰ÑÔÜ—Y’Y˜v×7Ñ7¸×9KÑ9KÓLˆŒ
ÜŸš f×&8Ñ&8¸f×>SÑ>SÔTˆŒÜ—z’z &×"<Ñ"<Ó=ˆŽr&   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# r  r	  )r!   r"   s   "€r#   r$   ÚLukeOutput.__annotate__P  r  r&   c                óx   € V P                  V4      pV P                  V4      pV P                  W,           4      pV# r¸   r  r  s   &&&r#   r‘   ÚLukeOutput.forwardP  r  r&   r  r¹   rš   s   @@r#   r3  r3  I  r  r&   r3  c                   óB   a a€ ] tR tRt oV 3R ltRR ltR tRtVtV ;t	# )Ú	LukeLayeriW  c                ó´   <€ \         SV `  4        VP                  V n        ^V n        \	        V4      V n        \        V4      V n        \        V4      V n	        R# )rÖ   N)
rk   rl   Úchunk_size_feed_forwardÚseq_len_dimr  Ú	attentionr#  Úintermediater3  r  r{   s   &&€r#   rl   ÚLukeLayer.__init__X  sI   ø€ Ü‰ÑÔØ'-×'EÑ'EˆÔ$ØˆÔÜ& vÓ.ˆŒÜ,¨VÓ4ˆÔÜ  Ó(ˆŽr&   c                óp  € VP                  ^4      pV P                  VVVVR7      pVf   V^ ,          pM\        P                  ! VR,          ^R7      pVR,          p\	        V P
                  V P                  V P                  V4      p	V	RRV1R3,          p
Vf   RpMV	RVR1R3,          pW«3V,           pV# )rÖ   )râ   Nr  r¯   r  r×   )rˆ   r?  r   rØ   r   Úfeed_forward_chunkr=  r>  )r|   rà   r   rá   râ   rã   Úself_attention_outputsÚconcat_attention_outputrü   Úlayer_outputÚword_layer_outputÚentity_layer_outputs   &&&&&       r#   r‘   ÚLukeLayer.forward`  sÙ   € ð '×+Ñ+¨AÓ.ˆ	à!%§¡ØØ ØØ/ð	 "0ó "
Ðð  Ò'Ø&<¸QÕ&?Ñ#ä&+§i¢iÐ0FÀrÕ0JÐPQÔ&RÐ#à(¨Õ,ˆä0Ø×#Ñ# T×%AÑ%AÀ4×CSÑCSÐUló
ˆð )¨¨J¨Y¨J¸Ð)9Õ:ÐØÒ'Ø"&Ñà".¨q°)±*¸aÐ/?Õ"@Ðà$Ð:¸WÕDˆàˆr&   c                óJ   € V P                  V4      pV P                  W!4      pV# r¸   )r@  r  )r|   r  Úintermediate_outputrF  s   &&  r#   rC  ÚLukeLayer.feed_forward_chunkƒ  s)   € Ø"×/Ñ/Ð0@ÓAÐØ—{‘{Ð#6ÓIˆØÐr&   )r?  r=  r@  r  r>  rþ   )
r)   r*   r+   r,   rl   r‘   rC  r/   r0   r™   rš   s   @@r#   r;  r;  W  s   ù‡ € õ)ô!÷Fò r&   r;  c                   ó<   a a€ ] tR tRt oV 3R ltRR ltRtVtV ;t# )ÚLukeEncoderi‰  c                óÖ   <€ \         SV `  4        Wn        \        P                  ! \        VP                  4       Uu. uF  p\        V4      NK  	  up4      V n        R V n	        R# u upi )FN)
rk   rl   r}   r   Ú
ModuleListÚrangeÚnum_hidden_layersr;  ÚlayerÚgradient_checkpointing)r|   r}   Ú_r~   s   && €r#   rl   ÚLukeEncoder.__init__Š  sR   ø€ Ü‰ÑÔØŒÜ—]’]¼uÀV×E]ÑE]Ô?^Ó#_Ñ?^¸!¤I¨fÖ$5Ñ?^Ñ#_Ó`ˆŒ
Ø&+ˆÖ#ùò $`s   ½A&c                ó   € V'       d   RMR pV'       d   RMR pV'       d   RMR p	\        V P                  4       FZ  w  r«V'       d   Wq3,           pW‚3,           pV! VVVV4      pV^ ,          pVe
   V^,          pV'       g   KJ  Wœ^,          3,           p	K\  	  V'       d   Wq3,           pW‚3,           pV'       g7   \        ;QJ d    . R VVV	VV3 4       F  NK  	  5# ! R VVV	VV3 4       4      # \        VVV	VVR7      # )Nc              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   ©Ú.0Úvs   & r#   Ú	<genexpr>Ú&LukeEncoder.forward.<locals>.<genexpr>¶  ó"   é € ð 
ñ�Að ÷ ’óùó   ‚�
)Úlast_hidden_stater>   r?   r   r   r'   )Ú	enumeraterS  r    r3   )r|   rà   r   rá   râ   Úoutput_hidden_statesÚreturn_dictÚall_word_hidden_statesÚall_entity_hidden_statesÚall_self_attentionsÚiÚlayer_moduleÚlayer_outputss   &&&&&&&      r#   r‘   ÚLukeEncoder.forward�  s3  € ÷ (<¡ÀÐß)=¡2À4Ð ß$5™b¸4Ðä(¨¯©Ö4‰OˆAß#Ø)?ÐBWÕ)WÐ&Ø+CÐF]Õ+]Ð(á(Ø"Ø$ØØ!ó	ˆMð "/¨qÕ!1Ðà#Ò/Ø'4°QÕ'7Ð$ç Ñ Ø&9È1Õ=MÐ<OÕ&OÒ#ñ%  5÷(  Ø%;Ð>SÕ%SÐ"Ø'?ÐBYÕ'YÐ$çß”5ñ 
ð 'Ø*Ø'Ø(Ø,ñó
—5ð 
�5ñ 
ð 'Ø*Ø'Ø(Ø,ñó
ó 
ð 
ô #Ø0Ø0Ø*Ø%9Ø!9ô
ð 	
r&   )r}   rT  rS  )NFFTr¹   rš   s   @@r#   rN  rN  ‰  s   ù‡ € õ,÷7
ô 7
r&   rN  c                   óD   a a€ ] tR tRt oV 3R ltV3R lR ltRtVtV ;t# )Ú
LukePooleriË  c                ó¸   <€ \         SV `  4        \        P                  ! VP                  VP                  4      V n        \        P                  ! 4       V n        R # r¸   )rk   rl   r   r§   ro   r  ÚTanhÚ
activationr{   s   &&€r#   rl   ÚLukePooler.__init__Ì  s9   ø€ Ü‰ÑÔÜ—Y’Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸ'š'›)ˆŽr&   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# r,  r	  )r!   r"   s   "€r#   r$   ÚLukePooler.__annotate__Ñ  s#   ø€ ÷ ñ ¡U§\¡\ð ±e·l±lñ r&   c                ó\   € VR,          pV P                  V4      pV P                  V4      pV# )r×   )r×   r¡   )r  ro  )r|   r>   Úfirst_token_tensorÚpooled_outputs   &&  r#   r‘   ÚLukePooler.forwardÑ  s2   € ð +¨4Õ0ÐØŸ
™
Ð#5Ó6ˆØŸ™¨Ó6ˆØÐr&   )ro  r  r¹   rš   s   @@r#   rl  rl  Ë  s   ù‡ € õ$÷
÷ ð r&   rl  c                   ó8   a a€ ] tR tRt oV 3R ltR tRtVtV ;t# )ÚEntityPredictionHeadTransformiÚ  c                ó‚  <€ \         SV `  4        \        P                  ! VP                  VP
                  4      V n        \        VP                  \        4      '       d   \        VP                  ,          V n        MVP                  V n        \        P                  ! VP
                  VP                  R 7      V n        R# r  )rk   rl   r   r§   ro   r¥   r  r&  r'  r(  r   Útransform_act_fnrv   rw   r{   s   &&€r#   rl   Ú&EntityPredictionHeadTransform.__init__Û  s~   ø€ Ü‰ÑÔÜ—Y’Y˜v×1Ñ1°6×3IÑ3IÓJˆŒ
Ü�f×'Ñ'¬×-Ò-Ü$*¨6×+<Ñ+<Õ$=ˆDÕ!à$*×$5Ñ$5ˆDÔ!ÜŸš f×&<Ñ&<À&×BWÑBWÔXˆŽr&   c                ól   € V P                  V4      pV P                  V4      pV P                  V4      pV# r¸   )r  rz  rv   r0  s   &&r#   r‘   Ú%EntityPredictionHeadTransform.forwardä  s4   € ØŸ
™
 =Ó1ˆØ×-Ñ-¨mÓ<ˆØŸ™ }Ó5ˆØÐr&   )rv   r  rz  r¹   rš   s   @@r#   rx  rx  Ú  s   ù‡ € õY÷ò r&   rx  c                   ó8   a a€ ] tR tRt oV 3R ltR tRtVtV ;t# )ÚEntityPredictionHeadië  c                ó&  <€ \         SV `  4        Wn        \        V4      V n        \
        P                  ! VP                  VP                  R R7      V n	        \
        P                  ! \        P                  ! VP                  4      4      V n        R# )Fr¢   N)rk   rl   r}   rx  Ú	transformr   r§   r¥   r¤   ÚdecoderÚ	Parameterr   r‰   r£   r{   s   &&€r#   rl   ÚEntityPredictionHead.__init__ì  s_   ø€ Ü‰ÑÔØŒÜ6°vÓ>ˆŒÜ—y’y ×!7Ñ!7¸×9QÑ9QÐX]Ô^ˆŒÜ—L’L¤§¢¨V×-EÑ-EÓ!FÓGˆŽ	r&   c                ól   € V P                  V4      pV P                  V4      V P                  ,           pV# r¸   )r�  r‚  r£   r0  s   &&r#   r‘   ÚEntityPredictionHead.forwardó  s-   € ØŸ™ }Ó5ˆØŸ™ ]Ó3°d·i±iÕ?ˆàÐr&   )r£   r}   r‚  r�  r¹   rš   s   @@r#   r  r  ë  s   ù‡ € õH÷ò r&   r  c                   ó‚   a a€ ] tR tRt oRtRtRR.t]P                  ! 4       V3R lV 3R ll4       t	V3R lt
R	tVtV ;t# )
ÚLukePreTrainedModeliú  ÚlukeTr  rœ   c                ó4   <€ V ^8„  d   QhRS[ P                  /# )r   Úmodule)r   ÚModule)r!   r"   s   "€r#   r$   Ú LukePreTrainedModel.__annotate__  s   ø€ ÷ 
?ñ 
?¡B§I¡Iñ 
?r&   c                óü  <€ \         SV `  V4       \        V\        P                  4      '       dÌ   VP
                  ^8X  d"   \        P                  ! VP                  4       M7\        P                  ! VP                  RV P                  P                  R7       VP                  eS   \        VP                  RR4      '       g4   \        P                  ! VP                  VP                  ,          4       R# R# R# R# )zInitialize the weightsg        )ÚmeanÚstdNÚ_is_hf_initializedF)rk   Ú_init_weightsr&  r   rm   Úembedding_dimÚinitÚzeros_ÚweightÚnormal_r}   Úinitializer_rangerh   Úgetattr)r|   r‹  r~   s   &&€r#   r’  Ú!LukePreTrainedModel._init_weights  s¨   ø€ ô 	‰Ñ˜fÔ%Ü�fœbŸl™l×+Ò+Ø×#Ñ# qÔ(Ü—’˜FŸM™MÕ*ä—’˜VŸ]™]°¸$¿+¹+×:WÑ:WÕXà×!Ñ!Ò-´g¸f¿m¹mÐMaÐch×6iÒ6iÜ—’˜FŸM™M¨&×*<Ñ*<Õ=Ö>ñ 7jÑ-ñ ,r&   c                ó&   <€ V ^8„  d   Qh/ S[ ;R&   # rž   r   )r!   r"   s   "€r#   r$   r�  ú  s   ø‡ ‚ áÑò r&   r'   )r)   r*   r+   r,   Úbase_model_prefixÚsupports_gradient_checkpointingÚ_no_split_modulesr   Úno_gradr’  r.   r/   r0   r™   rš   s   @@r#   rˆ  rˆ  ú  sC   ù‡ € ð ÐØ&*Ð#Ø(Ð*@ÐAÐà
‡]‚]ƒ_÷
?ò 
?ó ð
?÷ … r&   rˆ  zt
    The bare LUKE model transformer outputting raw hidden-states for both word tokens and entities without any
    c                   óz   a a€ ] tR tRt oRV3R lV 3R llltR tR tR tR t]	RV3R lR	 ll4       t
R
tVtV ;t# )Ú	LukeModeli  c                ó&   <€ V ^8„  d   QhRS[ RS[/# )r   r}   Úadd_pooling_layer)r   Úbool)r!   r"   s   "€r#   r$   ÚLukeModel.__annotate__  s   ø€ ÷ ñ ™zð ¹dñ r&   c                óæ   <€ \         SV `  V4       Wn        \        V4      V n        \        V4      V n        \        V4      V n        V'       d   \        V4      MRV n
        V P                  4        R# )z^
add_pooling_layer (bool, *optional*, defaults to `True`):
    Whether to add a pooling layer
N)rk   rl   r}   re   r�   rœ   r¦   rN  Úencoderrl  ÚpoolerÚ	post_init)r|   r}   r£  r~   s   &&&€r#   rl   ÚLukeModel.__init__  sX   ø€ ô
 	‰Ñ˜Ô ØŒä(¨Ó0ˆŒÜ!5°fÓ!=ˆÔÜ" 6Ó*ˆŒç,=”j Ô(À4ˆŒð 	�‰Ör&   c                ó.   € V P                   P                  # r¸   ©r�   rq   ©r|   s   &r#   Úget_input_embeddingsÚLukeModel.get_input_embeddings&  s   € Ø�‰×.Ñ.Ð.r&   c                ó&   € WP                   n        R # r¸   r¬  ©r|   rÈ   s   &&r#   Úset_input_embeddingsÚLukeModel.set_input_embeddings)  s   € Ø*/�‰Ö'r&   c                ó.   € V P                   P                   # r¸   ©r¦   r­  s   &r#   Úget_entity_embeddingsÚLukeModel.get_entity_embeddings,  s   € Ø×%Ñ%×7Ñ7Ð7r&   c                ó&   € WP                   n         R # r¸   rµ  r±  s   &&r#   Úset_entity_embeddingsÚLukeModel.set_entity_embeddings/  s   € Ø38×ÑÖ0r&   c                óÔ  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# )r   rŒ   Nrá   r�   r‹   r«   Úentity_attention_maskÚentity_token_type_idsÚentity_position_idsrŽ   râ   rb  rc  r  )r   r¬   r   r¤  r    r   )r!   r"   s   "€r#   r$   r¥  3  s  ø€ ÷ X
ñ X
á×#Ñ# dÕ*ðX
ñ ×)Ñ)¨DÕ0ðX
ñ ×(Ñ(¨4Õ/ð	X
ñ
 ×&Ñ&¨Õ-ðX
ñ ×$Ñ$ tÕ+ðX
ñ  %×0Ñ0°4Õ7ðX
ñ  %×/Ñ/°$Õ6ðX
ñ #×-Ñ-°Õ4ðX
ñ ×(Ñ(¨4Õ/ðX
ñ   $�;ðX
ñ # T�kðX
ñ ˜D•[ðX
ñ 
Ñ/Õ	/ñX
r&   c           	     ó$  € V
e   T
MV P                   P                  p
Ve   TMV P                   P                  pVe   TMV P                   P                  pVe   V	e   \	        R4      hVe#   V P                  W4       VP                  4       pM#V	e   V	P                  4       RR pM\	        R4      hVw  ppVe   VP                  MV	P                  pVf   \        P                  ! VV3VR7      pVf(   \        P                  ! V\        P                  VR7      pVe]   VP                  ^4      pVf   \        P                  ! VV3VR7      pVf*   \        P                  ! VV3\        P                  VR7      pV P                  VVVV	R7      pVe   \        P                  ! W&.RR7      p\        V P                   VR,          P                  VP                   4      VR7      pVf   RpMV P#                  WXV4      pV P%                  VVVV
VVR	7      pV^ ,          pV P&                  e   V P'                  V4      MRpV'       g   VV3VR
,          ,           # \)        VVVP*                  VP,                  VP.                  VP0                  R7      # )u
  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.

Examples:

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

>>> tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-base")
>>> model = LukeModel.from_pretrained("studio-ousia/luke-base")
# Compute the contextualized entity representation corresponding to the entity mention "BeyoncÃ©"

>>> text = "BeyoncÃ© lives in Los Angeles."
>>> entity_spans = [(0, 7)]  # character-based entity span corresponding to "BeyoncÃ©"

>>> encoding = tokenizer(text, entity_spans=entity_spans, add_prefix_space=True, return_tensors="pt")
>>> outputs = model(**encoding)
>>> word_last_hidden_state = outputs.last_hidden_state
>>> entity_last_hidden_state = outputs.entity_last_hidden_state
# Input Wikipedia entities to obtain enriched contextualized representations of word tokens

>>> text = "BeyoncÃ© lives in Los Angeles."
>>> entities = [
...     "BeyoncÃ©",
...     "Los Angeles",
... ]  # Wikipedia entity titles corresponding to the entity mentions "BeyoncÃ©" and "Los Angeles"
>>> entity_spans = [
...     (0, 7),
...     (17, 28),
... ]  # character-based entity spans corresponding to "BeyoncÃ©" and "Los Angeles"

>>> encoding = tokenizer(
...     text, entities=entities, entity_spans=entity_spans, add_prefix_space=True, return_tensors="pt"
... )
>>> outputs = model(**encoding)
>>> word_last_hidden_state = outputs.last_hidden_state
>>> entity_last_hidden_state = outputs.entity_last_hidden_state
```NzDYou cannot specify both input_ids and inputs_embeds at the same timez5You have to specify either input_ids or inputs_embeds)rƒ   r�   )rŒ   r‹   r�   rŽ   r¯   )r}   rŽ   rá   )rá   râ   rb  rc  :rÖ   NN)r`  Úpooler_outputr>   r?   r   r   r„   ).N)r}   râ   rb  rc  rÁ   Ú%warn_if_padding_and_no_attention_maskrˆ   rƒ   r   Úonesr‰   rŠ   r�   rØ   r
   r†   r‚   r¦   r§  r¨  r   r>   r?   r   r   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   râ   rb  rc  Úkwargsr�   Ú
batch_sizeÚ
seq_lengthrƒ   Úentity_seq_lengthÚword_embedding_outputÚentity_embedding_outputÚencoder_outputsÚsequence_outputru  s   &&&&&&&&&&&&&,          r#   r‘   ÚLukeModel.forward2  s�  € ðR 2CÒ1NÑ-ÐTX×T_ÑT_×TqÑTqÐà$8Ò$DÑ È$Ï+É+×JjÑJjð 	ð &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆàÒ  ]Ò%>ÜÐcÓdÐdØÒ"Ø×6Ñ6°yÔQØ#Ÿ.™.Ó*‰KØÒ&Ø'×,Ñ,Ó.¨s°Ð3‰KäÐTÓUÐUà!,Ñˆ
�JØ%.Ò%:�×!Ò!À×@TÑ@TˆàÒ!Ü"ŸZšZ¨°ZÐ(@ÈÔPˆNØÒ!Ü"Ÿ[š[¨¼E¿J¹JÈvÔVˆNØÒ!Ø *§¡°Ó 2ÐØ$Ò,Ü(-¯
ª
°JÐ@QÐ3RÐ[aÔ(bÐ%Ø$Ò,Ü(-¯ª°ZÐARÐ4SÔ[`×[eÑ[eÐntÔ(uÐ%ð !%§¡ØØ%Ø)Ø'ð	 !0ó !
Ðð !Ò,Ü"ŸYšY¨Ð'NÐTVÔWˆNä2Ø—;‘;à(¨Õ3×6Ñ6Ð7L×7RÑ7RÓSØ)ô	
ˆð ÒØ&*Ñ#à&*×&<Ñ&<¸ZÐ^sÓ&tÐ#ð Ÿ,™,Ø!Ø#Ø)Ø/Ø!5Ø#ð 'ó 
ˆð *¨!Õ,ˆð 9=¿¹Ò8O˜Ÿ™ OÔ4ÐUYˆçØ# ]Ð3°oÀbÕ6IÕIÐIä-Ø-Ø'Ø)×7Ñ7Ø&×1Ñ1Ø%4×%MÑ%MØ!0×!EÑ!Eô
ð 	
r&   )r}   r�   r§  r¦   r¨  )T)NNNNNNNNNNNN)r)   r*   r+   r,   rl   r®  r²  r¶  r¹  r   r‘   r/   r0   r™   rš   s   @@r#   r¡  r¡    sE   ù‡ € ÷õ ò"/ò0ò8ò9ð ÷X
ñ X
ó ÷X
ð X
r&   r¡  c                óÊ   € V P                  V4      P                  4       p\        P                  ! V^R7      P	                  V4      V,          pVP                  4       V,           # )zí
Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols
are ignored. This is modified from fairseq's `utils.make_positions`.

Args:
    x: torch.Tensor x:

Returns: torch.Tensor
r¯   )ÚnerÂ   r   Úcumsumr´   rŠ   )rŒ   rh   ÚmaskÚincremental_indicess   &&  r#   r…   r…   Î  sP   € ð �<‰<˜Ó$×(Ñ(Ó*€DÜ Ÿ<š<¨°!Ô4×<Ñ<¸TÓBÀdÕJÐØ×#Ñ#Ó%¨Õ3Ð3r&   c                   ó<   a a€ ] tR tRt oRtV 3R ltR tRtVtV ;t	# )Ú
LukeLMHeadiß  z*Roberta Head for masked language modeling.c                ó¸  <€ \         SV `  4        \        P                  ! VP                  VP                  4      V n        \        P                  ! VP                  VP                  R 7      V n        \        P                  ! VP                  VP                  4      V n
        \        P                  ! \        P                  ! VP                  4      4      V n        R# r  )rk   rl   r   r§   ro   r  rv   rw   Ú
layer_normrn   r‚  rƒ  r   r‰   r£   r{   s   &&€r#   rl   ÚLukeLMHead.__init__â  s‡   ø€ Ü‰ÑÔÜ—Y’Y˜v×1Ñ1°6×3EÑ3EÓFˆŒ
ÜŸ,š, v×'9Ñ'9¸v×?TÑ?TÔUˆŒä—y’y ×!3Ñ!3°V×5FÑ5FÓGˆŒÜ—L’L¤§¢¨V×->Ñ->Ó!?Ó@ˆŽ	r&   c                ó‚   € V P                  V4      p\        V4      pV P                  V4      pV P                  V4      pV# r¸   )r  r	   rÔ  r‚  )r|   ÚfeaturesrÃ  rÑ   s   &&, r#   r‘   ÚLukeLMHead.forwardê  s;   € Ø�J‰J�xÓ ˆÜ�‹GˆØ�O‰O˜AÓˆð �L‰L˜‹Oˆàˆr&   )r£   r‚  r  rÔ  )
r)   r*   r+   r,   r-   rl   r‘   r/   r0   r™   rš   s   @@r#   rÒ  rÒ  ß  s   ù‡ € Ù4õA÷ò r&   rÒ  z—
    The LUKE model with a language modeling head and entity prediction head on top for masked language modeling and
    masked entity prediction.
    c                   ój   a a€ ] tR tRt oRRRR/tV 3R ltR tR t]RV3R	 lR
 ll4       t	Rt
VtV ;t# )ÚLukeForMaskedLMiõ  z!entity_predictions.decoder.weightz/luke.entity_embeddings.entity_embeddings.weightzlm_head.biaszlm_head.decoder.biasc                óÚ   <€ \         SV `  V4       \        V4      V n        \	        V4      V n        \        V4      V n        \        P                  ! 4       V n
        V P                  4        R # r¸   )rk   rl   r¡  r‰  rÒ  Úlm_headr  Úentity_predictionsr   r   Úloss_fnr©  r{   s   &&€r#   rl   ÚLukeForMaskedLM.__init__  sQ   ø€ Ü‰Ñ˜Ô ä˜fÓ%ˆŒ	ä! &Ó)ˆŒÜ"6°vÓ">ˆÔä×*Ò*Ó,ˆŒð 	�‰Ör&   c                ó.   € V P                   P                  # r¸   ©rÜ  r‚  r­  s   &r#   Úget_output_embeddingsÚ%LukeForMaskedLM.get_output_embeddings  s   € Ø�|‰|×#Ñ#Ð#r&   c                ó&   € WP                   n        R # r¸   rá  )r|   Únew_embeddingss   &&r#   Úset_output_embeddingsÚ%LukeForMaskedLM.set_output_embeddings  s   € Ø-�‰Ör&   c                ó$  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# )r   rŒ   Nrá   r�   r‹   r«   r¼  r½  r¾  ÚlabelsÚentity_labelsrŽ   râ   rb  rc  r  )r   r¬   r   r¤  r    r7   )r!   r"   s   "€r#   r$   ÚLukeForMaskedLM.__annotate__  s=  ø€ ÷ p
ñ p
á×#Ñ# dÕ*ðp
ñ ×)Ñ)¨DÕ0ðp
ñ ×(Ñ(¨4Õ/ð	p
ñ
 ×&Ñ&¨Õ-ðp
ñ ×$Ñ$ tÕ+ðp
ñ  %×/Ñ/°$Õ6ðp
ñ  %×/Ñ/°$Õ6ðp
ñ #×-Ñ-°Õ4ðp
ñ × Ñ  4Õ'ðp
ñ ×'Ñ'¨$Õ.ðp
ñ ×(Ñ(¨4Õ/ðp
ñ   $�;ðp
ñ # T�kðp
ñ ˜D•[ðp
ñ" 
Ñ#Õ	#ñ#p
r&   c                óô  € Ve   TMV P                   P                  pV P                  VVVVVVVVVVVRR7      pRpRpV P                  VP                  4      pV	eg   V	P                  VP                  4      p	V P                  VP                  RV P                   P                  4      V	P                  R4      4      pVf   TpRpRpVP                  eu   V P                  VP                  4      pV
eV   V P                  VP                  RV P                   P                  4      V
P                  R4      4      pVf   TpM	VV,           pV'       gy   \        ;QJ d:    . R VVVVVVP                  VP                  VP                   3 4       F  NK  	  5# ! R VVVVVVP                  VP                  VP                   3 4       4      # \#        VVVVVVP                  VP                  VP                   R7      # )a{  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
    Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
    config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
    loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`
entity_labels (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
    config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
    loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`
NT©rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   râ   rb  rc  c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú*LukeForMaskedLM.forward.<locals>.<genexpr>m  s"   é € ð ñ	�Að ÷ ’ó	ùr_  )r9   r:   r;   r<   r=   r>   r   r?   r„   )r}   rc  r‰  rÜ  r`  r†   rƒ   rÞ  rÏ   rn   r   rÝ  r¤   r    r>   r   r?   r7   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  ré  rê  rŽ   râ   rb  rc  rÃ  rü   r9   r:   r<   r;   r=   s   &&&&&&&&&&&&&&&,      r#   r‘   ÚLukeForMaskedLM.forward  s  € ðb &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð ˆàˆØ—‘˜g×7Ñ7Ó8ˆØÒà—Y‘Y˜vŸ}™}Ó-ˆFØ—|‘| F§K¡K°°D·K±K×4JÑ4JÓ$KÈVÏ[É[ÐY[Ë_Ó]ˆHØŠ|Ø�àˆØˆØ×+Ñ+Ò7Ø ×3Ñ3°G×4TÑ4TÓUˆMØÒ(ØŸ<™<¨×(:Ñ(:¸2¸t¿{¹{×?\Ñ?\Ó(]Ð_l×_qÑ_qÐrtÓ_uÓv�Ø’<Ø#‘Dà (�?�Dçß”5ñ ð ØØØØ!Ø×)Ñ)Ø×0Ñ0Ø×&Ñ&ñ	ó—5ð �5ñ ð ØØØØ!Ø×)Ñ)Ø×0Ñ0Ø×&Ñ&ñ	óó ð ô "ØØØØØ'Ø!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô	
ð 		
r&   )rÝ  rÜ  rÞ  r‰  ©NNNNNNNNNNNNNN)r)   r*   r+   r,   Ú_tied_weights_keysrl   râ  ræ  r   r‘   r/   r0   r™   rš   s   @@r#   rÚ  rÚ  õ  sL   ù‡ € ð 	,Ð-^ØÐ.ðÐõ
ò$ò.ð ÷p
ñ p
ó ÷p
ð p
r&   rÚ  zº
    The LUKE model with a classification head on top (a linear layer on top of the hidden state of the first entity
    token) for entity classification tasks, such as Open Entity.
    c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForEntityClassificationiˆ  c                ó2  <€ \         SV `  V4       \        V4      V n        VP                  V n        \
        P                  ! VP                  4      V n        \
        P                  ! VP                  VP                  4      V n        V P                  4        R # r¸   ©rk   rl   r¡  r‰  Ú
num_labelsr   rx   ry   rz   r§   ro   Ú
classifierr©  r{   s   &&€r#   rl   Ú$LukeForEntityClassification.__init__�  si   ø€ Ü‰Ñ˜Ô ä˜fÓ%ˆŒ	à ×+Ñ+ˆŒÜ—z’z &×"<Ñ"<Ó=ˆŒÜŸ)š) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Ör&   c                óü  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# ©r   rŒ   Nrá   r�   r‹   r«   r¼  r½  r¾  rŽ   ré  râ   rb  rc  r  )r   r¬   r   r¤  r    rB   )r!   r"   s   "€r#   r$   Ú(LukeForEntityClassification.__annotate__œ  s'  ø€ ÷ j
ñ j
á×#Ñ# dÕ*ðj
ñ ×)Ñ)¨DÕ0ðj
ñ ×(Ñ(¨4Õ/ð	j
ñ
 ×&Ñ&¨Õ-ðj
ñ ×$Ñ$ tÕ+ðj
ñ  %×0Ñ0°4Õ7ðj
ñ  %×/Ñ/°$Õ6ðj
ñ #×-Ñ-°Õ4ðj
ñ ×(Ñ(¨4Õ/ðj
ñ ×!Ñ! DÕ(ðj
ñ   $�;ðj
ñ # T�kðj
ñ ˜D•[ðj
ñ  
Ñ+Õ	+ñ!j
r&   c                ón  € Ve   TMV P                   P                  pV P                  VVVVVVVVV	VVRR7      pVP                  R,          pV P	                  V4      pV P                  V4      pRpV
e›   V
P                  VP                  4      p
V
P                  ^8X  d"   \        P                  P                  VV
4      pMM\        P                  P                  VP                  R4      V
P                  R4      P                  V4      4      pV'       gs   \        ;QJ d7    . R VVVP                   VP"                  VP$                  3 4       F  NK  	  5# ! R VVVP                   VP"                  VP$                  3 4       4      # \'        VVVP                   VP"                  VP$                  R7      # )u˜	  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
labels (`torch.LongTensor` of shape `(batch_size,)` or `(batch_size, num_labels)`, *optional*):
    Labels for computing the classification loss. If the shape is `(batch_size,)`, the cross entropy loss is
    used for the single-label classification. In this case, labels should contain the indices that should be in
    `[0, ..., config.num_labels - 1]`. If the shape is `(batch_size, num_labels)`, the binary cross entropy
    loss is used for the multi-label classification. In this case, labels should only contain `[0, 1]`, where 0
    and 1 indicate false and true, respectively.

Examples:

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

>>> tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-large-finetuned-open-entity")
>>> model = LukeForEntityClassification.from_pretrained("studio-ousia/luke-large-finetuned-open-entity")

>>> text = "BeyoncÃ© lives in Los Angeles."
>>> entity_spans = [(0, 7)]  # character-based entity span corresponding to "BeyoncÃ©"
>>> inputs = tokenizer(text, entity_spans=entity_spans, return_tensors="pt")
>>> outputs = model(**inputs)
>>> logits = outputs.logits
>>> predicted_class_idx = logits.argmax(-1).item()
>>> print("Predicted class:", model.config.id2label[predicted_class_idx])
Predicted class: person
```NTrí  c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú6LukeForEntityClassification.forward.<locals>.<genexpr>ú  ó   é € ð áp�AØ÷ ’Ûpùr_  ©r9   r<   r>   r   r?   ©r×   r¡   r×   r„   )r}   rc  r‰  r   rz   rø  r†   rƒ   Úndimr   rÝ   Úcross_entropyÚ binary_cross_entropy_with_logitsrÏ   r´   r    r>   r   r?   rB   ©r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   ré  râ   rb  rc  rÃ  rü   Úfeature_vectorr<   r9   s   &&&&&&&&&&&&&&,    r#   r‘   Ú#LukeForEntityClassification.forward›  sš  € ð| &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð !×9Ñ9¸'ÕBˆØŸ™ nÓ5ˆØ—‘ Ó0ˆàˆØÒð —Y‘Y˜vŸ}™}Ó-ˆFØ�{‰{˜aÔÜ—}‘}×2Ñ2°6¸6ÓB‘ä—}‘}×EÑEÀfÇkÁkÐRTÃoÐW]×WbÑWbÐceÓWf×WnÑWnÐouÓWvÓw�çß”5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpó—5ð �5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpóó ð ô *ØØØ!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   ©rø  rz   r‰  r÷  ©NNNNNNNNNNNNN©
r)   r*   r+   r,   rl   r   r‘   r/   r0   r™   rš   s   @@r#   rô  rô  ˆ  s,   ù‡ € õ
ð ÷j
ñ j
ó ÷j
ð j
r&   rô  zº
    The LUKE model with a classification head on top (a linear layer on top of the hidden states of the two entity
    tokens) for entity pair classification tasks, such as TACRED.
    c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForEntityPairClassificationi	  c                óB  <€ \         SV `  V4       \        V4      V n        VP                  V n        \
        P                  ! VP                  4      V n        \
        P                  ! VP                  ^,          VP                  R4      V n        V P                  4        R# )r   FNrö  r{   s   &&€r#   rl   Ú(LukeForEntityPairClassification.__init__  sp   ø€ Ü‰Ñ˜Ô ä˜fÓ%ˆŒ	à ×+Ñ+ˆŒÜ—z’z &×"<Ñ"<Ó=ˆŒÜŸ)š) F×$6Ñ$6¸Õ$:¸F×<MÑ<MÈuÓUˆŒð 	�‰Ör&   c                óü  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# rû  )r   r¬   r   r¤  r    rK   )r!   r"   s   "€r#   r$   Ú,LukeForEntityPairClassification.__annotate__  s'  ø€ ÷ o
ñ o
á×#Ñ# dÕ*ðo
ñ ×)Ñ)¨DÕ0ðo
ñ ×(Ñ(¨4Õ/ð	o
ñ
 ×&Ñ&¨Õ-ðo
ñ ×$Ñ$ tÕ+ðo
ñ  %×0Ñ0°4Õ7ðo
ñ  %×/Ñ/°$Õ6ðo
ñ #×-Ñ-°Õ4ðo
ñ ×(Ñ(¨4Õ/ðo
ñ × Ñ  4Õ'ðo
ñ   $�;ðo
ñ # T�kðo
ñ ˜D•[ðo
ñ  
Ñ/Õ	/ñ!o
r&   c                óÀ  € Ve   TMV P                   P                  pV P                  VVVVVVVVV	VVRR7      p\        P                  ! VP
                  R,          VP
                  R,          .^R7      pV P                  V4      pV P                  V4      pRpV
e›   V
P                  VP                  4      p
V
P                  ^8X  d"   \        P                  P                  VV
4      pMM\        P                  P                  VP                  R	4      V
P                  R	4      P!                  V4      4      pV'       gs   \"        ;QJ d7    . R VVVP$                  VP&                  VP(                  3 4       F  NK  	  5# ! R VVVP$                  VP&                  VP(                  3 4       4      # \+        VVVP$                  VP&                  VP(                  R7      # )
uÛ	  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
labels (`torch.LongTensor` of shape `(batch_size,)` or `(batch_size, num_labels)`, *optional*):
    Labels for computing the classification loss. If the shape is `(batch_size,)`, the cross entropy loss is
    used for the single-label classification. In this case, labels should contain the indices that should be in
    `[0, ..., config.num_labels - 1]`. If the shape is `(batch_size, num_labels)`, the binary cross entropy
    loss is used for the multi-label classification. In this case, labels should only contain `[0, 1]`, where 0
    and 1 indicate false and true, respectively.

Examples:

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

>>> tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-large-finetuned-tacred")
>>> model = LukeForEntityPairClassification.from_pretrained("studio-ousia/luke-large-finetuned-tacred")

>>> text = "BeyoncÃ© lives in Los Angeles."
>>> entity_spans = [
...     (0, 7),
...     (17, 28),
... ]  # character-based entity spans corresponding to "BeyoncÃ©" and "Los Angeles"
>>> inputs = tokenizer(text, entity_spans=entity_spans, return_tensors="pt")
>>> outputs = model(**inputs)
>>> logits = outputs.logits
>>> predicted_class_idx = logits.argmax(-1).item()
>>> print("Predicted class:", model.config.id2label[predicted_class_idx])
Predicted class: per:cities_of_residence
```NTrí  r¯   c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú:LukeForEntityPairClassification.forward.<locals>.<genexpr>€  r   r_  r  r  )r×   rÖ   r×   r„   )r}   rc  r‰  r   rØ   r   rz   rø  r†   rƒ   r  r   rÝ   r  r  rÏ   r´   r    r>   r   r?   rK   r  s   &&&&&&&&&&&&&&,    r#   r‘   Ú'LukeForEntityPairClassification.forward  s¼  € ðB &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆô ŸšØ×-Ñ-¨gÕ6¸×8XÑ8XÐY`Õ8aÐbÐhiô
ˆð Ÿ™ nÓ5ˆØ—‘ Ó0ˆàˆØÒð —Y‘Y˜vŸ}™}Ó-ˆFØ�{‰{˜aÔÜ—}‘}×2Ñ2°6¸6ÓB‘ä—}‘}×EÑEÀfÇkÁkÐRTÃoÐW]×WbÑWbÐceÓWf×WnÑWnÐouÓWvÓw�çß”5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpó—5ð �5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpóó ð ô .ØØØ!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   r	  r
  r  rš   s   @@r#   r  r  	  s,   ù‡ € õ
ð ÷o
ñ o
ó ÷o
ð o
r&   r  z£
    The LUKE model with a span classification head on top (a linear layer on top of the hidden states output) for tasks
    such as named entity recognition.
    c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForEntitySpanClassificationi�  c                ó@  <€ \         SV `  V4       \        V4      V n        VP                  V n        \
        P                  ! VP                  4      V n        \
        P                  ! VP                  ^,          VP                  4      V n        V P                  4        R# )é   Nrö  r{   s   &&€r#   rl   Ú(LukeForEntitySpanClassification.__init__–  sn   ø€ Ü‰Ñ˜Ô ä˜fÓ%ˆŒ	à ×+Ñ+ˆŒÜ—z’z &×"<Ñ"<Ó=ˆŒÜŸ)š) F×$6Ñ$6¸Õ$:¸F×<MÑ<MÓNˆŒð 	�‰Ör&   c          !      óL  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# )r   rŒ   Nrá   r�   r‹   r«   r¼  r½  r¾  Úentity_start_positionsÚentity_end_positionsrŽ   ré  râ   rb  rc  r  )r   r¬   r   r¤  r    rO   )r!   r"   s   "€r#   r$   Ú,LukeForEntitySpanClassification.__annotate__£  sS  ø€ ÷ G
ñ G
á×#Ñ# dÕ*ðG
ñ ×)Ñ)¨DÕ0ðG
ñ ×(Ñ(¨4Õ/ð	G
ñ
 ×&Ñ&¨Õ-ðG
ñ ×$Ñ$ tÕ+ðG
ñ  %×/Ñ/°$Õ6ðG
ñ  %×/Ñ/°$Õ6ðG
ñ #×-Ñ-°Õ4ðG
ñ !&× 0Ñ 0°4Õ 7ðG
ñ $×.Ñ.°Õ5ðG
ñ ×(Ñ(¨4Õ/ðG
ñ × Ñ  4Õ'ðG
ñ   $�;ðG
ñ # T�kðG
ñ  ˜D•[ð!G
ñ$ 
Ñ/Õ	/ñ%G
r&   c                óR  € Ve   TMV P                   P                  pV P                  VVVVVVVVVVVRR7      pVP                  P	                  R4      pV	P                  R4      P                  RRV4      p	V	P                  VP                  P                  8w  d&   V	P                  VP                  P                  4      p	\        P                  ! VP                  RV	4      pV
P                  R4      P                  RRV4      p
V
P                  VP                  P                  8w  d&   V
P                  VP                  P                  4      p
\        P                  ! VP                  RV
4      p\        P                  ! VVVP                  .^R7      pV P                  V4      pV P                  V4      pRpVeÄ   VP                  VP                  4      pVP                  ^8X  dK   \         P"                  P%                  VP'                  RV P(                  4      VP'                  R4      4      pMM\         P"                  P+                  VP'                  R4      VP'                  R4      P-                  V4      4      pV'       gs   \.        ;QJ d7    . R VVVP0                  VP2                  VP4                  3 4       F  NK  	  5# ! R VVVP0                  VP2                  VP4                  3 4       4      # \7        VVVP0                  VP2                  VP4                  R7      # )	uŽ  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
entity_start_positions (`torch.LongTensor`):
    The start positions of entities in the word token sequence.
entity_end_positions (`torch.LongTensor`):
    The end positions of entities in the word token sequence.
labels (`torch.LongTensor` of shape `(batch_size, entity_length)` or `(batch_size, entity_length, num_labels)`, *optional*):
    Labels for computing the classification loss. If the shape is `(batch_size, entity_length)`, the cross
    entropy loss is used for the single-label classification. In this case, labels should contain the indices
    that should be in `[0, ..., config.num_labels - 1]`. If the shape is `(batch_size, entity_length,
    num_labels)`, the binary cross entropy loss is used for the multi-label classification. In this case,
    labels should only contain `[0, 1]`, where 0 and 1 indicate false and true, respectively.

Examples:

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

>>> tokenizer = AutoTokenizer.from_pretrained("studio-ousia/luke-large-finetuned-conll-2003")
>>> model = LukeForEntitySpanClassification.from_pretrained("studio-ousia/luke-large-finetuned-conll-2003")

>>> text = "BeyoncÃ© lives in Los Angeles"
# List all possible entity spans in the text

>>> word_start_positions = [0, 8, 14, 17, 21]  # character-based start positions of word tokens
>>> word_end_positions = [7, 13, 16, 20, 28]  # character-based end positions of word tokens
>>> entity_spans = []
>>> for i, start_pos in enumerate(word_start_positions):
...     for end_pos in word_end_positions[i:]:
...         entity_spans.append((start_pos, end_pos))

>>> inputs = tokenizer(text, entity_spans=entity_spans, return_tensors="pt")
>>> outputs = model(**inputs)
>>> logits = outputs.logits
>>> predicted_class_indices = logits.argmax(-1).squeeze().tolist()
>>> for span, predicted_class_idx in zip(entity_spans, predicted_class_indices):
...     if predicted_class_idx != 0:
...         print(text[span[0] : span[1]], model.config.id2label[predicted_class_idx])
BeyoncÃ© PER
Los Angeles LOC
```NTrí  r¯   c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú:LukeForEntitySpanClassification.forward.<locals>.<genexpr>  r   r_  r  r„   r±   )r}   rc  r‰  r`  rˆ   r•   r–   rƒ   r†   r   ÚgatherrØ   r   rz   rø  r  r   rÝ   r  rÏ   r÷  r  r´   r    r>   r   r?   rO   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  r  r  rŽ   ré  râ   rb  rc  rÃ  rü   ro   Ústart_statesÚ
end_statesr  r<   r9   s   &&&&&&&&&&&&&&&&,       r#   r‘   Ú'LukeForEntitySpanClassification.forward¢  s½  € ð^ &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð ×/Ñ/×4Ñ4°RÓ8ˆà!7×!AÑ!AÀ"Ó!E×!LÑ!LÈRÐQSÐU`Ó!aÐØ!×(Ñ(¨G×,EÑ,E×,LÑ,LÔLØ%;×%>Ñ%>¸w×?XÑ?X×?_Ñ?_Ó%`Ð"Ü—|’| G×$=Ñ$=¸rÐCYÓZˆà3×=Ñ=¸bÓA×HÑHÈÈRÐQ\Ó]ÐØ×&Ñ&¨'×*CÑ*C×*JÑ*JÔJØ#7×#:Ñ#:¸7×;TÑ;T×;[Ñ;[Ó#\Ð Ü—\’\ '×";Ñ";¸RÐAUÓVˆ
äŸš L°*¸g×>^Ñ>^Ð#_ÐefÔgˆàŸ™ nÓ5ˆØ—‘ Ó0ˆàˆØÒà—Y‘Y˜vŸ}™}Ó-ˆFð �{‰{˜aÔÜ—}‘}×2Ñ2°6·;±;¸rÀ4Ç?Á?Ó3SÐU[×U`ÑU`ÐacÓUdÓe‘ä—}‘}×EÑEÀfÇkÁkÐRTÃoÐW]×WbÑWbÐceÓWf×WnÑWnÐouÓWvÓw�çß”5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpó—5ð �5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpóó ð ô .ØØØ!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   r	  )NNNNNNNNNNNNNNNr  rš   s   @@r#   r  r  �  s,   ù‡ € õ
ð ÷G
ñ G
ó ÷G
ð G
r&   r  z 
    The LUKE Model transformer with a sequence classification/regression head on top (a linear layer on top of the
    pooled output) e.g. for GLUE tasks.
    c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForSequenceClassificationi-  c                óf  <€ \         SV `  V4       VP                  V n        \        V4      V n        \
        P                  ! VP                  e   VP                  MVP                  4      V n	        \
        P                  ! VP                  VP                  4      V n        V P                  4        R # r¸   ©rk   rl   r÷  r¡  r‰  r   rx   Úclassifier_dropoutry   rz   r§   ro   rø  r©  r{   s   &&€r#   rl   Ú&LukeForSequenceClassification.__init__4  s‚   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒÜ˜fÓ%ˆŒ	Ü—z’zØ)/×)BÑ)BÒ)NˆF×%Ò%ÐTZ×TnÑTnó
ˆŒô Ÿ)š) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Ör&   c                óü  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# rû  )r   r¬   r   r¤  r    rS   )r!   r"   s   "€r#   r$   Ú*LukeForSequenceClassification.__annotate__A  s'  ø€ ÷ f
ñ f
á×#Ñ# dÕ*ðf
ñ ×)Ñ)¨DÕ0ðf
ñ ×(Ñ(¨4Õ/ð	f
ñ
 ×&Ñ&¨Õ-ðf
ñ ×$Ñ$ tÕ+ðf
ñ  %×0Ñ0°4Õ7ðf
ñ  %×/Ñ/°$Õ6ðf
ñ #×-Ñ-°Õ4ðf
ñ ×(Ñ(¨4Õ/ðf
ñ ×!Ñ! DÕ(ðf
ñ   $�;ðf
ñ # T�kðf
ñ ˜D•[ðf
ñ  
Ñ-Õ	-ñ!f
r&   c                ó–  € Ve   TMV P                   P                  pV P                  VVVVVVVVV	VVRR7      pVP                  pV P	                  V4      pV P                  V4      pRpV
Eeµ   V
P                  VP                  4      p
V P                   P                  f–   V P                  ^8X  d   RV P                   n        MrV P                  ^8”  dQ   V
P                  \        P                  8X  g    V
P                  \        P                  8X  d   RV P                   n        MRV P                   n        V P                   P                  R8X  dL   \        4       pV P                  ^8X  d'   V! VP                  4       V
P                  4       4      pM�V! VV
4      pM†V P                   P                  R8X  d>   \!        4       pV! VP#                  R	V P                  4      V
P#                  R	4      4      pM.V P                   P                  R8X  d   \%        4       pV! VV
4      pV'       gs   \&        ;QJ d7    . R VVVP(                  VP*                  VP,                  3 4       F  NK  	  5# ! R VVVP(                  VP*                  VP,                  3 4       4      # \/        VVVP(                  VP*                  VP,                  R7      # )
aè  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
    Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
    config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
    `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
NTrí  Ú
regressionÚsingle_label_classificationÚmulti_label_classificationc              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú8LukeForSequenceClassification.forward.<locals>.<genexpr>›  r   r_  r  r„   )r}   rc  r‰  rÀ  rz   rø  r†   rƒ   Úproblem_typer÷  r‚   r   rŠ   rÂ   r   Úsqueezer   rÏ   r   r    r>   r   r?   rS   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   ré  râ   rb  rc  rÃ  rü   ru  r<   r9   Úloss_fcts   &&&&&&&&&&&&&&,     r#   r‘   Ú%LukeForSequenceClassification.forward@  sV  € ðV &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð  ×-Ñ-ˆàŸ™ ]Ó3ˆØ—‘ Ó/ˆàˆØÓà—Y‘Y˜vŸ}™}Ó-ˆFØ�{‰{×'Ñ'Ò/Ø—?‘? aÔ'Ø/;�D—K‘KÕ,Ø—_‘_ qÔ(¨f¯l©l¼e¿j¹jÔ.HÈFÏLÉLÔ\a×\eÑ\eÔLeØ/L�D—K‘KÕ,à/K�D—K‘KÔ,à�{‰{×'Ñ'¨<Ô7Ü"›9�Ø—?‘? aÔ'Ù# F§N¡NÓ$4°f·n±nÓ6FÓG‘Dá# F¨FÓ3‘DØ—‘×)Ñ)Ð-JÔJÜ+Ó-�Ù §¡¨B°·±Ó @À&Ç+Á+ÈbÃ/ÓR‘Ø—‘×)Ñ)Ð-IÔIÜ,Ó.�Ù ¨Ó/�çß”5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpó—5ð �5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpóó ð ô ,ØØØ!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   r	  r
  r  rš   s   @@r#   r'  r'  -  s,   ù‡ € õ
ð ÷f
ñ f
ó ÷f
ð f
r&   r'  zú
    The LUKE Model with a token classification head on top (a linear layer on top of the hidden-states output). To
    solve Named-Entity Recognition (NER) task using LUKE, `LukeForEntitySpanClassification` is more suitable than this
    class.
    c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForTokenClassificationiª  c                ój  <€ \         SV `  V4       VP                  V n        \        VR R7      V n        \
        P                  ! VP                  e   VP                  MVP                  4      V n	        \
        P                  ! VP                  VP                  4      V n        V P                  4        R# ©F)r£  Nr)  r{   s   &&€r#   rl   Ú#LukeForTokenClassification.__init__²  s„   ø€ Ü‰Ñ˜Ô Ø ×+Ñ+ˆŒä˜f¸Ô>ˆŒ	Ü—z’zØ)/×)BÑ)BÒ)NˆF×%Ò%ÐTZ×TnÑTnó
ˆŒô Ÿ)š) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Ör&   c                óü  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# rû  )r   r¬   r   r¤  r    rW   )r!   r"   s   "€r#   r$   Ú'LukeForTokenClassification.__annotate__À  s'  ø€ ÷ T
ñ T
á×#Ñ# dÕ*ðT
ñ ×)Ñ)¨DÕ0ðT
ñ ×(Ñ(¨4Õ/ð	T
ñ
 ×&Ñ&¨Õ-ðT
ñ ×$Ñ$ tÕ+ðT
ñ  %×0Ñ0°4Õ7ðT
ñ  %×/Ñ/°$Õ6ðT
ñ #×-Ñ-°Õ4ðT
ñ ×(Ñ(¨4Õ/ðT
ñ ×!Ñ! DÕ(ðT
ñ   $�;ðT
ñ # T�kðT
ñ ˜D•[ðT
ñ  
Ñ*Õ	*ñ!T
r&   c                óÚ  € Ve   TMV P                   P                  pV P                  VVVVVVVVV	VVRR7      pVP                  pV P	                  V4      pV P                  V4      pRpV
eX   V
P                  VP                  4      p
\        4       pV! VP                  RV P                  4      V
P                  R4      4      pV'       gs   \        ;QJ d7    . R VVVP                  VP                  VP                  3 4       F  NK  	  5# ! R VVVP                  VP                  VP                  3 4       4      # \        VVVP                  VP                  VP                  R7      # )a¥  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
    Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
    num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
    `input_ids` above)
NTrí  c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú5LukeForTokenClassification.forward.<locals>.<genexpr>  r   r_  r  r„   )r}   rc  r‰  r`  rz   rø  r†   rƒ   r   rÏ   r÷  r    r>   r   r?   rW   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   ré  râ   rb  rc  rÃ  rü   rÊ  r<   r9   r6  s   &&&&&&&&&&&&&&,     r#   r‘   Ú"LukeForTokenClassification.forward¿  sd  € ðV &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð "×3Ñ3ˆàŸ,™, Ó7ˆØ—‘ Ó1ˆàˆØÒà—Y‘Y˜vŸ}™}Ó-ˆFÜ'Ó)ˆHÙ˜FŸK™K¨¨D¯O©OÓ<¸f¿k¹kÈ"»oÓNˆDçß”5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpó—5ð �5ñ à ¨×(=Ñ(=¸w×?[Ñ?[Ð]d×]oÑ]oÑpóó ð ô )ØØØ!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   r	  r
  r  rš   s   @@r#   r9  r9  ª  s,   ù‡ € õð ÷T
ñ T
ó ÷T
ð T
r&   r9  c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForQuestionAnsweringi  c                óì   <€ \         SV `  V4       VP                  V n        \        VR R7      V n        \
        P                  ! VP                  VP                  4      V n        V P                  4        R# r;  )
rk   rl   r÷  r¡  r‰  r   r§   ro   Ú
qa_outputsr©  r{   s   &&€r#   rl   Ú!LukeForQuestionAnswering.__init__  sU   ø€ Ü‰Ñ˜Ô à ×+Ñ+ˆŒä˜f¸Ô>ˆŒ	ÜŸ)š) F×$6Ñ$6¸×8IÑ8IÓJˆŒð 	�‰Ör&   c                ó$  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# )r   rŒ   Nrá   r�   r‹   r«   r¼  r½  r¾  rŽ   Ústart_positionsÚend_positionsrâ   rb  rc  r  )r   r¬   r   r¤  r    r[   )r!   r"   s   "€r#   r$   Ú%LukeForQuestionAnswering.__annotate__%  s=  ø€ ÷ e
ñ e
á×#Ñ# dÕ*ðe
ñ ×)Ñ)¨DÕ0ðe
ñ ×(Ñ(¨4Õ/ð	e
ñ
 ×'Ñ'¨$Õ.ðe
ñ ×$Ñ$ tÕ+ðe
ñ  %×0Ñ0°4Õ7ðe
ñ  %×/Ñ/°$Õ6ðe
ñ #×-Ñ-°Õ4ðe
ñ ×(Ñ(¨4Õ/ðe
ñ ×)Ñ)¨DÕ0ðe
ñ ×'Ñ'¨$Õ.ðe
ñ   $�;ðe
ñ # T�kðe
ñ ˜D•[ðe
ñ" 
Ñ1Õ	1ñ#e
r&   c                ó
  € Ve   TMV P                   P                  pV P                  VVVVVVVVV	VVRR7      pVP                  pV P	                  V4      pVP                  ^RR7      w  ppVP                  R4      pVP                  R4      pRpV
eÆ   VeÂ   \        V
P                  4       4      ^8”  d   V
P                  R4      p
\        VP                  4       4      ^8”  d   VP                  R4      pVP                  ^4      pV
P                  ^ V4       VP                  ^ V4       \        VR7      pV! VV
4      pV! VV4      pVV,           ^,          pV'       gu   \        ;QJ d8    . R VVVVP                  VP                  VP                  3 4       F  NK  	  5# ! R VVVVP                  VP                  VP                  3 4       4      # \        VVVVP                  VP                  VP                  R7      # )	a„  
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
NTrí  r¯   )Úignore_indexc              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú3LukeForQuestionAnswering.forward.<locals>.<genexpr>v  s"   é € ð ñ�Að ÷ ’óùr_  )r9   r]   r^   r>   r   r?   r„   )r}   rc  r‰  r`  rF  Úsplitr5  Úlenrˆ   Úclamp_r   r    r>   r   r?   r[   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   rI  rJ  râ   rb  rc  rÃ  rü   rÊ  r<   r]   r^   Ú
total_lossÚignored_indexr6  Ú
start_lossÚend_losss   &&&&&&&&&&&&&&&,          r#   r‘   Ú LukeForQuestionAnswering.forward$  s  € ðP &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆà—)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð "×3Ñ3ˆà—‘ Ó1ˆØ#)§<¡<°°r <Ó#:Ñ ˆ�jØ#×+Ñ+¨BÓ/ˆØ×'Ñ'¨Ó+ˆ
àˆ
ØÒ&¨=Ò+Dä�?×'Ñ'Ó)Ó*¨QÔ.Ø"1×"9Ñ"9¸"Ó"=�Ü�=×%Ñ%Ó'Ó(¨1Ô,Ø -× 5Ñ 5°bÓ 9�à(×-Ñ-¨aÓ0ˆMØ×"Ñ" 1 mÔ4Ø× Ñ   MÔ2ä'°]ÔCˆHÙ! ,°Ó@ˆJÙ 
¨MÓ:ˆHØ$ xÕ/°1Õ4ˆJçß”5ñ ð Ø ØØ×)Ñ)Ø×0Ñ0Ø×&Ñ&ñó—5ð �5ñ ð Ø ØØ×)Ñ)Ø×0Ñ0Ø×&Ñ&ñóó ð ô 0ØØ%Ø!Ø!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   )r‰  r÷  rF  rñ  r  rš   s   @@r#   rD  rD    s,   ù‡ € õ	ð ÷e
ñ e
ó ÷e
ð e
r&   rD  c                   óR   a a€ ] tR tRt oV 3R lt]RV3R lR ll4       tRtVtV ;t	# )ÚLukeForMultipleChoicei�  c                ó0  <€ \         SV `  V4       \        V4      V n        \        P
                  ! VP                  e   VP                  MVP                  4      V n        \        P                  ! VP                  ^4      V n        V P                  4        R # r¸   )rk   rl   r¡  r‰  r   rx   r*  ry   rz   r§   ro   rø  r©  r{   s   &&€r#   rl   ÚLukeForMultipleChoice.__init__�  so   ø€ Ü‰Ñ˜Ô ä˜fÓ%ˆŒ	Ü—z’zØ)/×)BÑ)BÒ)NˆF×%Ò%ÐTZ×TnÑTnó
ˆŒô Ÿ)š) F×$6Ñ$6¸Ó:ˆŒð 	�‰Ör&   c                óü  <€ V ^8„  d   QhRS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          RS[ P                  R,          R	S[ P                  R,          R
S[ P                  R,          RS[ P                  R,          RS[R,          RS[R,          RS[R,          RS[S[,          /# rû  )r   r¬   r   r¤  r    ra   )r!   r"   s   "€r#   r$   Ú"LukeForMultipleChoice.__annotate__œ  s'  ø€ ÷ O
ñ O
á×#Ñ# dÕ*ðO
ñ ×)Ñ)¨DÕ0ðO
ñ ×(Ñ(¨4Õ/ð	O
ñ
 ×&Ñ&¨Õ-ðO
ñ ×$Ñ$ tÕ+ðO
ñ  %×0Ñ0°4Õ7ðO
ñ  %×/Ñ/°$Õ6ðO
ñ #×-Ñ-°Õ4ðO
ñ ×(Ñ(¨4Õ/ðO
ñ ×!Ñ! DÕ(ðO
ñ   $�;ðO
ñ # T�kðO
ñ ˜D•[ðO
ñ  
Ñ.Õ	.ñ!O
r&   c                óþ  € Ve   TMV P                   P                  pVe   VP                  ^,          MV	P                  ^,          pVe"   VP                  RVP	                  R4      4      MRpVe"   VP                  RVP	                  R4      4      MRpVe"   VP                  RVP	                  R4      4      MRpVe"   VP                  RVP	                  R4      4      MRpV	e2   V	P                  RV	P	                  R4      V	P	                  R4      4      MRp	Ve"   VP                  RVP	                  R4      4      MRpVe"   VP                  RVP	                  R4      4      MRpVe"   VP                  RVP	                  R4      4      MRpVe2   VP                  RVP	                  R4      VP	                  R4      4      MRpV P                  VVVVVVVVV	VVRR7      pVP                  pV P                  V4      pV P                  V4      pVP                  RV4      pRpV
e/   V
P                  VP                  4      p
\        4       pV! VV
4      pV'       gs   \        ;QJ d7    . R VVVP                  VP                  VP                  3 4       F  NK  	  5# ! R VVVP                  VP                  VP                  3 4       4      # \!        VVVP                  VP                  VP                  R7      # )a  
input_ids (`torch.LongTensor` of shape `(batch_size, num_choices, sequence_length)`):
    Indices of input sequence tokens in the vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.

    [What are input IDs?](../glossary#input-ids)
token_type_ids (`torch.LongTensor` of shape `(batch_size, num_choices, sequence_length)`, *optional*):
    Segment token indices to indicate first and second portions of the inputs. Indices are selected in `[0,
    1]`:

    - 0 corresponds to a *sentence A* token,
    - 1 corresponds to a *sentence B* token.

    [What are token type IDs?](../glossary#token-type-ids)
position_ids (`torch.LongTensor` of shape `(batch_size, num_choices, sequence_length)`, *optional*):
    Indices of positions of each input sequence tokens in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.

    [What are position IDs?](../glossary#position-ids)
entity_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`):
    Indices of entity tokens in the entity vocabulary.

    Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and
    [`PreTrainedTokenizer.__call__`] for details.
entity_attention_mask (`torch.FloatTensor` of shape `(batch_size, entity_length)`, *optional*):
    Mask to avoid performing attention on padding entity token indices. Mask values selected in `[0, 1]`:

    - 1 for entity tokens that are **not masked**,
    - 0 for entity tokens that are **masked**.
entity_token_type_ids (`torch.LongTensor` of shape `(batch_size, entity_length)`, *optional*):
    Segment token indices to indicate first and second portions of the entity token inputs. Indices are
    selected in `[0, 1]`:

    - 0 corresponds to a *portion A* entity token,
    - 1 corresponds to a *portion B* entity token.
entity_position_ids (`torch.LongTensor` of shape `(batch_size, entity_length, max_mention_length)`, *optional*):
    Indices of positions of each input entity in the position embeddings. Selected in the range `[0,
    config.max_position_embeddings - 1]`.
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, num_choices, sequence_length, hidden_size)`, *optional*):
    Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation. This
    is useful if you want more control over how to convert `input_ids` indices into associated vectors than the
    model's internal embedding lookup matrix.
labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
    Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
    num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
    `input_ids` above)
NTrí  c              3   ó2   "  € T F  pVf   K	  Vx € K  	  R # 5ir¸   r'   rY  s   & r#   r\  Ú0LukeForMultipleChoice.forward.<locals>.<genexpr>  r^  r_  r  r„   r±   )r}   rc  ÚshaperÏ   rˆ   r‰  rÀ  rz   rø  r†   rƒ   r   r    r>   r   r?   ra   )r|   rŒ   rá   r�   r‹   r«   r¼  r½  r¾  rŽ   ré  râ   rb  rc  rÃ  Únum_choicesrü   ru  r<   Úreshaped_logitsr9   r6  s   &&&&&&&&&&&&&&,       r#   r‘   ÚLukeForMultipleChoice.forward›  s  € ðF &1Ò%<‘kÀ$Ç+Á+×BYÑBYˆØ,5Ò,A�i—o‘o aÖ(À}×GZÑGZÐ[\ÕG]ˆà>GÒ>S�I—N‘N 2 y§~¡~°bÓ'9Ô:ÐY]ˆ	ØM[ÒMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆØM[ÒMg˜×,Ñ,¨R°×1DÑ1DÀRÓ1HÔIÐmqˆØGSÒG_�|×(Ñ(¨¨\×->Ñ->¸rÓ-BÔCÐeiˆð Ò(ð ×Ñ˜r =×#5Ñ#5°bÓ#9¸=×;MÑ;MÈbÓ;QÔRàð 	ð BLÒAW�Z—_‘_ R¨¯©¸Ó)<Ô=Ð]aˆ
ð %Ò0ð "×&Ñ& rÐ+@×+EÑ+EÀbÓ+IÔJàð 	ð %Ò0ð "×&Ñ& rÐ+@×+EÑ+EÀbÓ+IÔJàð 	ð #Ò.ð  ×$Ñ$ RÐ)<×)AÑ)AÀ"Ó)EÐGZ×G_ÑG_Ð`bÓGcÔdàð 	ð —)‘)ØØ)Ø)Ø%Ø!Ø"7Ø"7Ø 3Ø'Ø/Ø!5Øð ó 
ˆð  ×-Ñ-ˆàŸ™ ]Ó3ˆØ—‘ Ó/ˆØ Ÿ+™+ b¨+Ó6ˆàˆØÒà—Y‘Y˜×5Ñ5Ó6ˆFÜ'Ó)ˆHÙ˜O¨VÓ4ˆDçß”5ñ 
ð Ø#Ø×)Ñ)Ø×0Ñ0Ø×&Ñ&ñó
—5ð 
�5ñ 
ð Ø#Ø×)Ñ)Ø×0Ñ0Ø×&Ñ&ñó
ó 
ð 
ô -ØØ"Ø!×/Ñ/Ø!(×!=Ñ!=Ø×)Ñ)ô
ð 	
r&   )rø  rz   r‰  r
  r  rš   s   @@r#   rY  rY  �  s,   ù‡ € õ
ð ÷O
ñ O
ó ÷O
ð O
r&   rY  )
rô  r  r  rY  rD  r'  r9  rÚ  r¡  rˆ  )Hr-   rÛ   Údataclassesr   r   r   Útorch.nnr   r   r   Ú r   r”  Úactivationsr   r	   Úmasking_utilsr
   Úmodeling_layersr   Úmodeling_outputsr   r   Úmodeling_utilsr   Úpytorch_utilsr   Úutilsr   r   r   Úconfiguration_luker   Ú
get_loggerr)   Úloggerr   r3   r7   rB   rK   rO   rS   rW   r[   ra   rŒ  re   rœ   r»   r   r  r#  r3  r;  rN  rl  rx  r  rˆ  r¡  r…   rÒ  rÚ  rô  r  r  r'  r9  rD  rY  Ú__all__r'   r&   r#   Ú<module>rs     s�  ðñ ã Ý !ã Ý ß AÑ Aå &ß 'Ý 6Ý 9ß KÝ -Ý 6ß 9Ñ 9Ý *ð 
×	Ò	˜HÓ	%€ñ ðôð
 ôFÐ%?ó Fó óðFñ" ðôð
 ôF˜/ó Fó óðFñ ðôð
 ô<˜ó <ó óð<ñ8 ðôð
 ô< ó <ó óð<ñ& ðôð
 ô< [ó <ó óð<ñ& ðôð
 ô< [ó <ó óð<ñ& ðôð
 ô< ;ó <ó óð<ñ& ðôð
 ô< ó <ó óð<ñ& ðôð
 ô< {ó <ó óð<ñ$ ðôð
 ô< Kó <ó óð<ô*D=�R—Y‘Yô D=ôN(˜2Ÿ9™9ô (ôVi˜Ÿ	™	ô iôZ�R—Y‘Yô ô&�B—I‘Iô &ôT�r—y‘yô ô �—‘ô ô/Ð*ô /ôd>
�"—)‘)ô >
ôD�—‘ô ô B§I¡Iô ô"˜2Ÿ9™9ô ð ô?˜/ó ?ó ð?ñ( ðôô
w
Ð#ó w
óð
w
òt4ô"�—‘ô ñ, ðôôJ
Ð)ó J
óðJ
ñZ ðôôx
Ð"5ó x
óðx
ñv ðôô}
Ð&9ó }
óð}
ñ@ ðôôU
Ð&9ó U
óðU
ñp ðôôt
Ð$7ó t
óðt
ñn ðôôc
Ð!4ó c
óðc
ðL ôr
Ð2ó r
ó ðr
ðj ô]
Ð/ó ]
ó ð]
ò@‚r&   