§
    ‚ŠtjH  ã                   ó�   — d Z ddlmZ ddlmZ ddlmZ ddlmZ  ed¬	¦  «        e G d
„ de¦  «        ¦   «         ¦   «         Z	dgZ
dS )zRAG model configurationé    )Ústricté   )ÚPreTrainedConfig)Úauto_docstringé   )Ú
AutoConfigÚ )Ú
checkpointc                   ó  ‡ — e Zd ZU dZdZdZdZedz  ed<   dZ	e
ed<   dZedz  ed<   dZedz  ed<   dZedz  ed	<   dZeee         z  dz  ed
<   dZedz  ed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZedz  ed<   dZedz  ed<   d Ze
ed!<   d Ze
ed"<   d#Ze ed$<   dZ!e
ed%<   d Z"e
ed&<   d Z#e
ed'<   d Z$e
ed(<   dZ%e
ed)<   dZ&edz  ed*<   ˆ fd+„Z'e(d,e)d-e)d.e)fd/„¦   «         Z*ˆ xZ+S )0Ú	RagConfiga%  
    prefix (`str`, *optional*):
        A string prefix prepended to every input before passing to the generator model.
    title_sep (`str`, *optional*, defaults to  `" / "`):
        Separator inserted between the title and the text of the retrieved document when calling [`RagRetriever`].
    doc_sep (`str`, *optional*, defaults to  `" // "`):
        Separator inserted between the text of the retrieved document and the original input when calling
        [`RagRetriever`].
    n_docs (`int`, *optional*, defaults to 5):
        Number of documents to retrieve.
    max_combined_length (`int`, *optional*, defaults to 300):
        Max length of contextualized input returned by [`~RagRetriever.__call__`].
    retrieval_vector_size (`int`, *optional*, defaults to 768):
        Dimensionality of the document embeddings indexed by [`RagRetriever`].
    retrieval_batch_size (`int`, *optional*, defaults to 8):
        Retrieval batch size, defined as the number of queries issues concurrently to the faiss index encapsulated
        [`RagRetriever`].
    dataset (`str`, *optional*, defaults to `"wiki_dpr"`):
        A dataset identifier of the indexed dataset in HuggingFace Datasets (list all available datasets and ids
        using `datasets.list_datasets()`).
    dataset_split (`str`, *optional*, defaults to `"train"`):
        Which split of the `dataset` to load.
    index_name (`str`, *optional*, defaults to `"compressed"`):
        The index name of the index associated with the `dataset`. One can choose between `"legacy"`, `"exact"` and
        `"compressed"`.
    index_path (`str`, *optional*):
        The path to the serialized faiss index on disk.
    passages_path (`str`, *optional*):
        A path to text passages compatible with the faiss index. Required if using
        [`~models.rag.retrieval_rag.LegacyIndex`]
    use_dummy_dataset (`bool`, *optional*, defaults to `False`):
        Whether to load a "dummy" variant of the dataset specified by `dataset`.
    reduce_loss (`bool`, *optional*, defaults to `False`):
        Whether or not to reduce the NLL loss using the `torch.Tensor.sum` operation.
    label_smoothing (`float`, *optional*, defaults to 0.0):
        Only relevant if `return_loss` is set to `True`. Controls the `epsilon` parameter value for label smoothing
        in the loss calculation. If set to 0, no label smoothing is performed.
    do_deduplication (`bool`, *optional*, defaults to `True`):
        Whether or not to deduplicate the generations from different context documents for a given input. Has to be
        set to `False` if used while training with distributed backend.
    exclude_bos_score (`bool`, *optional*, defaults to `False`):
        Whether or not to disregard the BOS token when computing the loss.
    do_marginalize (`bool`, *optional*, defaults to `False`):
        If `True`, the logits are marginalized over all documents by making use of
        `torch.nn.functional.log_softmax`.
    output_retrieved (`bool`, *optional*, defaults to `False`):
        If set to `True`, `retrieved_doc_embeds`, `retrieved_doc_ids`, `context_input_ids` and
        `context_attention_mask` are returned. See returned tensors for more detail.
    dataset_revision (`str`, *optional*,):
        The revision (commit hash, tag, or branch) of the Hugging Face dataset used for retrieval.
    ÚragTNÚ
vocab_sizeÚis_encoder_decoderÚprefixÚbos_token_idÚpad_token_idÚeos_token_idÚdecoder_start_token_idz / Ú	title_sepz // Údoc_sepé   Ún_docsi,  Úmax_combined_lengthi   Úretrieval_vector_sizeé   Úretrieval_batch_sizeÚwiki_dprÚdatasetÚtrainÚdataset_splitÚ
compressedÚ
index_nameÚ
index_pathÚpassages_pathFÚuse_dummy_datasetÚreduce_lossg        Úlabel_smoothingÚdo_deduplicationÚexclude_bos_scoreÚdo_marginalizeÚoutput_retrievedÚ	use_cacheÚdataset_revisionc                 ó‚  •— d|vsd|vrt          d| j        › d|› �¦  «        ‚|                     d¦  «        }|                     d¦  «        }|                     d¦  «        }|                     d¦  «        }t          j        |fi |¤Ž| _        t          j        |fi |¤Ž| _         t          ¦   «         j        di |¤Ž d S )NÚquestion_encoderÚ	generatorzA configuration of type zt cannot be instantiated because not both `question_encoder` and `generator` sub-configurations are passed, but only Ú
model_type© )	Ú
ValueErrorr1   Úpopr   Ú	for_modelr/   r0   ÚsuperÚ__post_init__)ÚselfÚkwargsÚquestion_encoder_configÚquestion_encoder_model_typeÚdecoder_configÚdecoder_model_typeÚ	__class__s         €úg/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/rag/configuration_rag.pyr7   zRagConfig.__post_init__m   sø   ø€ Ø VÐ+Ð+¨{À&Ð/HÐ/HÝðQ¨4¬?ð Qð QØHNðQð Qñô ð ð
 #)§*¢*Ð-?Ñ"@Ô"@ÐØ&=×&AÒ&AÀ,Ñ&OÔ&OÐ#ØŸš KÑ0Ô0ˆØ+×/Ò/°Ñ=Ô=Ðå *Ô 4Ð5PÐ lÐ lÐTkÐ lÐ lˆÔÝ#Ô-Ð.@ÐSÐSÀNÐSÐSˆŒà�‰ŒÔÐ'Ð' Ð'Ð'Ð'Ð'Ð'ó    r:   Úgenerator_configÚreturnc                 ó`   —  | d|                      ¦   «         |                      ¦   «         dœ|¤ŽS )a  
        Instantiate a [`EncoderDecoderConfig`] (or a derived class) from a pre-trained encoder model configuration and
        decoder model configuration.

        Returns:
            [`EncoderDecoderConfig`]: An instance of a configuration object
        )r/   r0   r2   )Úto_dict)Úclsr:   rA   r9   s       r?   Ú'from_question_encoder_generator_configsz1RagConfig.from_question_encoder_generator_configs~   s<   € ð ˆsÐvÐ$;×$CÒ$CÑ$EÔ$EÐQa×QiÒQiÑQkÔQkÐvÐvÐouÐvÐvÐvr@   ),Ú__name__Ú
__module__Ú__qualname__Ú__doc__r1   Úhas_no_defaults_at_initr   ÚintÚ__annotations__r   Úboolr   Ústrr   r   r   Úlistr   r   r   r   r   r   r   r   r    r"   r#   r$   r%   r&   r'   Úfloatr(   r)   r*   r+   r,   r-   r7   Úclassmethodr   rF   Ú__classcell__)r>   s   @r?   r   r      sy  ø€ € € € € € ð2ð 2ðh €JØ"Ðà!€J��d‘
Ð!Ð!Ñ!Ø#Ð˜Ð#Ð#Ñ#Ø€FˆC�$‰JÐÐÑØ#€L�#˜‘*Ð#Ð#Ñ#Ø#€L�#˜‘*Ð#Ð#Ñ#Ø+/€L�#˜˜Sœ	‘/ DÑ(Ð/Ð/Ñ/Ø)-Ð˜C $™JÐ-Ð-Ñ-Ø€IˆsÐÐÑØ€GˆSÐÐÑØ€FˆC€O€O�OØ"Ð˜Ð"Ð"Ñ"Ø!$Ð˜3Ð$Ð$Ñ$Ø !Ð˜#Ð!Ð!Ñ!Ø€GˆSÐÐÑØ €M�3Ð Ð Ñ Ø"€J�Ð"Ð"Ñ"Ø!€J��d‘
Ð!Ð!Ñ!Ø $€M�3˜‘:Ð$Ð$Ñ$Ø#Ð�tÐ#Ð#Ñ#Ø€K�ÐÐÑØ €O�UÐ Ð Ñ Ø!Ð�dÐ!Ð!Ñ!Ø#Ð�tÐ#Ð#Ñ#Ø €N�DÐ Ð Ñ Ø"Ð�dÐ"Ð"Ñ"Ø€IˆtÐÐÑØ#'Ð�c˜D‘jÐ'Ð'Ñ'ð(ð (ð (ð (ð (ð" ð
wØ&6ð
wØJZð
wà	ð
wð 
wð 
wñ „[ð
wð 
wð 
wð 
wð 
wr@   r   N)rJ   Úhuggingface_hub.dataclassesr   Úconfiguration_utilsr   Úutilsr   Úauto.configuration_autor   r   Ú__all__r2   r@   r?   ú<module>rY      sÂ   ðð Ð à .Ð .Ð .Ð .Ð .Ð .à 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø #Ð #Ð #Ð #Ð #Ð #Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0ð €˜2ÐÑÔØðpwð pwð pwð pwð pwÐ ñ pwô pwñ „ñ Ôðpwðf ˆ-€€€r@   