§
    ™Štj/  ã                  óÆ   — d dl mZ d dlZd dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
 dd„Zdd
„Z	 ddddddddœd d„Zed„ ¦   «         Zeej        fd„¦   «         Zd„ Zg d¢ZdS )!é    )ÚannotationsN)Úcontextmanager)ÚisclassÚreturnÚstrc                ó’   — t          | ¦  «        s| j        } | j        }|�|t          j        j        k    r| j        S |dz   | j        z   S )aI  
    Gives a full name (package_name.class_name) for a class / object in Python. Will
    be used to load the correct classes from JSON files

    Args:
        obj: The object for which to get the full name, e.g. an instance of a class or the class itself.

    Returns:
        str: The full name of the object.

    Example:
        >>> from sentence_transformers.sentence_transformer.losses import MultipleNegativesRankingLoss
        >>> from sentence_transformers import SentenceTransformer
        >>> from sentence_transformers.util import fullname
        >>> model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
        >>> loss = MultipleNegativesRankingLoss(model)
        >>> fullname(loss)
        'sentence_transformers.sentence_transformer.losses.multiple_negatives_ranking.MultipleNegativesRankingLoss'
    Nú.)r   Ú	__class__Ú
__module__r   Ú__name__)ÚobjÚmodules     ú]/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sentence_transformers/util/misc.pyÚfullnamer      sM   € õ( �3‰<Œ<ð ØŒmˆØŒ^€FØ€~˜¥3¤=Ô#;Ò;Ð;ØŒ|ÐØ�C‰<˜#œ,Ñ&Ð&ó    Údotted_pathÚtypec                óè  — 	 |                       dd¦  «        \  }}n"# t          $ r | › d�}t          |¦  «        ‚w xY wt          j        ¦   «         5  t          j        dt          ¦  «         	 t          j        | ¦  «        }n$# t          $ r t          j        |¦  «        }Y nw xY wddd¦  «         n# 1 swxY w Y   	 t          ||¦  «        S # t          $ r d|› d|› d�}t          |¦  «        ‚w xY w)	a}  
    Import a dotted module path and return the attribute/class designated by the
    last name in the path. Raise ImportError if the import failed.

    Args:
        dotted_path (str): The dotted module path.

    Returns:
        Any: The attribute/class designated by the last name in the path.

    Raises:
        ImportError: If the import failed.

    Example:
        >>> import_from_string('sentence_transformers.sentence_transformer.losses.multiple_negatives_ranking.MultipleNegativesRankingLoss')
        <class 'sentence_transformers.sentence_transformer.losses.multiple_negatives_ranking.MultipleNegativesRankingLoss'>
    r	   é   z  doesn't look like a module pathÚignoreNzModule "z" does not define a "z" attribute/class)ÚrsplitÚ
ValueErrorÚImportErrorÚwarningsÚcatch_warningsÚsimplefilterÚDeprecationWarningÚ	importlibÚimport_moduleÚ	ExceptionÚgetattrÚAttributeError)r   Úmodule_pathÚ
class_nameÚmsgr   s        r   Úimport_from_stringr&   (   sp  € ð$Ø"-×"4Ò"4°S¸!Ñ"<Ô"<Ñˆ�Z�ZøÝð ð ð ØÐ>Ð>Ð>ˆÝ˜#ÑÔÐðøøøõ
 
Ô	 Ñ	"Ô	"ð :ð :ÝÔ˜hÕ(:Ñ;Ô;Ð;ð	:ÝÔ,¨[Ñ9Ô9ˆFˆFøÝð 	:ð 	:ð 	:ÝÔ,¨[Ñ9Ô9ˆFˆFˆFð	:øøøð	:ð :ð :ñ :ô :ð :ð :ð :ð :ð :ð :øøøð :ð :ð :ð :ðÝ�v˜zÑ*Ô*Ð*øÝð ð ð ØX˜ÐXÐX¸:ÐXÐXÐXˆÝ˜#ÑÔÐðøøøsJ   ‚ œ;ÁB2Á-BÂB2ÂB#Â B2Â"B#Â#B2Â2B6Â9B6Â>C Ã#C1F)Útrust_remote_codeÚrevisionÚcode_revisionÚtokenÚcache_folderÚlocal_files_onlyÚ	class_refÚmodel_name_or_pathú
str | Noner'   Úboolr(   r)   r*   úbool | str | Noner+   r,   c          	     óÀ  — |                       d¦  «        rt          | ¦  «        S |duot          j                             |¦  «        }|p|}	|�Y|	rWddlm}
 	  |
| ||||||¬¦  «        }|s#t          j        d| ›d|›d�t          d	¬
¦  «         |S # t          t          f$ r Y nw xY w|�(|	s&t          j        d|›d| ›d|›d�t          d	¬
¦  «         t          | ¦  «        S )a)  
    Resolve a module class reference to a class object.

    For class refs in the ``sentence_transformers.*`` namespace, this imports directly via
    :func:`import_from_string`. For other class refs (e.g. repository-local custom classes
    like ``modeling_my_model.CustomTransformer``), it first tries
    :func:`transformers.dynamic_module_utils.get_class_from_dynamic_module` to fetch the
    modeling file from the model directory, then falls back to :func:`import_from_string`
    if dynamic loading is not applicable or fails.

    Importing a class outside the ``sentence_transformers.*`` namespace runs code selected by the model's
    configuration (repository-hosted modeling code via dynamic loading, or a locally installed package via
    direct import). Loading such a class is fully trusted only when ``trust_remote_code`` is set, or when
    ``model_name_or_path`` resolves to a local directory (i.e. the user already has the file on disk and is
    implicitly trusted).

    .. deprecated:: 5.6
        The implicit trust of local directories is deprecated and will be removed in v6.0.
        From v6.0, loading repository-local custom code will require ``trust_remote_code=True``,
        matching the behavior for models loaded from the Hugging Face Hub. A ``FutureWarning`` is
        emitted whenever a local model is loaded via this short-circuit without
        ``trust_remote_code=True``.

    .. deprecated:: 5.7
        Importing a module class outside the ``sentence_transformers.*`` namespace from an untrusted,
        non-local model is deprecated. It currently emits a ``FutureWarning`` and will be refused from
        v6.0, when ``trust_remote_code=True`` becomes required for these imports.

    Args:
        class_ref: Dotted class path. Either a fully-qualified ``sentence_transformers.*``
            path or a repository-local reference like ``modeling_<name>.<ClassName>``.
        model_name_or_path: Hub repo id or local directory used to source repository-local
            modeling files. Required for dynamic loading.
        trust_remote_code: Whether to trust and import code selected by the model configuration. Permits
            dynamic loading from an unverified Hub repo, and (from v6.0) is required to import a
            non-``sentence_transformers.*`` class.
        revision: Hub revision to fetch the modeling file from.
        code_revision: Optional separate revision pinning for the modeling code (overrides
            ``revision`` when set).
        token: Hugging Face Hub authentication token. Required for fetching modeling files
            from private repositories.
        cache_folder: Optional override for the Hugging Face Hub cache directory.
        local_files_only: If True, only use cached files and never reach out to the Hub.

    Returns:
        The resolved class.
    zsentence_transformers.Nr   )Úget_class_from_dynamic_module)r(   r)   r*   Ú	cache_dirr,   zLoading custom module z from local path zz without `trust_remote_code=True` is deprecated. It will require `trust_remote_code=True` from Sentence Transformers v6.0.é   )Ú
stacklevelz
The model z references the module class zÔ, which is not part of Sentence Transformers. Importing it executes third-party code, and will start requiring `trust_remote_code=True` from Sentence Transformers v6.0. Pass `trust_remote_code=True` if you trust z to reference a safe class.)Ú
startswithr&   ÚosÚpathÚisdirÚ!transformers.dynamic_module_utilsr3   r   ÚwarnÚFutureWarningÚOSErrorr   )r-   r.   r'   r(   r)   r*   r+   r,   Úis_local_dirÚtrustedr3   Úmodule_classs               r   Úimport_module_classrB   O   s•  € ðt ×ÒÐ4Ñ5Ô5ð -Ý! )Ñ,Ô,Ð,à%¨TÐ1ÐWµb´g·m²mÐDVÑ6WÔ6W€LØÐ/ <€GØÐ%¨'Ð%ØSÐSÐSÐSÐSÐSð	 Ø8Ð8ØØ"Ø!Ø+ØØ&Ø!1ðñ ô ˆLð %ð Ý”ð3¨Yð 3ð 3ÐK]ð 3ð 3ð 3õ "Ø ðñ ô ð ð  Ðøõ �Ð$ð 	ð 	ð 	àˆDð	øøøð  Ð%¨gÐ%åŒðGÐ+ð Gð GÈIð Gð Gð (ðGð Gð Gõ Øð	
ñ 	
ô 	
ð 	
õ ˜iÑ(Ô(Ð(s   ÁB ÂB$Â#B$c               #  ó”   K  — ddl m} m}m}  |¦   «         }	 |r
 | ¦   «          dV — |r |¦   «          dS dS # |r |¦   «          w w xY w)zN
    A context manager that will disable caching in the datasets library.
    r   )Údisable_cachingÚenable_cachingÚis_caching_enabledN)ÚdatasetsrD   rE   rF   )rD   rE   rF   Úis_originally_enableds       r   Údisable_datasets_cachingrI   ¸   s¢   è è € ð
 MÐLÐLÐLÐLÐLÐLÐLÐLÐLà.Ð.Ñ0Ô0ÐðØ ð 	ØˆOÑÔÐØˆˆˆà ð 	ØˆNÑÔÐÐÐð	ð 	øÐ ð 	ØˆNÑÔÐÐð	øøøs	   ˜8 ¸Ac              #  óÂ   K  — t           j        j        j        }t          j        | ¦  «         	 dV — t          j        |¦  «         dS # t          j        |¦  «         w xY w)z»
    A context manager that will prevent any logging messages
    triggered during the body from being processed.

    Args:
        highest_level: the maximum logging level allowed.
    N)ÚloggingÚrootÚmanagerÚdisable)Úhighest_levelÚprevious_levels     r   Údisable_loggingrQ   Ê   s_   è è € õ ”\Ô)Ô1€NÝ„O�MÑ"Ô"Ð"ð(ØˆˆˆåŒ˜Ñ'Ô'Ð'Ð'Ð'ø�Œ˜Ñ'Ô'Ð'Ð'øøøs   ®A ÁAc                ó¨  — t          | dd¬¦  «        5 }t          j        |¦  «        }t          |¦  «        }d d d ¦  «         n# 1 swxY w Y   t	          |¦  «        dk    rq|d                              |¦  «         t          | ddd¬¦  «        5 }t          j        |¦  «        }|                     |¦  «         d d d ¦  «         n# 1 swxY w Y   dS dS )	NÚ zutf-8)ÚnewlineÚencodingr   éÿÿÿÿÚwTF)ÚopenÚcsvÚreaderÚlistÚlenÚextendÚwriterÚ	writerows)Úcsv_pathÚadditional_dataÚfrZ   Úrowsr^   s         r   Úappend_to_last_rowrd   Ü   s@  € å	ˆh ¨WÐ	5Ñ	5Ô	5ð ¸Ý”˜A‘”ˆÝ�F‰|Œ|ˆðð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ ˆ4�y„y�1‚}€}àˆRŒ�Š˜Ñ(Ô(Ð(õ �(˜C¨°gÐ>Ñ>Ô>ð 	#À!Ý”Z ‘]”]ˆFØ×Ò˜TÑ"Ô"Ð"ð	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð ˆtØˆ5s#   “$AÁAÁ
AÂ*CÃC	ÃC	)Dzalbert-base-v1zalbert-base-v2zalbert-large-v1zalbert-large-v2zalbert-xlarge-v1zalbert-xlarge-v2zalbert-xxlarge-v1zalbert-xxlarge-v2zbert-base-cased-finetuned-mrpczbert-base-casedzbert-base-chinesezbert-base-german-casedzbert-base-german-dbmdz-casedzbert-base-german-dbmdz-uncasedzbert-base-multilingual-casedzbert-base-multilingual-uncasedzbert-base-uncasedz3bert-large-cased-whole-word-masking-finetuned-squadz#bert-large-cased-whole-word-maskingzbert-large-casedz5bert-large-uncased-whole-word-masking-finetuned-squadz%bert-large-uncased-whole-word-maskingzbert-large-uncasedzcamembert-baseÚctrlz%distilbert-base-cased-distilled-squadzdistilbert-base-casedzdistilbert-base-german-casedz"distilbert-base-multilingual-casedz'distilbert-base-uncased-distilled-squadz/distilbert-base-uncased-finetuned-sst-2-englishzdistilbert-base-uncasedÚ
distilgpt2zdistilroberta-basez
gpt2-largezgpt2-mediumzgpt2-xlÚgpt2z
openai-gptzroberta-base-openai-detectorzroberta-basezroberta-large-mnlizroberta-large-openai-detectorzroberta-largezt5-11bzt5-3bzt5-basezt5-largezt5-smallztransfo-xl-wt103zxlm-clm-ende-1024zxlm-clm-enfr-1024zxlm-mlm-100-1280zxlm-mlm-17-1280zxlm-mlm-en-2048zxlm-mlm-ende-1024zxlm-mlm-enfr-1024zxlm-mlm-enro-1024zxlm-mlm-tlm-xnli15-1024zxlm-mlm-xnli15-1024zxlm-roberta-basez)xlm-roberta-large-finetuned-conll02-dutchz+xlm-roberta-large-finetuned-conll02-spanishz+xlm-roberta-large-finetuned-conll03-englishz*xlm-roberta-large-finetuned-conll03-germanzxlm-roberta-largezxlnet-base-casedzxlnet-large-cased)r   r   )r   r   r   r   )N)r-   r   r.   r/   r'   r0   r(   r/   r)   r/   r*   r1   r+   r/   r,   r0   r   r   )Ú
__future__r   rY   r   rK   r8   r   Ú
contextlibr   Úinspectr   r   r&   rB   rI   ÚCRITICALrQ   rd   ÚORIGINAL_TRANSFORMER_MODELS© r   r   ú<module>rn      sC  ðØ "Ð "Ð "Ð "Ð "Ð "à 
€
€
€
Ø Ð Ð Ð Ø €€€Ø 	€	€	€	Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð ð'ð 'ð 'ð 'ð8$ð $ð $ð $ðR &*ðf)ð $ØØ $Ø#Ø#Ø"ðf)ð f)ð f)ð f)ð f)ð f)ðR ðð ñ „ðð" Ø")Ô"2ð (ð (ð (ñ „ð(ð"ð ð ð(Eð Eð EÐ Ð Ð r   