§
    ‚ŠtjLU  ã                   ó  — d Z ddlmZ ddlZddlmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZ d	d
lmZ ddlmZ  ej        e¦  «        Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Z ed¬¦  «        e G d„ de¦  «        ¦   «         ¦   «         Ze 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 ed!¬¦  «         G d"„ d#e¦  «        ¦   «         Z ed$¬¦  «         G d%„ d&e¦  «        ¦   «         Z ed'¬¦  «         G d(„ d)e¦  «        ¦   «         Z g d*¢Z!dS )+z5PyTorch DPR model for Open Domain Question Answering.é    )Ú	dataclassN)ÚTensorÚnné   )ÚBaseModelOutputWithPooling)ÚPreTrainedModel)ÚModelOutputÚauto_docstringÚloggingé   )Ú	BertModelé   )Ú	DPRConfigz6
    Class for outputs of [`DPRQuestionEncoder`].
    )Úcustom_introc                   ó„   — e Zd ZU dZej        ed<   dZeej        df         dz  ed<   dZ	eej        df         dz  ed<   dS )ÚDPRContextEncoderOutputa§  
    pooler_output (`torch.FloatTensor` of shape `(batch_size, embeddings_size)`):
        The DPR encoder outputs the *pooler_output* that corresponds to the context representation. Last layer
        hidden-state of the first token of the sequence (classification token) further processed by a Linear layer.
        This output is to be used to embed contexts for nearest neighbors queries with questions embeddings.
    Úpooler_outputN.Úhidden_statesÚ
attentions©
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtorchÚFloatTensorÚ__annotations__r   Útupler   © ó    úb/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/dpr/modeling_dpr.pyr   r   (   óq   € € € € € € ðð ð Ô$Ð$Ð$Ñ$Ø:>€M�5˜Ô*¨CÐ/Ô0°4Ñ7Ð>Ð>Ñ>Ø7;€J��eÔ'¨Ð,Ô-°Ñ4Ð;Ð;Ñ;Ð;Ð;r    r   c                   ó„   — e Zd ZU dZej        ed<   dZeej        df         dz  ed<   dZ	eej        df         dz  ed<   dS )ÚDPRQuestionEncoderOutputa§  
    pooler_output (`torch.FloatTensor` of shape `(batch_size, embeddings_size)`):
        The DPR encoder outputs the *pooler_output* that corresponds to the question representation. Last layer
        hidden-state of the first token of the sequence (classification token) further processed by a Linear layer.
        This output is to be used to embed questions for nearest neighbors queries with context embeddings.
    r   N.r   r   r   r   r    r!   r$   r$   ;   r"   r    r$   c                   óÀ   — e Zd ZU dZej        ed<   dZej        dz  ed<   dZej        dz  ed<   dZ	e
ej        df         dz  ed<   dZe
ej        df         dz  ed<   dS )	ÚDPRReaderOutputa  
    start_logits (`torch.FloatTensor` of shape `(n_passages, sequence_length)`):
        Logits of the start index of the span for each passage.
    end_logits (`torch.FloatTensor` of shape `(n_passages, sequence_length)`):
        Logits of the end index of the span for each passage.
    relevance_logits (`torch.FloatTensor` of shape `(n_passages, )`):
        Outputs of the QA classifier of the DPRReader that corresponds to the scores of each passage to answer the
        question, compared to all the other passages.
    Ústart_logitsNÚ
end_logitsÚrelevance_logits.r   r   )r   r   r   r   r   r   r   r(   r)   r   r   r   r   r    r!   r&   r&   N   s¢   € € € € € € ðð ð Ô#Ð#Ð#Ñ#Ø+/€J�Ô! DÑ(Ð/Ð/Ñ/Ø15Ð�eÔ'¨$Ñ.Ð5Ð5Ñ5Ø:>€M�5˜Ô*¨CÐ/Ô0°4Ñ7Ð>Ð>Ñ>Ø7;€J��eÔ'¨Ð,Ô-°Ñ4Ð;Ð;Ñ;Ð;Ð;r    r&   c                   ó   — e Zd ZdZdS )ÚDPRPreTrainedModelTN)r   r   r   Ú_supports_sdpar   r    r!   r+   r+   f   s   € € € € € à€N€N€Nr    r+   c                   ó¢   ‡ — e Zd ZdZdefˆ fd„Z	 	 	 	 	 	 ddededz  dedz  d	edz  d
edededee	edf         z  fd„Z
edefd„¦   «         Zˆ xZS )Ú
DPREncoderÚ
bert_modelÚconfigc                 óp  •— t          ¦   «                              |¦  «         t          |d¬¦  «        | _        | j        j        j        dk    rt          d¦  «        ‚|j        | _        | j        dk    r.t          j	        | j        j        j        |j        ¦  «        | _
        |                      ¦   «          d S )NF)Úadd_pooling_layerr   z!Encoder hidden_size can't be zero)ÚsuperÚ__init__r   r/   r0   Úhidden_sizeÚ
ValueErrorÚprojection_dimr   ÚLinearÚencode_projÚ	post_init©Úselfr0   Ú	__class__s     €r!   r4   zDPREncoder.__init__n   sŸ   ø€ Ý‰Œ×Ò˜Ñ Ô Ð Ý# F¸eÐDÑDÔDˆŒØŒ?Ô!Ô-°Ò2Ð2ÝÐ@ÑAÔAÐAØ$Ô3ˆÔØÔ Ò"Ð"Ý!œy¨¬Ô)?Ô)KÈVÔMbÑcÔcˆDÔà�ŠÑÔÐÐÐr    NFÚ	input_idsÚattention_maskÚtoken_type_idsÚinputs_embedsÚoutput_attentionsÚoutput_hidden_statesÚreturn_dictÚreturn.c           	      ó  — |                       |||||||¬¦  «        }	|	d         }
|
d d …dd d …f         }| j        dk    r|                      |¦  «        }|s|
|f|	dd …         z   S t          |
||	j        |	j        ¬¦  «        S )N©r>   r?   r@   rA   rB   rC   rD   r   r   )Úlast_hidden_stater   r   r   )r/   r7   r9   r   r   r   )r<   r>   r?   r@   rA   rB   rC   rD   ÚkwargsÚoutputsÚsequence_outputÚpooled_outputs               r!   ÚforwardzDPREncoder.forwardy   s¿   € ð —/’/ØØ)Ø)Ø'Ø/Ø!5Ø#ð "ñ 
ô 
ˆð " !œ*ˆØ'¨¨¨¨1¨a¨a¨a¨Ô0ˆàÔ Ò"Ð"Ø ×,Ò,¨]Ñ;Ô;ˆMàð 	BØ# ]Ð3°g¸a¸b¸b´kÑAÐAå)Ø-Ø'Ø!Ô/ØÔ)ð	
ñ 
ô 
ð 	
r    c                 óR   — | j         dk    r| j        j        S | j        j        j        S )Nr   )r7   r9   Úout_featuresr/   r0   r5   )r<   s    r!   Úembeddings_sizezDPREncoder.embeddings_size�   s*   € àÔ Ò"Ð"ØÔ#Ô0Ð0ØŒÔ%Ô1Ð1r    )NNNFFF)r   r   r   Úbase_model_prefixr   r4   r   Úboolr   r   rM   ÚpropertyÚintrP   Ú__classcell__©r=   s   @r!   r.   r.   k   s  ø€ € € € € Ø$Ðð	˜yð 	ð 	ð 	ð 	ð 	ð 	ð )-Ø(,Ø'+Ø"'Ø%*Ø!ð"
ð "
àð"
ð  ™ð"
ð  ™ð	"
ð
  ‘}ð"
ð  ð"
ð #ð"
ð ð"
ð 
$ e¨F°C¨KÔ&8Ñ	8ð"
ð "
ð "
ð "
ðH ð2 ð 2ð 2ð 2ñ „Xð2ð 2ð 2ð 2ð 2r    r.   c                   ór   ‡ — e Zd ZdZdefˆ fd„Z	 	 	 	 ddedededz  d	ed
ededee	edf         z  fd„Z
ˆ xZS )ÚDPRSpanPredictorÚencoderr0   c                 ó*  •— t          ¦   «                              |¦  «         t          |¦  «        | _        t	          j        | j        j        d¦  «        | _        t	          j        | j        j        d¦  «        | _        |  	                    ¦   «          d S )Nr   r   )
r3   r4   r.   rY   r   r8   rP   Ú
qa_outputsÚqa_classifierr:   r;   s     €r!   r4   zDPRSpanPredictor.__init__§   sq   ø€ Ý‰Œ×Ò˜Ñ Ô Ð Ý! &Ñ)Ô)ˆŒÝœ) D¤LÔ$@À!ÑDÔDˆŒÝœY t¤|Ô'CÀQÑGÔGˆÔà�ŠÑÔÐÐÐr    NFr>   r?   rA   rB   rC   rD   rE   .c                 óÒ  — |�|                      ¦   «         n|                      ¦   «         d d…         \  }}	|                      ||||||¬¦  «        }
|
d         }|                      |¦  «        }|                     dd¬¦  «        \  }}|                     d¦  «                             ¦   «         }|                     d¦  «                             ¦   «         }|                      |d d …dd d …f         ¦  «        }|                     ||	¦  «        }|                     ||	¦  «        }|                     |¦  «        }|s|||f|
dd …         z   S t          ||||
j	        |
j
        ¬¦  «        S )Nr   )r?   rA   rB   rC   rD   r   r   éÿÿÿÿ)Údim)r'   r(   r)   r   r   )ÚsizerY   r[   ÚsplitÚsqueezeÚ
contiguousr\   Úviewr&   r   r   )r<   r>   r?   rA   rB   rC   rD   rI   Ú
n_passagesÚsequence_lengthrJ   rK   Úlogitsr'   r(   r)   s                   r!   rM   zDPRSpanPredictor.forward¯   s‘  € ð ;DÐ:O i§n¢nÑ&6Ô&6Ð&6ÐUb×UgÒUgÑUiÔUiÐjlÐklÐjlÔUmÑ#ˆ
�Oà—,’,ØØ)Ø'Ø/Ø!5Ø#ð ñ 
ô 
ˆð " !œ*ˆð —’ Ñ1Ô1ˆØ#)§<¢<°°r <Ñ#:Ô#:Ñ ˆ�jØ#×+Ò+¨BÑ/Ô/×:Ò:Ñ<Ô<ˆØ×'Ò'¨Ñ+Ô+×6Ò6Ñ8Ô8ˆ
Ø×-Ò-¨o¸a¸a¸aÀÀAÀAÀA¸gÔ.FÑGÔGÐð $×(Ò(¨°_ÑEÔEˆØ—_’_ Z°ÑAÔAˆ
Ø+×0Ò0°Ñ<Ô<Ðàð 	NØ  *Ð.>Ð?À'È!È"È"Ä+ÑMÐMåØ%Ø!Ø-Ø!Ô/ØÔ)ð
ñ 
ô 
ð 	
r    )NFFF)r   r   r   rQ   r   r4   r   rR   r&   r   rM   rU   rV   s   @r!   rX   rX   ¤   sÇ   ø€ € € € € Ø!Ðð˜yð ð ð ð ð ð ð (,Ø"'Ø%*Ø!ð,
ð ,
àð,
ð ð,
ð  ‘}ð	,
ð
  ð,
ð #ð,
ð ð,
ð 
˜5 ¨ Ô-Ñ	-ð,
ð ,
ð ,
ð ,
ð ,
ð ,
ð ,
ð ,
r    rX   c                   ó"   — e Zd ZU dZeed<   dZdS )ÚDPRPretrainedContextEncoderú†
    An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
    models.
    r0   Úctx_encoderN©r   r   r   r   r   r   rQ   r   r    r!   ri   ri   ã   s0   € € € € € € ðð ð
 ÐÐÑØ%ÐÐÐr    ri   c                   ó"   — e Zd ZU dZeed<   dZdS )ÚDPRPretrainedQuestionEncoderrj   r0   Úquestion_encoderNrl   r   r    r!   rn   rn   í   s0   € € € € € € ðð ð
 ÐÐÑØ*ÐÐÐr    rn   c                   ó"   — e Zd ZU dZeed<   dZdS )ÚDPRPretrainedReaderrj   r0   Úspan_predictorNrl   r   r    r!   rq   rq   ÷   s0   € € € € € € ðð ð
 ÐÐÑØ(ÐÐÐr    rq   zf
    The bare DPRContextEncoder transformer outputting pooler outputs as context representations.
    c                   ó¬   ‡ — e Zd Zdefˆ fd„Ze	 	 	 	 	 	 	 ddedz  dedz  dedz  dedz  dedz  d	edz  d
edz  dee	edf         z  fd„¦   «         Z
ˆ xZS )ÚDPRContextEncoderr0   c                 ó¨   •— t          ¦   «                              |¦  «         || _        t          |¦  «        | _        |                      ¦   «          d S ©N)r3   r4   r0   r.   rk   r:   r;   s     €r!   r4   zDPRContextEncoder.__init__  sH   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆŒÝ% fÑ-Ô-ˆÔà�ŠÑÔÐÐÐr    Nr>   r?   r@   rA   rB   rC   rD   rE   .c           	      ó^  — |�|n| j         j        }|�|n| j         j        }|�|n| j         j        }|�|�t	          d¦  «        ‚|�|                     ¦   «         }	n.|�|                     ¦   «         dd…         }	nt	          d¦  «        ‚|�|j        n|j        }
|€(|€t          j        |	|
¬¦  «        n|| j         j	        k    }|€!t          j
        |	t          j        |
¬¦  «        }|                      |||||||¬¦  «        }|s
|dd…         S t          |j        |j        |j        ¬	¦  «        S )
aS  
        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens in the vocabulary. To match pretraining, DPR input sequence should be
            formatted with [CLS] and [SEP] tokens as follows:

            (a) For sequence pairs (for a pair title+text for example):

            ```
            tokens:         [CLS] is this jack ##son ##ville ? [SEP] no it is not . [SEP]
            token_type_ids:   0   0  0    0    0     0       0   0   1  1  1  1   1   1
            ```

            (b) For single sequences (for a question for example):

            ```
            tokens:         [CLS] the dog is hairy . [SEP]
            token_type_ids:   0   0   0   0  0     0   0
            ```

            DPR is a model with absolute position embeddings so it's usually advised to pad the inputs on the right
            rather than the left.

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

            [What are input IDs?](../glossary#input-ids)

        Examples:

        ```python
        >>> from transformers import DPRContextEncoder, DPRContextEncoderTokenizer

        >>> tokenizer = DPRContextEncoderTokenizer.from_pretrained("facebook/dpr-ctx_encoder-single-nq-base")
        >>> model = DPRContextEncoder.from_pretrained("facebook/dpr-ctx_encoder-single-nq-base")
        >>> input_ids = tokenizer("Hello, is my dog cute ?", return_tensors="pt")["input_ids"]
        >>> embeddings = model(input_ids).pooler_output
        ```NúDYou cannot specify both input_ids and inputs_embeds at the same timer^   ú5You have to specify either input_ids or inputs_embeds©Údevice©Údtyper{   rG   r   ©r   r   r   )r0   rB   rC   rD   r6   r`   r{   r   ÚonesÚpad_token_idÚzerosÚlongrk   r   r   r   r   ©r<   r>   r?   r@   rA   rB   rC   rD   rI   Úinput_shaper{   rJ   s               r!   rM   zDPRContextEncoder.forward  sˆ  € ðd 2CÐ1NÐ-Ð-ÐTXÔT_ÔTqÐà$8Ð$DÐ Ð È$Ì+ÔJjð 	ð &1Ð%<�k�kÀ$Ä+ÔBYˆàÐ  ]Ð%>ÝÐcÑdÔdÐdØÐ"Ø#Ÿ.š.Ñ*Ô*ˆKˆKØÐ&Ø'×,Ò,Ñ.Ô.¨s°¨sÔ3ˆKˆKåÐTÑUÔUÐUà%.Ð%:�Ô!Ð!ÀÔ@TˆàÐ!ð Ð$õ ”
˜;¨vÐ6Ñ6Ô6Ð6à 4¤;Ô#;Ò;ð ð
 Ð!Ý"œ[¨½E¼JÈvÐVÑVÔVˆNà×"Ò"ØØ)Ø)Ø'Ø/Ø!5Ø#ð #ñ 
ô 
ˆð ð 	Ø˜1˜2˜2”;ÐÝ&Ø!Ô/¸wÔ?TÐahÔasð
ñ 
ô 
ð 	
r    ©NNNNNNN)r   r   r   r   r4   r
   r   rR   r   r   rM   rU   rV   s   @r!   rt   rt     s	  ø€ € € € € ð˜yð ð ð ð ð ð ð ð $(Ø(,Ø(,Ø'+Ø)-Ø,0Ø#'ðY
ð Y
à˜D‘=ðY
ð  ™ðY
ð  ™ð	Y
ð
  ‘}ðY
ð   $™;ðY
ð # T™kðY
ð ˜D‘[ðY
ð 
! 5¨°¨Ô#5Ñ	5ðY
ð Y
ð Y
ñ „^ðY
ð Y
ð Y
ð Y
ð Y
r    rt   zh
    The bare DPRQuestionEncoder transformer outputting pooler outputs as question representations.
    c                   ó¬   ‡ — e Zd Zdefˆ fd„Ze	 	 	 	 	 	 	 ddedz  dedz  dedz  dedz  dedz  d	edz  d
edz  dee	edf         z  fd„¦   «         Z
ˆ xZS )ÚDPRQuestionEncoderr0   c                 ó¨   •— t          ¦   «                              |¦  «         || _        t          |¦  «        | _        |                      ¦   «          d S rv   )r3   r4   r0   r.   ro   r:   r;   s     €r!   r4   zDPRQuestionEncoder.__init__v  sH   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆŒÝ *¨6Ñ 2Ô 2ˆÔà�ŠÑÔÐÐÐr    Nr>   r?   r@   rA   rB   rC   rD   rE   .c           	      óŠ  — |�|n| j         j        }|�|n| j         j        }|�|n| j         j        }|�|�t	          d¦  «        ‚|�+|                      ||¦  «         |                     ¦   «         }	n.|�|                     ¦   «         dd…         }	nt	          d¦  «        ‚|�|j        n|j        }
|€(|€t          j	        |	|
¬¦  «        n|| j         j
        k    }|€!t          j        |	t          j        |
¬¦  «        }|                      |||||||¬¦  «        }|s
|dd…         S t          |j        |j        |j        ¬	¦  «        S )
aj  
        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):
            Indices of input sequence tokens in the vocabulary. To match pretraining, DPR input sequence should be
            formatted with [CLS] and [SEP] tokens as follows:

            (a) For sequence pairs (for a pair title+text for example):

            ```
            tokens:         [CLS] is this jack ##son ##ville ? [SEP] no it is not . [SEP]
            token_type_ids:   0   0  0    0    0     0       0   0   1  1  1  1   1   1
            ```

            (b) For single sequences (for a question for example):

            ```
            tokens:         [CLS] the dog is hairy . [SEP]
            token_type_ids:   0   0   0   0  0     0   0
            ```

            DPR is a model with absolute position embeddings so it's usually advised to pad the inputs on the right
            rather than the left.

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

            [What are input IDs?](../glossary#input-ids)

        Examples:

        ```python
        >>> from transformers import DPRQuestionEncoder, DPRQuestionEncoderTokenizer

        >>> tokenizer = DPRQuestionEncoderTokenizer.from_pretrained("facebook/dpr-question_encoder-single-nq-base")
        >>> model = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-single-nq-base")
        >>> input_ids = tokenizer("Hello, is my dog cute ?", return_tensors="pt")["input_ids"]
        >>> embeddings = model(input_ids).pooler_output
        ```
        Nrx   r^   ry   rz   r|   rG   r   r~   )r0   rB   rC   rD   r6   Ú%warn_if_padding_and_no_attention_maskr`   r{   r   r   r€   r�   r‚   ro   r$   r   r   r   rƒ   s               r!   rM   zDPRQuestionEncoder.forward}  sž  € ðd 2CÐ1NÐ-Ð-ÐTXÔT_ÔTqÐà$8Ð$DÐ Ð È$Ì+ÔJjð 	ð &1Ð%<�k�kÀ$Ä+ÔBYˆàÐ  ]Ð%>ÝÐcÑdÔdÐdØÐ"Ø×6Ò6°yÀ.ÑQÔQÐQØ#Ÿ.š.Ñ*Ô*ˆKˆKØÐ&Ø'×,Ò,Ñ.Ô.¨s°¨sÔ3ˆKˆKåÐTÑUÔUÐUà%.Ð%:�Ô!Ð!ÀÔ@TˆàÐ!ð Ð$õ ”
˜;¨vÐ6Ñ6Ô6Ð6à 4¤;Ô#;Ò;ð ð
 Ð!Ý"œ[¨½E¼JÈvÐVÑVÔVˆNà×'Ò'ØØ)Ø)Ø'Ø/Ø!5Ø#ð (ñ 
ô 
ˆð ð 	Ø˜1˜2˜2”;ÐÝ'Ø!Ô/¸wÔ?TÐahÔasð
ñ 
ô 
ð 	
r    r…   )r   r   r   r   r4   r
   r   rR   r$   r   rM   rU   rV   s   @r!   r‡   r‡   p  s	  ø€ € € € € ð˜yð ð ð ð ð ð ð ð $(Ø(,Ø(,Ø'+Ø)-Ø,0Ø#'ðZ
ð Z
à˜D‘=ðZ
ð  ™ðZ
ð  ™ð	Z
ð
  ‘}ðZ
ð   $™;ðZ
ð # T™kðZ
ð ˜D‘[ðZ
ð 
" E¨&°#¨+Ô$6Ñ	6ðZ
ð Z
ð Z
ñ „^ðZ
ð Z
ð Z
ð Z
ð Z
r    r‡   zE
    The bare DPRReader transformer outputting span predictions.
    c                   ó    ‡ — e Zd Zdefˆ fd„Ze	 	 	 	 	 	 ddedz  dedz  dedz  dedz  dedz  d	edz  d
ee	edf         z  fd„¦   «         Z
ˆ xZS )Ú	DPRReaderr0   c                 ó¨   •— t          ¦   «                              |¦  «         || _        t          |¦  «        | _        |                      ¦   «          d S rv   )r3   r4   r0   rX   rr   r:   r;   s     €r!   r4   zDPRReader.__init__á  sH   ø€ Ý‰Œ×Ò˜Ñ Ô Ð ØˆŒÝ.¨vÑ6Ô6ˆÔà�ŠÑÔÐÐÐr    Nr>   r?   rA   rB   rC   rD   rE   .c                 óÄ  — |�|n| j         j        }|�|n| j         j        }|�|n| j         j        }|�|�t	          d¦  «        ‚|�+|                      ||¦  «         |                     ¦   «         }n.|�|                     ¦   «         dd…         }nt	          d¦  «        ‚|�|j        n|j        }	|€t          j	        ||	¬¦  «        }|  
                    ||||||¬¦  «        S )a£  
        input_ids (`tuple[torch.LongTensor]` of shapes `(n_passages, sequence_length)`):
            Indices of input sequence tokens in the vocabulary. It has to be a sequence triplet with 1) the question
            and 2) the passages titles and 3) the passages texts To match pretraining, DPR `input_ids` sequence should
            be formatted with [CLS] and [SEP] with the format:

            `[CLS] <question token ids> [SEP] <titles ids> [SEP] <texts ids>`

            DPR is a model with absolute position embeddings so it's usually advised to pad the inputs on the right
            rather than the left.

            Indices can be obtained using [`DPRReaderTokenizer`]. See this class documentation for more details.

            [What are input IDs?](../glossary#input-ids)
        inputs_embeds (`torch.FloatTensor` of shape `(n_passages, 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.

        Examples:

        ```python
        >>> from transformers import DPRReader, DPRReaderTokenizer

        >>> tokenizer = DPRReaderTokenizer.from_pretrained("facebook/dpr-reader-single-nq-base")
        >>> model = DPRReader.from_pretrained("facebook/dpr-reader-single-nq-base")
        >>> encoded_inputs = tokenizer(
        ...     questions=["What is love ?"],
        ...     titles=["Haddaway"],
        ...     texts=["'What Is Love' is a song recorded by the artist Haddaway"],
        ...     return_tensors="pt",
        ... )
        >>> outputs = model(**encoded_inputs)
        >>> start_logits = outputs.start_logits
        >>> end_logits = outputs.end_logits
        >>> relevance_logits = outputs.relevance_logits
        ```
        Nrx   r^   ry   rz   )rA   rB   rC   rD   )r0   rB   rC   rD   r6   rŠ   r`   r{   r   r   rr   )
r<   r>   r?   rA   rB   rC   rD   rI   r„   r{   s
             r!   rM   zDPRReader.forwardè  s!  € ðb 2CÐ1NÐ-Ð-ÐTXÔT_ÔTqÐà$8Ð$DÐ Ð È$Ì+ÔJjð 	ð &1Ð%<�k�kÀ$Ä+ÔBYˆàÐ  ]Ð%>ÝÐcÑdÔdÐdØÐ"Ø×6Ò6°yÀ.ÑQÔQÐQØ#Ÿ.š.Ñ*Ô*ˆKˆKØÐ&Ø'×,Ò,Ñ.Ô.¨s°¨sÔ3ˆKˆKåÐTÑUÔUÐUà%.Ð%:�Ô!Ð!ÀÔ@TˆàÐ!Ý"œZ¨¸FÐCÑCÔCˆNà×"Ò"ØØØ'Ø/Ø!5Ø#ð #ñ 
ô 
ð 	
r    )NNNNNN)r   r   r   r   r4   r
   r   rR   r&   r   rM   rU   rV   s   @r!   rŒ   rŒ   Û  s÷   ø€ € € € € ð˜yð ð ð ð ð ð ð ð $(Ø(,Ø'+Ø)-Ø,0Ø#'ðL
ð L
à˜D‘=ðL
ð  ™ðL
ð  ‘}ð	L
ð
   $™;ðL
ð # T™kðL
ð ˜D‘[ðL
ð 
˜5 ¨ Ô-Ñ	-ðL
ð L
ð L
ñ „^ðL
ð L
ð L
ð L
ð L
r    rŒ   )rt   ri   r+   rn   rq   r‡   rŒ   )"r   Údataclassesr   r   r   r   Úmodeling_outputsr   Úmodeling_utilsr   Úutilsr	   r
   r   Úbert.modeling_bertr   Úconfiguration_dprr   Ú
get_loggerr   Úloggerr   r$   r&   r+   r.   rX   ri   rn   rq   rt   r‡   rŒ   Ú__all__r   r    r!   ú<module>r˜      s  ðð <Ð ;à !Ð !Ð !Ð !Ð !Ð !à €€€Ø Ð Ð Ð Ð Ð Ð Ð à :Ð :Ð :Ð :Ð :Ð :Ø -Ð -Ð -Ð -Ð -Ð -ðð ð ð ð ð ð ð ð ð ð
 +Ð *Ð *Ð *Ð *Ð *Ø (Ð (Ð (Ð (Ð (Ð (ð 
ˆÔ	˜HÑ	%Ô	%€ð €ððñ ô ð
 ð
<ð 
<ð 
<ð 
<ð 
<˜kñ 
<ô 
<ñ „ñô ð
<ð €ððñ ô ð
 ð
<ð 
<ð 
<ð 
<ð 
<˜{ñ 
<ô 
<ñ „ñô ð
<ð €ððñ ô ð
 ð<ð <ð <ð <ð <�kñ <ô <ñ „ñô ð<ð$ ðð ð ð ð ˜ñ ô ñ „ðð62ð 62ð 62ð 62ð 62Ð#ñ 62ô 62ð 62ðr7
ð 7
ð 7
ð 7
ð 7
Ð)ñ 7
ô 7
ð 7
ð~&ð &ð &ð &ð &Ð"4ñ &ô &ð &ð+ð +ð +ð +ð +Ð#5ñ +ô +ð +ð)ð )ð )ð )ð )Ð,ñ )ô )ð )ð €ððñ ô ð
b
ð b
ð b
ð b
ð b
Ð3ñ b
ô b
ñô ð
b
ðJ €ððñ ô ð
c
ð c
ð c
ð c
ð c
Ð5ñ c
ô c
ñô ð
c
ðL €ððñ ô ð
U
ð U
ð U
ð U
ð U
Ð#ñ U
ô U
ñô ð
U
ðpð ð €€€r    