§
    ‚ŠtjßX  ã                   ó‚  — d Z ddlZddlmZmZmZ ddlmZmZm	Z	m
Z
mZmZmZ ddlmZ ddlmZmZ ddlmZ d	d
lmZmZmZmZmZmZmZmZ  G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z  G d„ de¦  «        Z! G d„ de¦  «        Z" G d„ de¦  «        Z# G d„ de¦  «        Z$ G d„ de¦  «        Z%g d¢Z&dS )zPyTorch CamemBERT model.é    N)ÚBCEWithLogitsLossÚCrossEntropyLossÚMSELossé   )Ú,BaseModelOutputWithPoolingAndCrossAttentionsÚ!CausalLMOutputWithCrossAttentionsÚMaskedLMOutputÚMultipleChoiceModelOutputÚQuestionAnsweringModelOutputÚSequenceClassifierOutputÚTokenClassifierOutput)ÚUnpack)ÚTransformersKwargsÚauto_docstring)Úcan_return_tupleé   )ÚRobertaForCausalLMÚRobertaForMaskedLMÚRobertaForMultipleChoiceÚRobertaForQuestionAnsweringÚ RobertaForSequenceClassificationÚRobertaForTokenClassificationÚRobertaModelÚRobertaPreTrainedModelc                   ó   — e Zd ZdZdS )ÚCamembertPreTrainedModelÚrobertaN)Ú__name__Ú
__module__Ú__qualname__Úbase_model_prefix© ó    úm/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/camembert/modular_camembert.pyr   r   ,   s   € € € € € Ø!ÐÐÐr#   r   c                   ó   — e Zd ZdS )ÚCamembertModelN)r   r   r    r"   r#   r$   r&   r&   0   s   € € € € € Ø€Dr#   r&   c                   ó2  ‡ — e Zd ZdddœZˆ fd„Zee	 	 	 	 	 	 	 	 ddej        dz  dej	        dz  dej        dz  d	ej        dz  d
ej	        dz  dej	        dz  dej	        dz  dej        dz  de
e         deej                 ez  fd„¦   «         ¦   «         Zˆ xZS )ÚCamembertForMaskedLMú)roberta.embeddings.word_embeddings.weightúlm_head.bias©zlm_head.decoder.weightzlm_head.decoder.biasc                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S ©NF©Úadd_pooling_layer©ÚsuperÚ__init__Ú	camembertr&   r   ©ÚselfÚconfigÚ	__class__s     €r$   r2   zCamembertForMaskedLM.__init__:   ó8   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆNå% fÀÐFÑFÔFˆŒˆˆr#   NÚ	input_idsÚattention_maskÚtoken_type_idsÚposition_idsÚinputs_embedsÚencoder_hidden_statesÚencoder_attention_maskÚlabelsÚkwargsÚreturnc	                 ót  —  | j         |f||||||ddœ|	¤Ž}
|
d         }|                      |¦  «        }d}|�e|                     |j        ¦  «        }t	          ¦   «         } ||                     d| j        j        ¦  «        |                     d¦  «        ¦  «        }t          |||
j	        |
j
        ¬¦  «        S )aô  
        token_type_ids (`torch.LongTensor` of shape `(batch_size, 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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        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]`
        T)r:   r;   r<   r=   r>   r?   Úreturn_dictr   Néÿÿÿÿ©ÚlossÚlogitsÚhidden_statesÚ
attentions)r   Úlm_headÚtoÚdevicer   Úviewr6   Ú
vocab_sizer	   rI   rJ   )r5   r9   r:   r;   r<   r=   r>   r?   r@   rA   ÚoutputsÚsequence_outputÚprediction_scoresÚmasked_lm_lossÚloss_fcts                  r$   ÚforwardzCamembertForMaskedLM.forward@   së   € ð: �$”,Øð

à)Ø)Ø%Ø'Ø"7Ø#9Øð

ð 

ð ð

ð 

ˆð " !œ*ˆØ ŸLšL¨Ñ9Ô9ÐàˆØÐà—Y’YÐ0Ô7Ñ8Ô8ˆFÝ'Ñ)Ô)ˆHØ%˜XÐ&7×&<Ò&<¸RÀÄÔAWÑ&XÔ&XÐZ`×ZeÒZeÐfhÑZiÔZiÑjÔjˆNåØØ$Ø!Ô/ØÔ)ð	
ñ 
ô 
ð 	
r#   )NNNNNNNN)r   r   r    Ú_tied_weights_keysr2   r   r   ÚtorchÚ
LongTensorÚFloatTensorr   r   ÚtupleÚTensorr	   rU   Ú__classcell__©r7   s   @r$   r(   r(   4   sN  ø€ € € € € à"MØ .ðð Ðð
Gð Gð Gð Gð Gð Øð .2Ø37Ø26Ø04Ø26Ø:>Ø;?Ø*.ð5
ð 5
àÔ# dÑ*ð5
ð Ô)¨DÑ0ð5
ð Ô(¨4Ñ/ð	5
ð
 Ô&¨Ñ-ð5
ð Ô(¨4Ñ/ð5
ð  %Ô0°4Ñ7ð5
ð !&Ô 1°DÑ 8ð5
ð Ô  4Ñ'ð5
ð Ð+Ô,ð5
ð 
ˆuŒ|Ô	˜~Ñ	-ð5
ð 5
ð 5
ñ „^ñ Ôð5
ð 5
ð 5
ð 5
ð 5
r#   r(   c                   óü   ‡ — e Zd Zˆ fd„Zee	 	 	 	 	 	 ddej        dz  dej        dz  dej        dz  dej        dz  dej        dz  dej        dz  d	e	e
         d
eej                 ez  fd„¦   «         ¦   «         Zˆ xZS )Ú"CamembertForSequenceClassificationc                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S r-   r0   r4   s     €r$   r2   z+CamembertForSequenceClassification.__init__{   r8   r#   Nr9   r:   r;   r<   r=   r@   rA   rB   c           	      ó�  —  | j         |f||||ddœ|¤Ž}|d         }	|                      |	¦  «        }
d}|��t|                     |
j        ¦  «        }| j        j        €f| j        dk    rd| j        _        nN| j        dk    r7|j        t          j	        k    s|j        t          j
        k    rd| j        _        nd| j        _        | j        j        dk    rWt          ¦   «         }| j        dk    r1 ||
                     ¦   «         |                     ¦   «         ¦  «        }nŽ ||
|¦  «        }n�| j        j        dk    rGt          ¦   «         } ||
                     d	| j        ¦  «        |                     d	¦  «        ¦  «        }n*| j        j        dk    rt          ¦   «         } ||
|¦  «        }t!          ||
|j        |j        ¬
¦  «        S )aß  
        token_type_ids (`torch.LongTensor` of shape `(batch_size, 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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        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).
        T©r:   r;   r<   r=   rD   r   Né   Ú
regressionÚsingle_label_classificationÚmulti_label_classificationrE   rF   )r   Ú
classifierrL   rM   r6   Úproblem_typeÚ
num_labelsÚdtyperW   ÚlongÚintr   Úsqueezer   rN   r   r   rI   rJ   ©r5   r9   r:   r;   r<   r=   r@   rA   rP   rQ   rH   rG   rT   s                r$   rU   z*CamembertForSequenceClassification.forward�   sÝ  € ð6 �$”,Øð
à)Ø)Ø%Ø'Øð
ð 
ð ð
ð 
ˆð " !œ*ˆØ—’ Ñ1Ô1ˆàˆØÑà—Y’Y˜vœ}Ñ-Ô-ˆFØŒ{Ô'Ð/Ø”? aÒ'Ð'Ø/;�D”KÔ,Ð,Ø”_ qÒ(Ð(¨f¬l½e¼jÒ.HÐ.HÈFÌLÕ\aÔ\eÒLeÐLeØ/L�D”KÔ,Ð,à/K�D”KÔ,àŒ{Ô'¨<Ò7Ð7Ý"™9œ9�Ø”? aÒ'Ð'Ø#˜8 F§N¢NÑ$4Ô$4°f·n²nÑ6FÔ6FÑGÔG�D�Dà#˜8 F¨FÑ3Ô3�D�DØ”Ô)Ð-JÒJÐJÝ+Ñ-Ô-�Ø�x §¢¨B°´Ñ @Ô @À&Ç+Â+ÈbÁ/Ä/ÑRÔR��Ø”Ô)Ð-IÒIÐIÝ,Ñ.Ô.�Ø�x ¨Ñ/Ô/�å'ØØØ!Ô/ØÔ)ð	
ñ 
ô 
ð 	
r#   ©NNNNNN)r   r   r    r2   r   r   rW   rX   rY   r   r   rZ   r[   r   rU   r\   r]   s   @r$   r_   r_   z   s#  ø€ € € € € ðGð Gð Gð Gð Gð Øð .2Ø37Ø26Ø04Ø26Ø*.ðC
ð C
àÔ# dÑ*ðC
ð Ô)¨DÑ0ðC
ð Ô(¨4Ñ/ð	C
ð
 Ô&¨Ñ-ðC
ð Ô(¨4Ñ/ðC
ð Ô  4Ñ'ðC
ð Ð+Ô,ðC
ð 
ˆuŒ|Ô	Ð7Ñ	7ðC
ð C
ð C
ñ „^ñ ÔðC
ð C
ð C
ð C
ð C
r#   r_   c                   óü   ‡ — e Zd Zˆ fd„Zee	 	 	 	 	 	 ddej        dz  dej        dz  dej        dz  dej        dz  dej        dz  dej        dz  d	e	e
         d
eej                 ez  fd„¦   «         ¦   «         Zˆ xZS )ÚCamembertForMultipleChoicec                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S )NTr.   r0   r4   s     €r$   r2   z#CamembertForMultipleChoice.__init__Ê   s8   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆNå% fÀÐEÑEÔEˆŒˆˆr#   Nr9   r;   r:   r@   r<   r=   rA   rB   c           	      ó†  — |�|j         d         n|j         d         }|�)|                     d|                     d¦  «        ¦  «        nd}	|�)|                     d|                     d¦  «        ¦  «        nd}
|�)|                     d|                     d¦  «        ¦  «        nd}|�)|                     d|                     d¦  «        ¦  «        nd}|�=|                     d|                     d¦  «        |                     d¦  «        ¦  «        nd} | j        |	f|
|||ddœ|¤Ž}|d         }|                      |¦  «        }|                      |¦  «        }|                     d|¦  «        }d}|�4|                     |j        ¦  «        }t          ¦   «         } |||¦  «        }t          |||j
        |j        ¬¦  «        S )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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        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)
        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)
        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.
        Nrc   rE   éþÿÿÿT)r<   r;   r:   r=   rD   rF   )ÚshaperN   Úsizer   Údropoutrg   rL   rM   r   r
   rI   rJ   )r5   r9   r;   r:   r@   r<   r=   rA   Únum_choicesÚflat_input_idsÚflat_position_idsÚflat_token_type_idsÚflat_attention_maskÚflat_inputs_embedsrP   Úpooled_outputrH   Úreshaped_logitsrG   rT   s                       r$   rU   z"CamembertForMultipleChoice.forwardÐ   s   € ðV -6Ð,A�i”o aÔ(Ð(À}ÔGZÐ[\ÔG]ˆàCLÐCX˜Ÿš¨¨I¯NªN¸2Ñ,>Ô,>Ñ?Ô?Ð?Ð^bˆØLXÐLd˜L×-Ò-¨b°,×2CÒ2CÀBÑ2GÔ2GÑHÔHÐHÐjnÐØR`ÐRl˜n×1Ò1°"°n×6IÒ6IÈ"Ñ6MÔ6MÑNÔNÐNÐrvÐØR`ÐRl˜n×1Ò1°"°n×6IÒ6IÈ"Ñ6MÔ6MÑNÔNÐNÐrvÐð Ð(ð ×Ò˜r =×#5Ò#5°bÑ#9Ô#9¸=×;MÒ;MÈbÑ;QÔ;QÑRÔRÐRàð 	ð �$”,Øð
à*Ø.Ø.Ø,Øð
ð 
ð ð
ð 
ˆð   œ
ˆàŸš ]Ñ3Ô3ˆØ—’ Ñ/Ô/ˆØ Ÿ+š+ b¨+Ñ6Ô6ˆàˆØÐà—Y’Y˜Ô5Ñ6Ô6ˆFÝ'Ñ)Ô)ˆHØ�8˜O¨VÑ4Ô4ˆDå(ØØ"Ø!Ô/ØÔ)ð	
ñ 
ô 
ð 	
r#   ro   )r   r   r    r2   r   r   rW   rX   rY   r   r   rZ   r[   r
   rU   r\   r]   s   @r$   rq   rq   É   s#  ø€ € € € € ðFð Fð Fð Fð Fð Øð .2Ø26Ø37Ø*.Ø04Ø26ðP
ð P
àÔ# dÑ*ðP
ð Ô(¨4Ñ/ðP
ð Ô)¨DÑ0ð	P
ð
 Ô  4Ñ'ðP
ð Ô&¨Ñ-ðP
ð Ô(¨4Ñ/ðP
ð Ð+Ô,ðP
ð 
ˆuŒ|Ô	Ð8Ñ	8ðP
ð P
ð P
ñ „^ñ ÔðP
ð P
ð P
ð P
ð P
r#   rq   c                   óü   ‡ — e Zd Zˆ fd„Zee	 	 	 	 	 	 ddej        dz  dej        dz  dej        dz  dej        dz  dej        dz  dej        dz  d	e	e
         d
eej                 ez  fd„¦   «         ¦   «         Zˆ xZS )ÚCamembertForTokenClassificationc                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S r-   r0   r4   s     €r$   r2   z(CamembertForTokenClassification.__init__&  r8   r#   Nr9   r:   r;   r<   r=   r@   rA   rB   c           	      ó�  —  | j         |f||||ddœ|¤Ž}|d         }	|                      |	¦  «        }	|                      |	¦  «        }
d}|�`|                     |
j        ¦  «        }t          ¦   «         } ||
                     d| j        ¦  «        |                     d¦  «        ¦  «        }t          ||
|j	        |j
        ¬¦  «        S )a-  
        token_type_ids (`torch.LongTensor` of shape `(batch_size, 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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
        Trb   r   NrE   rF   )r   rw   rg   rL   rM   r   rN   ri   r   rI   rJ   rn   s                r$   rU   z'CamembertForTokenClassification.forward,  sç   € ð2 �$”,Øð
à)Ø)Ø%Ø'Øð
ð 
ð ð
ð 
ˆð " !œ*ˆàŸ,š, Ñ7Ô7ˆØ—’ Ñ1Ô1ˆàˆØÐà—Y’Y˜vœ}Ñ-Ô-ˆFÝ'Ñ)Ô)ˆHØ�8˜FŸKšK¨¨D¬OÑ<Ô<¸f¿kºkÈ"¹o¼oÑNÔNˆDå$ØØØ!Ô/ØÔ)ð	
ñ 
ô 
ð 	
r#   ro   )r   r   r    r2   r   r   rW   rX   rY   r   r   rZ   r[   r   rU   r\   r]   s   @r$   r�   r�   %  s  ø€ € € € € ðGð Gð Gð Gð Gð Øð .2Ø37Ø26Ø04Ø26Ø*.ð2
ð 2
àÔ# dÑ*ð2
ð Ô)¨DÑ0ð2
ð Ô(¨4Ñ/ð	2
ð
 Ô&¨Ñ-ð2
ð Ô(¨4Ñ/ð2
ð Ô  4Ñ'ð2
ð Ð+Ô,ð2
ð 
ˆuŒ|Ô	Ð4Ñ	4ð2
ð 2
ð 2
ñ „^ñ Ôð2
ð 2
ð 2
ð 2
ð 2
r#   r�   c                   ó  ‡ — e Zd Zˆ fd„Zee	 	 	 	 	 	 	 ddej        dz  dej        dz  dej        dz  dej        dz  dej        dz  dej        dz  d	ej        dz  d
e	e
         deej                 ez  fd„¦   «         ¦   «         Zˆ xZS )ÚCamembertForQuestionAnsweringc                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S r-   r0   r4   s     €r$   r2   z&CamembertForQuestionAnswering.__init__d  r8   r#   Nr9   r:   r;   r<   r=   Ústart_positionsÚend_positionsrA   rB   c           	      óF  —  | j         |f||||ddœ|¤Ž}	|	d         }
|                      |
¦  «        }|                     dd¬¦  «        \  }}|                     d¦  «                             ¦   «         }|                     d¦  «                             ¦   «         }d}|�ç|�åt          |                     ¦   «         ¦  «        dk    r|                     d¦  «        }t          |                     ¦   «         ¦  «        dk    r|                     d¦  «        }|                     d¦  «        }|                     d|¦  «        }|                     d|¦  «        }t          |¬¦  «        } |||¦  «        } |||¦  «        }||z   d	z  }t          ||||	j
        |	j        ¬
¦  «        S )a[  
        token_type_ids (`torch.LongTensor` of shape `(batch_size, 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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        Trb   r   rc   rE   )ÚdimN)Úignore_indexr   )rG   Ústart_logitsÚ
end_logitsrI   rJ   )r   Ú
qa_outputsÚsplitrm   Ú
contiguousÚlenrv   Úclampr   r   rI   rJ   )r5   r9   r:   r;   r<   r=   r‡   rˆ   rA   rP   rQ   rH   rŒ   r�   Ú
total_lossÚignored_indexrT   Ú
start_lossÚend_losss                      r$   rU   z%CamembertForQuestionAnswering.forwardj  sÏ  € ð0 �$”,Øð
à)Ø)Ø%Ø'Øð
ð 
ð ð
ð 
ˆð " !œ*ˆà—’ Ñ1Ô1ˆØ#)§<¢<°°r <Ñ#:Ô#:Ñ ˆ�jØ#×+Ò+¨BÑ/Ô/×:Ò:Ñ<Ô<ˆØ×'Ò'¨Ñ+Ô+×6Ò6Ñ8Ô8ˆ
àˆ
ØÐ&¨=Ð+Då�?×'Ò'Ñ)Ô)Ñ*Ô*¨QÒ.Ð.Ø"1×"9Ò"9¸"Ñ"=Ô"=�Ý�=×%Ò%Ñ'Ô'Ñ(Ô(¨1Ò,Ð,Ø -× 5Ò 5°bÑ 9Ô 9�à(×-Ò-¨aÑ0Ô0ˆMØ-×3Ò3°A°}ÑEÔEˆOØ)×/Ò/°°=ÑAÔAˆMå'°]ÐCÑCÔCˆHØ!˜ ,°Ñ@Ô@ˆJØ�x 
¨MÑ:Ô:ˆHØ$ xÑ/°1Ñ4ˆJå+ØØ%Ø!Ø!Ô/ØÔ)ð
ñ 
ô 
ð 	
r#   )NNNNNNN)r   r   r    r2   r   r   rW   rX   rY   r   r   rZ   r[   r   rU   r\   r]   s   @r$   r…   r…   c  s'  ø€ € € € € ðGð Gð Gð Gð Gð Øð .2Ø37Ø26Ø04Ø26Ø37Ø15ð>
ð >
àÔ# dÑ*ð>
ð Ô)¨DÑ0ð>
ð Ô(¨4Ñ/ð	>
ð
 Ô&¨Ñ-ð>
ð Ô(¨4Ñ/ð>
ð Ô)¨DÑ0ð>
ð Ô'¨$Ñ.ð>
ð Ð+Ô,ð>
ð 
ˆuŒ|Ô	Ð;Ñ	;ð>
ð >
ð >
ñ „^ñ Ôð>
ð >
ð >
ð >
ð >
r#   r…   c                   ó‚  ‡ — e Zd ZdddœZˆ fd„Zee	 	 	 	 	 	 	 	 	 	 	 ddej        dz  dej	        dz  d	ej        dz  d
ej        dz  dej	        dz  dej	        dz  dej	        dz  dej        dz  de
e
ej	                          dz  dedz  deej        z  dee         de
ej                 ez  fd„¦   «         ¦   «         Zˆ xZS )ÚCamembertForCausalLMr)   r*   r+   c                 óz   •— t          ¦   «                              |¦  «         | `t          |d¬¦  «        | _        d S r-   r0   r4   s     €r$   r2   zCamembertForCausalLM.__init__³  r8   r#   Nr   r9   r:   r;   r<   r=   r>   r?   r@   Úpast_key_valuesÚ	use_cacheÚlogits_to_keeprA   rB   c                 ól  — |�d}
 | j         |f|||||||	|
ddœ	|¤Ž}|j        }t          |t          ¦  «        rt	          | d¦  «        n|}|                      |dd…|dd…f         ¦  «        }d}|� | j        d||| j        j        dœ|¤Ž}t          |||j
        |j        |j        |j        ¬¦  «        S )aq  
        token_type_ids (`torch.LongTensor` of shape `(batch_size, 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.
            This parameter can only be used when the model is initialized with `type_vocab_size` parameter with value
            >= 2. All the value in this tensor should be always < type_vocab_size.

            [What are token type IDs?](../glossary#token-type-ids)
        labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
            Labels for computing the left-to-right language modeling loss (next word prediction). 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]`

        Example:

        ```python
        >>> from transformers import AutoTokenizer, CamembertForCausalLM, AutoConfig
        >>> import torch

        >>> tokenizer = AutoTokenizer.from_pretrained("almanach/camembert-base")
        >>> config = AutoConfig.from_pretrained("almanach/camembert-base")
        >>> config.is_decoder = True
        >>> model = CamembertForCausalLM.from_pretrained("almanach/camembert-base", config=config)

        >>> inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
        >>> outputs = model(**inputs)

        >>> prediction_logits = outputs.logits
        ```NFT)	r:   r;   r<   r=   r>   r?   rš   r›   rD   )rH   r@   rO   )rG   rH   rš   rI   rJ   Úcross_attentionsr"   )r   Úlast_hidden_stateÚ
isinstancerl   ÚslicerK   Úloss_functionr6   rO   r   rš   rI   rJ   rž   )r5   r9   r:   r;   r<   r=   r>   r?   r@   rš   r›   rœ   rA   rP   rI   Úslice_indicesrH   rG   s                     r$   rU   zCamembertForCausalLM.forward¹  s  € ð` ÐØˆIà@LÀÄØðA
à)Ø)Ø%Ø'Ø"7Ø#9Ø+ØØðA
ð A
ð ðA
ð A
ˆð  Ô1ˆå8BÀ>ÕSVÑ8WÔ8WÐk�˜~˜o¨tÑ4Ô4Ð4Ð]kˆØ—’˜m¨A¨A¨A¨}¸a¸a¸aÐ,?Ô@ÑAÔAˆàˆØÐØ%�4Ô%Ðp¨V¸FÈtÌ{ÔOeÐpÐpÐioÐpÐpˆDå0ØØØ#Ô3Ø!Ô/ØÔ)Ø$Ô5ð
ñ 
ô 
ð 	
r#   )NNNNNNNNNNr   )r   r   r    rV   r2   r   r   rW   rX   rY   rZ   Úboolrl   r[   r   r   r   rU   r\   r]   s   @r$   r˜   r˜   ­  s©  ø€ € € € € à"MØ .ðð Ðð
Gð Gð Gð Gð Gð Øð .2Ø37Ø26Ø04Ø26Ø:>Ø;?Ø*.ØBFØ!%Ø-.ðO
ð O
àÔ# dÑ*ðO
ð Ô)¨DÑ0ðO
ð Ô(¨4Ñ/ð	O
ð
 Ô&¨Ñ-ðO
ð Ô(¨4Ñ/ðO
ð  %Ô0°4Ñ7ðO
ð !&Ô 1°DÑ 8ðO
ð Ô  4Ñ'ðO
ð ˜u UÔ%6Ô7Ô8¸4Ñ?ðO
ð ˜$‘;ðO
ð ˜eœlÑ*ðO
ð Ð+Ô,ðO
ð 
ˆuŒ|Ô	Ð@Ñ	@ðO
ð O
ð O
ñ „^ñ ÔðO
ð O
ð O
ð O
ð O
r#   r˜   )r˜   r(   rq   r…   r_   r�   r&   r   )'Ú__doc__rW   Útorch.nnr   r   r   Úmodeling_outputsr   r   r	   r
   r   r   r   Úprocessing_utilsr   Úutilsr   r   Úutils.genericr   Úroberta.modeling_robertar   r   r   r   r   r   r   r   r   r&   r(   r_   rq   r�   r…   r˜   Ú__all__r"   r#   r$   ú<module>r­      sÊ  ðð Ð à €€€Ø AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ Aðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 'Ð &Ð &Ð &Ð &Ð &Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ø -Ð -Ð -Ð -Ð -Ð -ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð"ð "ð "ð "ð "Ð5ñ "ô "ð "ð	ð 	ð 	ð 	ð 	�\ñ 	ô 	ð 	ðC
ð C
ð C
ð C
ð C
Ð-ñ C
ô C
ð C
ðLL
ð L
ð L
ð L
ð L
Ð)Iñ L
ô L
ð L
ð^Y
ð Y
ð Y
ð Y
ð Y
Ð!9ñ Y
ô Y
ð Y
ðx;
ð ;
ð ;
ð ;
ð ;
Ð&Cñ ;
ô ;
ð ;
ð|G
ð G
ð G
ð G
ð G
Ð$?ñ G
ô G
ð G
ðT]
ð ]
ð ]
ð ]
ð ]
Ð-ñ ]
ô ]
ð ]
ð@	ð 	ð 	€€€r#   