ó
    >:jš" ã                  óú  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
JrJr  S SKJr  S SKJr  S SKJr  S SKJrJr  S SKrS SKrS SKJr  S SKrS SKJrJr  S S	KJ r   S S
KJ!r!J"r"  S SKJ#r#J$r$J%r%  S SK&J'r'J(r(  S SK)J*r+  S SK,J-r-  S SK.J/r/  S SK0J1r1J2r2  S SK3J4r4J5r5J6r6  S SK7J8r8J9r9  S SK:J;r;J<r<J=r=  S SK>J?r?  S SK@JArAJBrBJCrCJDrDJErE  S SKFJGrG  \+R�                  " \I5      rJ " S S\"R–                  \?\5      rLg)é    )ÚannotationsN)ÚABCÚabstractmethod)ÚOrderedDict)ÚQueue)ÚPath)ÚAnyÚLiteral)ÚCardDataÚHfApi)Úversion)ÚTensorÚnn)ÚPreTrainedModelÚis_datasets_availableÚis_torch_npu_available)Úget_class_from_dynamic_moduleÚget_relative_import_files)Úlogging)Ú__version__)ÚBaseEvaluator)Úformat_modalityÚinfer_batch_modality)ÚModalityÚ	PairInputÚSingleInput)ÚBaseModelCardDataÚgenerate_model_card)ÚModuleÚRouterÚTransformer)ÚPeftAdapterMixin)Úget_device_nameÚimport_from_stringÚload_dir_pathÚload_file_pathÚsave_to_hub_args_decorator)ÚORIGINAL_TRANSFORMER_MODELSc                  óÔ  ^ • \ rS rSr% Sr\rSrS\S'   0 r	S\S'   Sr
S	\S
'    SASSSSSSSSSSSSSSS.                               SBU 4S jjjjrSCS jrSDS jrSES jr\SFS j5       rSGS jrSHS jrSIS jrSJS jrSJS jrSKS jr\SLS j5       r\SMS j5       rSNS jr SA     SOS jjrSPS jrSQS jr    SR           SSS jjrSTS  jr    SR           SSS! jjr SUS" jr! SV       SWS# jjr"\#         SX                     SYS$ jj5       r$          SZ                       S[S% jjr%      S\                   S]S& jjr&\'      S\                   S]S' jj5       r(      S\                   S]S( jjr)S^S) jr*       S_                     S`S* jjr+  Sa           SbS+ jjr,            ScS, jr-SASdS- jjr.SASeS. jjr/\SfS/ j5       r0 SA   SgS0 jjr1\ShS1 j5       r2S2 r3\          SiS3 j5       r4\SjS4 j5       r5\5Rl                  SCS5 j5       r5\SjS6 j5       r7\SIS7 j5       r8\8Rl                  SCS8 j5       r8\SkS9 j5       r9\SfS: j5       r:\:Rl                  SASlS; jj5       r:\SmS< j5       r;\SHS= j5       r<\SHS> j5       r=SnS? jr>S@r?U =r@$ )oÚ	BaseModelé/   aÜ  
Base class for SentenceTransformer, SparseEncoder, and CrossEncoder models.

This class provides common functionality for:

- Model loading (from Hub, local paths, or creating new models)
- Model saving (to disk and Hub)
- Device management
- Module architecture (sequential composition)
- Configuration management
- Tokenizer/processor access

All models inherit from nn.Sequential and are composed of a sequence of modules
that are called sequentially in the forward pass.
Nú
str | NoneÚ default_huggingface_organizationzdict[str, str | None]Ú_default_promptsÚsentence_transformers_model_idÚstrÚ _model_card_model_id_placeholderFÚtorch)ÚmodulesÚdeviceÚpromptsÚdefault_prompt_nameÚcache_folderÚtrust_remote_codeÚrevisionÚlocal_files_onlyÚtokenÚmodel_kwargsÚprocessor_kwargsÚconfig_kwargsÚmodel_card_dataÚbackendc               ó  >• [        U R                  5      nU(       a  UR                  U5        UU l        XPl        Xpl        U=(       d    U R                  U	S9U l        SU l        0 U l	        SU l
        U R                  R                  U l        Xðl        Uc  [        R                   " S5      nUc"  [#        5       n[$        R'                  SU 35        US:X  a-  [(        R*                  R-                  S5      b  SSKJn  U" 5         U(       až  [        R2                  R5                  U5      (       dz  [        R6                  S	:X  a  S	U;   d  UR9                  S
5      S:”  a  [;        SU S35      eU R<                  b/  S
U;  a)  UR?                  5       [@        ;  a  U R<                   S
U 3nU(       a  U RC                  UU
UUUU	UUUS9	u  o l        UbJ  [E        U[F        5      (       d5  [G        [I        U5       VVs/ s H  u  nn[K        U5      U4PM     snn5      nUb1  [M        U5      S:X  a"  [O        S[Q        U 5      R                   S35      e[R        TU ]©  U5        [W        U S   RY                  5       S5      nUb@  URZ                  n[]        U R_                  5       5      SS  H  nURa                  U5        M     U Ra                  U5        SU l1        U Re                  5         U R                  Rg                  U 5        gs  snnf )aG  
Initialize a BaseModel instance.

Args:
    model_name_or_path (str, optional): If a filepath on disk, loads the model from that path. Otherwise,
        tries to download a pre-trained model. If that fails, tries to construct a model from the Hugging
        Face Hub with that name. Defaults to None.
    modules (list[nn.Module], optional): A list of torch modules that are called sequentially. Can be used
        to create custom models from scratch. Defaults to None.
    device (str, optional): Device (like ``"cuda"``, ``"cpu"``, ``"mps"``, ``"npu"``) that should be used
        for computation. If None, checks if a GPU can be used. Defaults to None.
    prompts (dict[str, str], optional): A dictionary with prompts for the model. The key is the prompt
        name, the value is the prompt text. The prompt text will be prepended before any text during inference.
        For example: ``{"query": "query: ", "passage": "passage: "}``. If a model has saved prompts, you
        can override them by passing your own, or pass ``{"query": "", "document": ""}`` to disable them.
        Defaults to None.
    default_prompt_name (str, optional): The name of the prompt that should be used by default. If not
        set, no prompt will be applied. Defaults to None.
    cache_folder (str, optional): Path to store models. Can also be set by the
        ``SENTENCE_TRANSFORMERS_HOME`` environment variable. Defaults to None.
    trust_remote_code (bool, optional): Whether to allow for custom models defined on the Hub in their
        own modeling files. Only set to ``True`` for repositories you trust and in which you have read the
        code, as it will execute code present on the Hub on your local machine. Defaults to False.
    revision (str, optional): The specific model version to use. It can be a branch name, a tag name, or
        a commit id, for a stored model on Hugging Face. Defaults to None.
    local_files_only (bool, optional): Whether to only look at local files (i.e., do not try to download
        the model). Defaults to False.
    token (bool or str, optional): Hugging Face authentication token to download private models.
        Defaults to None.
    model_kwargs (dict[str, Any], optional): Keyword arguments passed to the underlying Hugging Face
        Transformers model via ``AutoModel.from_pretrained``. Particularly useful options include:

        - ``torch_dtype``: Override the default ``torch.dtype`` and load the model under a specific
          dtype. Can be ``torch.float16``, ``torch.bfloat16``, ``torch.float32``, or ``"auto"`` to
          use the dtype from the model's ``config.json``.
        - ``attn_implementation``: The attention implementation to use. For example ``"eager"``,
          ``"sdpa"``, or ``"flash_attention_2"``. If you ``pip install kernels``, then
          ``"flash_attention_2"`` should work without having to install ``flash_attn``. It is
          frequently the fastest option. Defaults to ``"sdpa"`` when available (torch>=2.1.1).
        - ``device_map``: Device map for model parallelism, e.g. ``"auto"``.
        - ``provider``: For ``backend="onnx"``, the ONNX execution provider
          (e.g. ``"CUDAExecutionProvider"``).
        - ``file_name``: For ``backend="onnx"`` or ``"openvino"``, the filename to load
          (e.g. for optimized or quantized models).
        - ``export``: For ``backend="onnx"`` or ``"openvino"``, whether to export the model to the
          backend format. Also set automatically if the exported file doesn't exist.

        See the `PreTrainedModel.from_pretrained
        <https://huggingface.co/docs/transformers/en/main_classes/model#transformers.PreTrainedModel.from_pretrained>`_
        documentation for more details. Defaults to None.
    processor_kwargs (dict[str, Any], optional): Keyword arguments passed to the Hugging Face Transformers
        processor/tokenizer via ``AutoProcessor.from_pretrained``. See the
        `AutoTokenizer.from_pretrained
        <https://huggingface.co/docs/transformers/en/model_doc/auto#transformers.AutoTokenizer.from_pretrained>`_
        documentation for more details. Defaults to None.
    config_kwargs (dict[str, Any], optional): Keyword arguments passed to the Hugging Face Transformers
        config via ``AutoConfig.from_pretrained``. See the `AutoConfig.from_pretrained
        <https://huggingface.co/docs/transformers/en/model_doc/auto#transformers.AutoConfig.from_pretrained>`_
        documentation for more details. Defaults to None.
    model_card_data (CardData, optional): A model card data object that contains information about the
        model. Used to generate a model card when saving the model. If not set, a default model card data
        object is created. Defaults to None.
    backend (str, optional): The backend to use for inference. Can be ``"torch"`` (default), ``"onnx"``,
        or ``"openvino"``. Defaults to ``"torch"``.
)r:   NÚSENTENCE_TRANSFORMERS_HOMEzNo device provided, using ÚhpuÚoptimumr   )Úadapt_transformers_to_gaudiÚ\Ú/é   zPath z
 not found©r;   r7   r9   r8   r:   r<   r=   r>   z$An empty modules list was passed to z@. Please provide at least one module, e.g. a Transformer module.F)4Údictr.   Úupdater5   r6   r8   Úmodel_card_data_classr?   Úmodule_kwargsÚ_model_card_varsÚ_model_card_textÚ	__class__Ú__name__Ú
model_typer@   ÚosÚgetenvr#   ÚloggerÚinfoÚ	importlibÚutilÚ	find_specÚ*optimum.habana.transformers.modeling_utilsrE   ÚpathÚexistsÚsepÚcountÚFileNotFoundErrorr-   Úlowerr(   Ú_load_modulesÚ
isinstancer   Ú	enumerater0   ÚlenÚ
ValueErrorÚtypeÚsuperÚ__init__ÚnextÚ
parametersÚdtypeÚlistÚchildrenÚtoÚis_hpu_graph_enabledÚ_validate_promptsÚregister_model)ÚselfÚmodel_name_or_pathr3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   Údefault_promptsrE   ÚidxÚmoduleÚfirst_paramÚfirst_dtyperP   s                         €Ú]/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sentence_transformers/base/model.pyrh   ÚBaseModel.__init__J   sÓ  ø€ ôh ˜t×4Ñ4Ó5ˆÞØ×"Ñ" 7Ô+Ø&ˆŒØ#6Ô Ø!2ÔØ.×o°$×2LÑ2LÐ^nÐ2LÐ2oˆÔØ!ˆÔØ "ˆÔØ $ˆÔØŸ.™.×1Ñ1ˆŒØŒàÑÜŸ9š9Ð%AÓBˆLð ‰>Ü$Ó&ˆFÜ�K‰KÐ4°V°HÐ=Ô>à�U‹?œyŸ~™~×7Ñ7¸	ÓBÑNÝ^á'Ô)ö ¤b§g¡g§n¡nÐ5G×&HÑ&Hä—‘˜$“ 4Ð+=Ó#=ÐBT×BZÑBZÐ[^ÓB_ÐbcÓBcÜ'¨%Ð0BÐ/CÀ:Ð(NÓOÐOð ×5Ñ5ÑAØÐ1Ó1Ø&×,Ñ,Ó.Ô6QÓQà(,×(MÑ(MÐ'NÈaÐPbÐOcÐ%dÐ"æØ*.×*<Ñ*<Ø"ØØ)Ø!Ø"3Ø!1Ø)Ø!1Ø+ð +=ð 
+Ñ'ˆGÔ'ð Ñ¤z°'¼;×'GÑ'GÜ!ÌÐSZÔI[Ô"\ÒI[¹+¸#¸v¤C¨£H¨fÓ#5ÑI[Ò"\Ó]ˆGàÑ¤3 w£<°1Ó#4ÜØ6´t¸D³z×7JÑ7JÐ6Kð LQð Qóð ô
 	‰Ñ˜Ô!ô
 ˜4 ™7×-Ñ-Ó/°Ó6ˆØÑ"Ø%×+Ñ+ˆKÜ˜tŸ}™}›Ó/°°Ó3�Ø—	‘	˜+Ö&ñ 4ð 	�‰�ŒØ$)ˆÔ!ð 	×ÑÔ ð 	×Ñ×+Ñ+¨DÕ1ùó5 #]s   Ç;L
c           	     ó�  • U R                   R                  5        H  u  pUb  M
  SU R                   U'   M     U R                  bX  U R                  U R                   ;  a>  [        SU R                   S[	        U R                   R                  5       5      < S35      eU R                   R                  5        VVs/ s H  u  p4US:w  d  M  UPM     snn=n(       a1  [        U5      n[        R                  SU SUS:”  a  S	OS S
U 35        U R                  (       a$  [        R                  SU R                   S35        ggs  snnf )z9Validate prompt configuration and log prompt information.NÚ zDefault prompt name 'ú;' not found in the configured prompts dictionary with keys Ú.zLoaded z promptrH   Úsz with these keys: zDefault prompt name is set to 'zs'. This prompt will be applied to all inference calls, except if a `prompt` or `prompt_name` parameter is provided.)
r5   Úitemsr6   re   rl   Úkeysrd   rU   rV   Úwarning_once)rr   ÚkeyÚvalueÚkÚvÚnon_empty_keysÚns          ry   rp   ÚBaseModel._validate_promptsï   s8  € ð Ÿ,™,×,Ñ,Ö.‰JˆCØ‹}Ø$&�—‘˜SÓ!ñ /ð ×#Ñ#Ñ/°D×4LÑ4LÐTX×T`ÑT`Ó4`ÜØ'¨×(@Ñ(@Ð'Að B(Ü(,¨T¯\©\×->Ñ->Ó-@Ó(AÑ'DÀAðGóð ð
 -1¯L©L×,>Ñ,>Ô,@ÔLÒ,@¡D AÀAÈÁGŸaÑ,@ÒLÐLˆ>ÕLÜ�NÓ#ˆAÜ�K‰K˜' !  G°1°q³5©C¸bÐ+AÐASÐTbÐScÐdÔeØ×#×#Ü×ÑØ1°$×2JÑ2JÐ1Kð LEð Fõð $ùó Ms   Â:EÃ
Ec           
     óT  • UcJ  Ub   U R                   U   nU$ U R
                  b&  U R                   R                  U R
                  S5      nU$ Ub  [        R                  S5        U$ ! [         a5    [        SU S[        U R                   R	                  5       5      < S35      ef = f)zöResolve a prompt from a prompt name or the default prompt name.

Args:
    prompt: An explicit prompt string, or None.
    prompt_name: A key into ``self.prompts``, or None.

Returns:
    The resolved prompt string, or None if no prompt applies.
NzPrompt name 'r}   r~   zvProvide either a `prompt`, a `prompt_name`, or neither, but not both. Ignoring the `prompt_name` in favor of `prompt`.)	r5   ÚKeyErrorre   rl   r�   r6   ÚgetrU   Úwarning)rr   ÚpromptÚprompt_names      ry   Ú_resolve_promptÚBaseModel._resolve_prompt  sç   € ð ‰>ØÑ&ðØ!Ÿ\™\¨+Ñ6�Fð ˆð ×)Ñ)Ñ5ØŸ™×)Ñ)¨$×*BÑ*BÀDÓI�ð ˆð Ñ$Ü�N‰NðCôð ˆøô  ó Ü$Ø'¨ }Ð4oÔptÐuy÷  vBñ  vB÷  vGñ  vGó  vIó  qJñ  pMð  MNð  Oóð ðús   ˆA( Á(?B'c                ó   • U R                   $ )zŽReturn the backend used for inference, which can be one of "torch", "onnx", or "openvino".

Returns:
    str: The backend used for inference.
)r@   ©rr   s    ry   Úget_backendÚBaseModel.get_backend   s   € ð �|‰|Ðó    c                ó$   • [        U S   SS/5      $ )zmReturn the list of modalities supported by this model, e.g. ``["text"]`` or ``["text", "image", "message"]``.r   Ú
modalitiesÚtext©Úgetattrr“   s    ry   r˜   ÚBaseModel.modalities(  s   € ô �t˜A‘w ¨v¨hÓ7Ð7r–   c                óŒ   ^• U R                   mUT;   a  g[        U[        5      (       a  ST;   a  [        U4S jU 5       5      $ g)a[  Check if the model supports the given modality.

A modality is supported if:

1. It is directly listed in :attr:`modalities` (including tuple modalities that
   are explicitly listed), or
2. It is a tuple of modalities (e.g. ``("image", "text")``) where each part is
   individually supported and the model also supports ``"message"`` format, which
   is used to combine multiple modalities into a single input.

Args:
    modality: A single modality string (e.g. ``"text"``, ``"image"``) or a tuple
        of modality strings (e.g. ``("image", "text")``).

Returns:
    bool: Whether the model supports the given modality.

Example::

    >>> from sentence_transformers import SentenceTransformer
    >>> model = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2")
    >>> model.supports("text")
    True
    >>> model.supports("image")
    False
TÚmessagec              3  ó,   >#   • U  H	  oT;   v •  M     g 7f©N© )Ú.0ÚpartÚ	supporteds     €ry   Ú	<genexpr>Ú%BaseModel.supports.<locals>.<genexpr>L  s   øé € Ð>²X¨T˜yÖ(²Xùs   ƒF)r˜   rb   ÚtupleÚall)rr   Úmodalityr¤   s     @ry   ÚsupportsÚBaseModel.supports-  sA   ø€ ð6 —O‘Oˆ	Ø�yÓ ØÜ�h¤×&Ñ&¨9¸	Ó+AÜÔ>±XÓ>Ó>Ð>Ør–   c                ó2  • [        U R                  5       5      n[        5       nU(       aã  UR                  5       u  p4[	        U[
        5      (       aI  UR                  R                  5        H+  nUR                  [        UR                  5       5      5        M-     U R                  (       a-  X0R                  ;   a  UR                  U R                  U   5        [        US5      (       a  UR                  UR                  5        U(       a  Mã  [        U5      $ )ae  
Get the keyword arguments specific to this model for inference methods like `encode` or `predict`.

Example:

    >>> from sentence_transformers import SentenceTransformer, SparseEncoder
    >>> SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2").get_model_kwargs()
    []
    >>> SentenceTransformer("jinaai/jina-embeddings-v4", trust_remote_code=True).get_model_kwargs()
    ['task', 'truncate_dim']
    >>> SparseEncoder("opensearch-project/opensearch-neural-sparse-encoding-doc-v3-distill").get_model_kwargs()
    ['task']

Returns:
    list[str]: A list of keyword arguments for the forward pass.
Úforward_kwargs)rl   Únamed_childrenÚsetÚpoprb   r    Úsub_modulesÚvaluesÚextendrM   rK   Úhasattrr­   )rr   r3   r­   Úmodule_namerv   Úroute_moduless         ry   Úget_model_kwargsÚBaseModel.get_model_kwargsO  sÓ   € ô" �t×*Ñ*Ó,Ó-ˆÜ›ˆÞØ")§+¡+£-ÑˆKÜ˜&¤&×)Ñ)Ø%+×%7Ñ%7×%>Ñ%>Ö%@�MØ—N‘N¤4¨×(DÑ(DÓ(FÓ#GÖHñ &Aà×!×! k×5GÑ5GÓ&GØ×%Ñ% d×&8Ñ&8¸Ñ&EÔFÜ�vÐ/×0Ñ0Ø×%Ñ% f×&;Ñ&;Ô<÷ ˆgô �NÓ#Ð#r–   c                ó   • U R                   $ )a'  
.. deprecated::
    Use the :attr:`max_seq_length` property instead.

Returns the maximal sequence length that the first module of the model accepts.
Longer inputs will be truncated.

Returns:
    Optional[int]: The maximal sequence length that the model accepts, or None if it is not defined.
©Úmax_seq_lengthr“   s    ry   Úget_max_seq_lengthÚBaseModel.get_max_seq_lengthm  s   € ð ×"Ñ"Ð"r–   c                óX   • U R                   [        [        U R                   5      5         $ )z4Returns the first module of this sequential embedder)Ú_modulesri   Úiterr“   s    ry   Ú_first_moduleÚBaseModel._first_modulez  s   € à�}‰}œT¤$ t§}¡}Ó"5Ó6Ñ7Ð7r–   c                óX   • U R                   [        [        U R                   5      5         $ )z3Returns the last module of this sequential embedder)r¿   ri   Úreversedr“   s    ry   Ú_last_moduleÚBaseModel._last_module~  s   € à�}‰}œT¤(¨4¯=©=Ó"9Ó:Ñ;Ð;r–   c                ó|  • U S   n[        U[        5      (       a  UR                  $ [        U[        5      (       a�  UR                  R                  5        HN  n[        [        UR                  5       5      S5      n[        U[        5      (       a  UR                  (       a  MN    g   [        UR                  5      $ g)zùCheck if the first module (Transformer or Router containing Transformers) supports flattened text-only inputs.

For Router models, this returns True only if ALL routes support flattening, since we cannot
know at this point which route will be used.
r   NF)
rb   r!   Úcan_flatten_inputsr    r±   r²   ri   rÀ   rm   Úbool)rr   Úinput_moduleÚrouteÚfirst_in_routes       ry   Ú_can_flatten_inputsÚBaseModel._can_flatten_inputs‚  s•   € ð ˜A‘wˆÜ�l¤K×0Ñ0Ø×2Ñ2Ð2Ü�l¤F×+Ñ+Ø%×1Ñ1×8Ñ8Ö:�ä!%¤d¨5¯>©>Ó+;Ó&<¸dÓ!C�Ü! .´+×>Ñ>Àn×Fg×FgÑFgÙ ñ	 ;ô
 ˜×0Ñ0Ó1Ð1Ør–   c                ó¦   • [        U 5      n[        R                  " XR                  S9nU SUS-   S-   USSS2'   XS-
  US-
  S-  S2   USSS2'   U$ )a  Interleave a largest-to-smallest sorted index array so that each consecutive batch
contains a mix of long and short inputs.

When text-only inputs are flattened via flash attention, there is no padding. Total tokens per
batch equals the sum of actual lengths. Grouping all long inputs together creates peak-memory
batches, while grouping all short inputs together under-utilises the GPU. Interleaving
(largest, smallest, 2nd largest, 2nd smallest, ...) balances the total token count
across batches for more uniform memory usage.
)rk   NrH   é   r   éÿÿÿÿ)rd   ÚnpÚemptyrk   )Ú
sorted_idxrˆ   Úinterleaveds      ry   Ú_interleave_sorted_indicesÚ$BaseModel._interleave_sorted_indices”  sl   € ô �
‹OˆÜ—h’h˜q×(8Ñ(8Ñ9ˆØ& ~¨!¨a©%°A©Ð6ˆ�A�D�q�DÑØ&¨1¡u°°A±¸!©|¸bÐ'@ÑAˆ�A�D�q�DÑØÐr–   c                ó(  • [        U [        5      (       a  [        U 5      $ [        U [        [        45      (       a:  U (       a3  [        U S   [
        5      (       a	  SU S   ;   d  [        S U  5       5      $ [        U [
        5      (       a‘  SU ;   a  [        R                  U S   5      $ SU ;   aM  U S   n[        U[        5      (       a  [        U5      $ [        U[        5      (       a  [        S U 5       5      $ g[        S U R                  5        5       5      $ [        U [        5      (       a1  U (       a*  [        U S   [
        5      (       a  [        S	 U  5       5      $ [        U [        R                  [        R                  45      (       a;  [        U [        R                  5      (       a  U R                  5       $ U R                  $  SS
KJn  [        X5      (       a  U R                  S   U R                  S   -  $  g! [$         a     gf = f)zÖEstimate the "size" of an input sample for length-based batch sorting.

The exact value doesn't matter, it's only used to group similarly sized
inputs together so that padding waste is minimised within each batch.
r   Úrolec              3  óL   #   • U  H  n[         R                  U5      v •  M     g 7fr    ©r*   Ú_input_length)r¢   r   s     ry   r¥   Ú*BaseModel._input_length.<locals>.<genexpr>´  s   é € ÐFºv¸!œ9×2Ñ2°1×5Ð5ºvùó   ‚"$ÚarrayÚcontentc           	   3  ó˜   #   • U  H@  n[        U[        5      (       d  M  [        [        UR	                  S S5      5      5      v •  MB     g7f)r™   r|   N)rb   rJ   rd   r0   rŒ   )r¢   Úitems     ry   r¥   rÝ   ¿  s7   é € ÐlÊ'À$ÔU_Ð`dÔfj×UkÓ=œs¤3 t§x¡x°¸Ó';Ó#<×=Ð=Ê'ùs
   ‚A
Ÿ+A
rH   c              3  óL   #   • U  H  n[         R                  U5      v •  M     g 7fr    rÛ   )r¢   r†   s     ry   r¥   rÝ   Â  s   é € ÐKº?°a”y×.Ñ.¨q×1Ð1º?ùrÞ   c              3  óL   #   • U  H  n[         R                  U5      v •  M     g 7fr    rÛ   )r¢   Úmsgs     ry   r¥   rÝ   Æ  s   é € ÐFºv¸”y×.Ñ.¨s×3Ð3ºvùrÞ   )ÚImage)rb   r0   rd   r§   rl   rJ   Úsumr*   rÜ   r²   rÒ   Úndarrayr2   r   ÚnelementÚsizeÚ	PIL.Imageræ   ÚImportError)Úsamplerà   ÚPILImages      ry   rÜ   ÚBaseModel._input_length¥  s®  € ô �fœc×"Ñ"Ü�v“;Ðô �fœu¤d˜m×,Ñ,Þœz¨&°©)´T×:Ñ:¸vÈÐPQÉÓ?RÜÑF¹vÓFÓFÐFô �fœd×#Ñ#Ø˜&Ó Ü ×.Ñ.¨v°g©Ó?Ð?Ø˜FÓ"Ø  Ñ+�Ü˜g¤s×+Ñ+Ü˜w›<Ð'Ü˜g¤t×,Ñ,ÜÑlÉ'ÓlÓlÐlØäÑK¸6¿=¹=¼?ÓKÓKÐKô �fœd×#Ñ#®´:¸fÀQ¹iÌ×3NÑ3NÜÑF¹vÓFÓFÐFô �fœrŸz™z¬5¯<©<Ð8×9Ñ9Ü(2°6¼5¿<¹<×(HÑ(H�6—?‘?Ó$ÐYÈfÏkÉkÐYð	Ý3ä˜&×+Ñ+Ø—{‘{ 1‘~¨¯©°A©Ñ6Ð6ð ,ð
 øô ó 	Øàð	ús   Ç4H È
HÈHc           	     óz  • U R                  5        H   u  p40 n[        U[        5      (       a  UnOx/ nU R                  b  U R                  R	                  U/ 5      nUR                  5        VVs0 s H0  u  pxXv;   d$  [        US5      (       d  M  XtR                  ;   d  M.  Xx_M2     nnnU" U40 UD6nM¢     U$ s  snnf )z.Forward pass through all modules in the model.r­   )r®   rb   r    rM   rŒ   r€   r´   r­   )	rr   ÚinputÚkwargsrµ   rv   rM   Úmodule_kwarg_keysrƒ   r„   s	            ry   ÚforwardÚBaseModel.forward×  sÆ   € à#'×#6Ñ#6Ö#8ÑˆKØˆMÜ˜&¤&×)Ñ)Ø &‘à$&Ð!Ø×%Ñ%Ñ1Ø(,×(:Ñ(:×(>Ñ(>¸{ÈBÓ(OÐ%ð '-§l¡l¤nô!â&4™
˜ØÓ/´G¸FÐDT×4Uó àZ]×avÑavÑZvó �C’JÙ&4ð ñ !ñ
 ˜5Ñ2 MÑ2ŠEñ $9ð ˆùó!s   Á.B7ÂB7ÂB7c                ó  ^ • U(       d  0 $ Sn [        UT R                  S9nUb±  T R	                  U5      (       d›  SR                  S T R                   5       5      nS[        U5       S[        T 5      R                   SU 3n[        U[        5      (       a2  [        U 4S jU 5       5      (       a  US	S
R                  U5       S3-  n[        U5      e T S   R                  " U4SU0UD6nU$ ! [        [        4 a     Náf = f! [         ad    U(       aC  US:X  a=  U Vs/ s H*  n[        U[        5      (       a  X(S   -   4USS -   OX(-   PM,     Os  snf nnT S   R                  " U40 UD6n U$ [         a‹    U(       aC  US:X  a=  U Vs/ s H*  n[        U[        5      (       a  X(S   -   4USS -   OX(-   PM,     Os  snf nn T S   R                  " U40 UD6n U$ ! [         a    T S   R                  U5      n  U$ f = ff = f)a–  
Preprocesses the inputs for the model.

Args:
    inputs (list[SingleInput | PairInput]): A list of inputs to be preprocessed. Each input can be a
        string, dict, tuple, PIL Image, numpy array, torch Tensor, or other supported modality.
        If a single input is provided, it must be wrapped in a list.
    prompt (str, optional): A prompt string to prepend to text inputs. Defaults to None.
        If the model supports the ``message`` modality, the prompt will be added as a system message to the
        input messages instead of being prepended to text.

Returns:
    dict[str, Tensor | Any]: A dictionary of tensors with the preprocessed inputs.
N)Úsupported_modalitiesú, c              3  ó8   #   • U  H  n[        U5      v •  M     g 7fr    )r   )r¢   Úms     ry   r¥   Ú'BaseModel.preprocess.<locals>.<genexpr>
  s   é € Ð!Nºo¸¤/°!×"4Ð"4ºoùs   ‚z
Modality 'z' is not supported by this z model. Supported modalities: c              3  ó@   >#   • U  H  oTR                   ;   v •  M     g 7fr    )r˜   )r¢   r£   rr   s     €ry   r¥   rû     s   øé € Ð2`ÒW_Èt¸4¿?¹?Ö3JÒW_ùs   ƒz
This model supports z and zR individually, but not in the same input. Please process each modality separately.r   rŽ   r™   rH   )r   r˜   re   Ú	TypeErrorrª   Újoinr   rf   rQ   rb   r§   r¨   Ú
preprocessÚAttributeErrorÚtokenize)	rr   ÚinputsrŽ   rò   r©   r¤   rž   ÚpreprocessedÚinps	   `        ry   rÿ   ÚBaseModel.preprocessé  sO  ø€ ö( ØˆIð
 ˆð	Ü+¨FÈÏÉÑYˆHð Ñ¨¯©°h×(?Ñ(?ØŸ	™	Ñ!N¸d¿oºoÓ!NÓNˆIàœ_¨XÓ6Ð7Ð7RÔSWÐX\ÓS]×SfÑSfÐRgð h)Ø)2¨ð5ð ô ˜(¤E×*Ñ*¬sÔ2`ÑW_Ó2`×/`Ñ/`ØØ,¨W¯\©\¸(Ó-CÐ,Dð EZð Zñ�ô ˜WÓ%Ð%ð
	8Ø ™7×-Ò-¨fÑN¸VÐNÀvÑNˆLð ÐøôC œIÐ&ó 	Ùð	ûô* ó 	@Þ˜( fÓ,ÙntÓuÒntÐgj¼*ÀSÌ%×:PÑ:P˜6¨¡F™?Ð,¨s°1°2¨wÒ6ÐV\ÑVbÒbÒntùÒu�ÐuØ ™7×-Ò-¨fÑ?¸Ñ?‰Lð Ðô ó 	8Þ˜( fÓ,ÙntÓuÒntÐgj¼*ÀSÌ%×:PÑ:P˜6¨¡F™?Ð,¨s°1°2¨wÒ6ÐV\ÑVbÒbÒntùÒu�Ðuð8Ø# A™w×/Ò/°ÑA¸&ÑA‘ð Ðøô ó 8Ø# A™w×/Ñ/°Ó7’àÐð8úð	8úsY   ŽC1 ÃD Ã1DÄDÄHÄ"1EÅHÅ4HÆ1G Æ?HÇG!Ç!HÇ?HÈHÈHc                óT   • [         R                  S5        U R                  " SSU0UD6$ )zI
.. deprecated::
    `tokenize` is deprecated. Use `preprocess` instead.
zEThe `tokenize` method is deprecated, please use `preprocess` instead.r  r¡   )rU   r‚   rÿ   )rr   Útextsrò   s      ry   r  ÚBaseModel.tokenize)  s*   € ô 	×ÑÐcÔdØ�ŠÑ6 eÐ6¨vÑ6Ð6r–   c                ó(  • [         [        4n[        5       (       a   SSKJn  X#4-  n[        X5      (       a  g[        U[        R                  5      (       a+  UR                  S:¼  a  UR                  R                  S;   a  gg! [
         a     Nhf = f)zÁ
Check if the input represents a single example or a batch of examples.

Args:
    inputs: The input to check.
Returns:
    bool: True if the input is a single example, False if it is a batch.
r   )ÚColumnFrH   )ÚUÚOT)rl   r§   r   Údatasetsr
  rì   rb   rÒ   rè   Úndimrk   Úkind)rr   r  Ú
list_typesr
  s       ry   Úis_singular_inputÚBaseModel.is_singular_input2  s€   € ô œE�]ˆ
Ü ×"Ñ"ðÝ+à˜iÑ'�
ô �f×)Ñ)Øä�fœbŸj™j×)Ñ)¨f¯k©k¸QÓ.>À6Ç<Á<×CTÑCTÐXbÓCbØØøô ó Ùðús   �B Â
BÂBc                ó"  • Uc  g[         R                  " USS9  [        R                  SU 35        / nU R	                  5       n[        [         R                  R                  US5      SSS9 n[        R                  " XxS	SS
9  SSS5        [        U R                  5       GHD  u  pšU R                  U
   nU	S:X  aC  [        US5      (       a2  UR                  (       a!  [         R                  R                  US5      nOB[         R                  R                  U[        U	5      S-   [        U5      R                   -   5      n[         R                  " USS9   UR#                  XÅS9  [        U5      R&                  nUR)                  S5      (       aË  [*        R,                  U   R.                  n[1        U5      [1        U5      R2                  -  n[4        R6                  " Xï5        [9        U5       H;  n[1        U5      [1        U5      R2                  -  n[4        R6                  " UU5        M=     UR;                  S5      S    S[        U5      R                    3nOU S[        U5      R                    3nXš[         R                  R=                  U5      US.nU R>                  (       a*  X R>                  ;   a  U R>                  U
   =n(       a  UUS'   URA                  U5        GMG     [        [         R                  R                  US5      SSS9 n[        R                  " XhS	S9  SSS5        U(       a  U RC                  XU5        gg! , (       d  f       GNÏ= f! [$         a    UR#                  U5         GNf = f! , (       d  f       N]= f)áO  
Saves a model and its configuration files to a directory, so that it can be loaded again.

Args:
    path (str): Path on disk where the model will be saved.
    model_name (str, optional): Optional model name.
    create_model_card (bool, optional): If True, create a README.md with basic information about this model.
    train_datasets (List[str], optional): Optional list with the names of the datasets used to train the model.
    safe_serialization (bool, optional): If True, save the model using safetensors. If False, save the model
        the traditional (but unsafe) PyTorch way.
NT©Úexist_okzSaving model to ú!config_sentence_transformers.jsonÚwÚutf8©ÚencodingrÐ   )ÚindentÚ	sort_keysr   Úsave_in_rootr|   Ú_)Úsafe_serializationztransformers_modules.r~   rÑ   )ru   Únamer[   rf   rò   úmodules.json)r  )"rS   ÚmakedirsrU   rV   Ú_get_model_configÚopenr[   rþ   ÚjsonÚdumprc   r¿   r´   r  r0   rf   rQ   Úsaverý   Ú
__module__Ú
startswithÚsysr3   Ú__file__r   r!  ÚshutilÚcopyr   ÚsplitÚbasenamerM   ÚappendÚ_create_model_card)rr   r[   Ú
model_nameÚcreate_model_cardÚtrain_datasetsr   Úmodules_configÚconfigÚfOutru   r!  rv   Ú
model_pathÚ	class_refÚ
class_fileÚ	dest_fileÚneeded_fileÚmodule_configrM   s                      ry   r(  ÚBaseModel.saveJ  sÙ  € ð& ‰<Øä
�Š�D 4Ò(ä�‰Ð& t fÐ-Ô.Øˆð ×'Ñ'Ó)ˆÜ”"—'‘'—,‘,˜tÐ%HÓIÈ3ÐY_Ò`ÐdhÜ�IŠI�f¨1¸Ò=÷ aô # 4§=¡=×1‰IˆCØ!Ÿ]™]¨4Ñ0ˆFà�q“œW V¨^×<Ñ<À×AT×ATäŸW™WŸ\™\¨$°Ó3‘
äŸW™WŸ\™\¨$´°C³¸3±ÄÀfÃ×AVÑAVÑ0VÓW�
ä�KŠK˜
¨TÒ2ð(Ø—‘˜J�ÑNô ˜V›×/Ñ/ˆIà×#Ñ#Ð$;×<Ñ<Ü Ÿ[™[¨Ñ3×<Ñ<�
ô ! Ó,´°ZÓ0@×0EÑ0EÑF�	Ü—’˜JÔ2ô $=¸ZÖ#H�KÜ $ ZÓ 0´D¸Ó4E×4JÑ4JÑ K�IÜ—K’K ¨YÖ7ñ $Ið  )Ÿ™¨sÓ3°BÑ7Ð8¸¼$¸v»,×:OÑ:OÐ9PÐQ‘	à(˜k¨¬4°«<×+@Ñ+@Ð*AÐB�	à$'¼r¿w¹w×?OÑ?OÐPZÓ?[ÐenÑoˆMØ×!×! d×.@Ñ.@Ó&@ÐW[×WiÑWiÐjnÑWoÐFoÀmÕFoØ*7�˜hÑ'Ø×!Ñ! -×0ñO 2ôR ”"—'‘'—,‘,˜t ^Ó4°cÀFÒKÈtÜ�IŠI�n°1Ò5÷ Lö Ø×#Ñ# D°nÕEð ÷a aÖ`ûô" ó (Ø—‘˜J×'ð(ú÷8 LÕKús*   Á-MÅMÌN Í
MÍM=Í<M=Î 
Nc                ó”   • U R                   [        [        R                  [        R                  S.U R                  U R
                  S.$ )N)Úsentence_transformersÚtransformersÚpytorch)rR   r   r5   r6   )rR   r   rB  r2   r5   r6   r“   s    ry   r$  ÚBaseModel._get_model_configš  s?   € àŸ/™/ä)4Ü ,× 8Ñ 8Ü ×,Ñ,ñð
 —|‘|Ø#'×#;Ñ#;ñ	
ð 		
r–   c                ó*   • U R                  UUUUUS9  g)r  ©r3  r4  r5  r   N)r(  )rr   r[   r3  r4  r5  r   s         ry   Úsave_pretrainedÚBaseModel.save_pretrained¦  s$   € ð& 	�	‰	ØØ!Ø/Ø)Ø1ð 	ò 	
r–   c                ó  • U R                   R                  (       af  UR                  SU R                  R                   SU R
                   S3SU R                  R                   SU R                   R                   S35      nU$ )z.Update the default model ID in the model card.zmodel = z("Ú")r?   Úmodel_idÚreplacerP   rQ   r1   )rr   Ú
model_cards     ry   Ú_update_default_model_idÚ"BaseModel._update_default_model_idÁ  sy   € à×Ñ×(×(Ø#×+Ñ+Ø˜4Ÿ>™>×2Ñ2Ð3°2°d×6[Ñ6[Ð5\Ð\]Ð^Ø˜4Ÿ>™>×2Ñ2Ð3°2°d×6JÑ6J×6SÑ6SÐ5TÐTUÐVóˆJð Ðr–   c                ó’  • U(       aK  [        U5      nUR                  5       (       d+  U R                  R                  (       d  X R                  l        XR                  l        U R
                  (       a8  SU R                  R                  ;  a  U R
                  nU R                  U5      nO [        U 5      n[        [        R                   R#                  US5      SSS9 nUR%                  U5        SSS5        g! [         a/    [        R                  S[        R                  " 5        S35         gf = f! , (       d  f       g= f)	aA  
Create an automatic model card and store it in the specified path.

Args:
    path (str): The path where the model card will be stored.
    model_name (Optional[str], optional): The name of the model. Defaults to None.
    train_datasets (Optional[List[str]], optional): Deprecated argument, ignored.

Returns:
    None
Úgenerated_from_trainerz#Error while generating model card:
z‹Consider opening an issue on https://github.com/huggingface/sentence-transformers/issues with this traceback.
Skipping model card creation.Nú	README.mdr  r  r  )r   r\   r?   rK  Úsave_dirrO   ÚtagsrN  r   Ú	ExceptionrU   ÚerrorÚ	tracebackÚ
format_excr%  rS   r[   rþ   Úwrite)rr   r[   r3  r5  r9  rM  r8  s          ry   r2  ÚBaseModel._create_model_cardÊ  s  € ö Ü˜jÓ)ˆJØ×$Ñ$×&Ñ&¨t×/CÑ/C×/L×/LØ0:×$Ñ$Ô-ð )-×ÑÔ%ð × × Ð%=ÀT×EYÑEY×E^ÑE^Ó%^Ø×.Ñ.ˆJØ×6Ñ6°zÓB‰JðÜ0°Ó6�
ô ”"—'‘'—,‘,˜t [Ó1°3ÀÒHÈDØ�J‰J�zÔ"÷ IÐHøô ó Ü—‘Ø:¼9×;OÒ;OÓ;QÐ:Rð4ð4ôñ
 ðú÷ IÕHús   Â-C< Ã!D8Ã<6D5Ä4D5Ä8
Ec                ó4  • [         R                  S5        U(       af  SU;  a$  [         R                  SU SU S35        U SU 3nO<UR                  S5      S   U:w  a  [        S5      e[         R                  SU S35        U R	                  UUUUUUUU	U
S9	$ )aá  
DEPRECATED, use `push_to_hub` instead.

Uploads all elements of this model to a new HuggingFace Hub repository.

Args:
    repo_id (str): Repository name for your model in the Hub, including the user or organization.
    token (str, optional): An authentication token (See https://huggingface.co/settings/token)
    private (bool, optional): Set to true, for hosting a private model
    safe_serialization (bool, optional): If true, save the model using safetensors. If false, save the model the traditional PyTorch way
    commit_message (str, optional): Message to commit while pushing.
    local_model_path (str, optional): Path of the model locally. If set, this file path will be uploaded. Otherwise, the current model will be uploaded
    exist_ok (bool, optional): If true, saving to an existing repository is OK. If false, saving only to a new repository is possible
    replace_model_card (bool, optional): If true, replace an existing model card in the hub with the automatically created model card
    train_datasets (List[str], optional): Datasets used to train the model. If set, the datasets will be added to the model card in the Hub.

Returns:
    str: The url of the commit of your model in the repository on the Hugging Face Hub.
z¢The `save_to_hub` method is deprecated and will be removed in a future version of SentenceTransformers. Please use `push_to_hub` instead for future model uploads.rG   zQProviding an `organization` to `save_to_hub` is deprecated. Please use `repo_id="z"` instead.r   zYProviding an `organization` to `save_to_hub` is deprecated. Please use `repo_id` instead.)	Úrepo_idr;   Úprivater   Úcommit_messageÚlocal_model_pathr  Úreplace_model_cardr5  )rU   r�   r/  re   Úpush_to_hub)rr   r\  Úorganizationr;   r]  r   r^  r_  r  r`  r5  s              ry   Úsave_to_hubÚBaseModel.save_to_hubó  sÙ   € ôB 	�‰ðJô	
ö
 Ø˜'Ó!Ü—‘ØgÐhtÐguÐuvÐw~Ðvð  @Kð  Lôð *˜N¨!¨G¨9Ð5‘Ø—‘˜sÓ# AÑ&¨,Ó6Ü Øoóð ô —‘ØgÐhoÐgpÐp{Ð|ôð ×ÑØØØØ1Ø)Ø-ØØ1Ø)ð  ð 

ð 
	
r–   c           
     óŒ  • [        US9nUR                  UUSU=(       d    US9nUR                  nU R                  R	                  U5        U
b  UR                  XSS9  UcN  U R                  5       nUS:X  a  SU R                  R                   S3nOSU R                  R                   S	U S
3nSnU(       a.  SU R                  R                   SU  SU R                  U5       3nU(       a  UR                  UUUU(       a  UOSUU
S9nOh[        R                  " 5        nU(       a  SnO[        USX*SS9nUSL nU R                  UUUU	US9  UR                  UUUU(       a  UOSUU
S9nSSS5        U(       a.  [        R!                  SWR"                   35        UR"                  $ WR$                  $ ! , (       d  f       NO= f)aê  
Uploads all elements of this model to a HuggingFace Hub repository, creating it if it doesn't exist.

Args:
    repo_id (str): Repository name for your model in the Hub, including the user or organization.
    token (str, optional): An authentication token (See https://huggingface.co/settings/token)
    private (bool, optional): Set to true, for hosting a private model
    safe_serialization (bool, optional): If true, save the model using safetensors. If false, save the model the traditional PyTorch way
    commit_message (str, optional): Message to commit while pushing.
    local_model_path (str, optional): Path of the model locally. If set, this file path will be uploaded. Otherwise, the current model will be uploaded
    exist_ok (bool, optional): If true, saving to an existing repository is OK. If false, saving only to a new repository is possible
    replace_model_card (bool, optional): If true, replace an existing model card in the hub with the
        automatically created model card. If false (default), keep the existing model card if one exists
        in the repository.
    train_datasets (List[str], optional): Datasets used to train the model. If set, the datasets will be added to the model card in the Hub.
    revision (str, optional): Branch to push the uploaded files to
    create_pr (bool, optional): If True, create a pull request instead of pushing directly to the main branch

Returns:
    str: The url of the commit of your model in the repository on the Hugging Face Hub.
)r;   N)r\  r]  Ú	repo_typer  T)r\  Úbranchr  r2   zAdd new z modelz model with an z backendr|   zBHello!

This pull request has been automatically generated to add z1 compatibility.

## Full Model Architecture:
```
z
```

)r\  Úfolder_pathr^  Úcommit_descriptionÚ	create_prr9   rR  F)r;   r9   r:   rF  z#A pull request has been created at )r   Úcreate_repor\  r?   Úset_model_idÚcreate_branchr”   rP   rQ   Ú_push_to_hub_usage_tipÚupload_folderÚtempfileÚTemporaryDirectoryr&   r(  rU   rV   Úpr_urlÚ
commit_url)rr   r\  r;   r]  r   r^  r_  r  r`  r5  r9   rj  ÚapiÚrepo_urlr@   ri  Ú
folder_urlÚtmp_dirÚcreate_model_card_for_pathÚexisting_readmes                       ry   ra  ÚBaseModel.push_to_hub4  s  € ôF ˜%Ñ ˆØ—?‘?ØØØØ×* ð	 #ð 
ˆð ×"Ñ"ˆØ×Ñ×)Ñ)¨'Ô2ØÑØ×Ñ gÈÐÑNàÑ!Ø×&Ñ&Ó(ˆGØ˜'Ó!Ø#+¨D¯N©N×,CÑ,CÐ+DÀFÐ!K‘à#+¨D¯N©N×,CÑ,CÐ+DÀOÐT[ÐS\Ð\dÐ!e�àÐÞð&;ð <@¿>¹>×;RÑ;RÐ:Sð Tð €ð ð ×Ñ˜WÓ%Ð &ð
"*Ðö Ø×*Ñ*ØØ,Ø-Þ9BÑ#5ÈØ#Ø!ð +ð ‰Jô ×,Ò,Ô.°'Þ%Ø15Ñ.ô '5Ø °EÐ_dñ'�Oð 2AÀDÐ1HÐ.Ø—	‘	ØØ&Ø&@Ø#1Ø'9ð ñ ð !×.Ñ.Ø#Ø 'Ø#1Þ=FÑ'9ÈDØ'Ø%ð /ð �
÷! /ö2 Ü�K‰KÐ=¸j×>OÑ>OÐ=PÐQÔRØ×$Ñ$Ð$à×$Ñ$Ð$÷; /Õ.ús   Ä!AF5Æ5
Gc
           	     óâ  • UUUUUUUU	S.n
[        USUUUUS9nUc9  [        R                  SU SU R                   S35        U R                  " U40 U
D6$ U R                  UUUUUS9nXÀR                  :X  a9  [        R                  SU R                   SU S	35        U R                  " U40 U
D6$ [        R                  S
U SU SU R                   S	35        U R                  " U40 U
DSU0D6$ )NrI   r"  ©r;   r7   r9   r:   zNo modules.json found for z, initializing a new z model.zLoading z model from r~   zConverting z model z to rR   )r&   rU   rV   rR   Ú_load_default_modulesÚ_get_model_typeÚ_load_config_modulesÚ_load_converted_modules)rr   rs   r;   r7   r9   r8   r:   r<   r=   r>   Úload_kwargsÚmodules_json_pathÚmodel_type_being_loadeds                ry   ra   ÚBaseModel._load_modules¡  s@  € ð Ø(Ø Ø!2Ø 0Ø(Ø 0Ø*ñ	
ˆô +ØØØØ%ØØ-ñ
Ðð Ñ$Ü�K‰KÐ4Ð5GÐ4HÐH]Ð^b×^mÑ^mÐ]nÐnuÐvÔwØ×-Ò-Ð.@ÑPÀKÑPÐPà"&×"6Ñ"6ØØØ%ØØ-ð #7ð #
Ðð #§o¡oÓ5Ü�K‰K˜( 4§?¡?Ð"3°<Ð@RÐ?SÐSTÐUÔVØ×,Ò,Ð-?ÑOÀ;ÑOÐOä�‰�kÐ"9Ð!:¸'ÐBTÐAUÐUYÐZ^×ZiÑZiÐYjÐjkÐlÔmØ×+Ò+Ð,>ÑrÀ+ÑrÐZqÒrÐrr–   c
                ó   • g)a´  

Args:
    model_name_or_path (str): The name or path of the pre-trained model.
    token (Optional[Union[bool, str]]): The token to use for the model.
    cache_folder (Optional[str]): The folder to cache the model.
    revision (Optional[str], optional): The revision of the model. Defaults to None.
    trust_remote_code (bool, optional): Whether to trust remote code. Defaults to False.
    local_files_only (bool, optional): Whether to use only local files. Defaults to False.
    model_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the model. Defaults to None.
    processor_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the processor/tokenizer. Defaults to None.
    config_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the config. Defaults to None.

Returns:
    List[nn.Module]: A list containing the transformer model and the pooling model.
Nr¡   )
rr   rs   r;   r7   r9   r8   r:   r<   r=   r>   s
             ry   r}  ÚBaseModel._load_default_modulesÓ  s   � r–   c
                ó¨  • [        USUUUUS9n
U
b§  [        U
SS9 n[        R                  " U5      nSSS5        SW;   ag  SUS   ;   a^  [        R
                  " US   S   5      [        R
                  " [        5      :”  a&  [        R                  SUS   S    S	[         S
35        U R                  U5        [        USUUUUS9nUb)   [        USS9 nUR                  5       U l        SSS5        [        USUUUUS9n[        USS9 n[        R                  " U5      nSSS5        [        5       n[        5       nW GH½  nUS   nU R                  UXXG5      n[        R                   " UR                  5      n[#        UR$                  5      S:X  Ga!  [        R                   " UR&                  5      n[)        UR$                  5      n1 SkU-  nSS1U:*  nU(       d  U(       a­  [*        R,                  " UUS   UUUUUUUU	U R.                  S9nSSSS.nU(       a=  U(       d6  UR1                  5        H"  u  nnUU;   d  M  UR3                  U5      UU'   M$     SS1nU H$  nUU;   d  M  UU;  d  M  UR3                  U5        M&     U" U40 UD6nOI[5        UUS   UUUUS9n UR                  U 5      nO&UR                  UUS   UUUUUUUU	U R.                  S9nUUUS   '   UR7                  S/ 5      UUS   '   GMÀ     Ucd  [9        U5      n![#        U!R:                  5      S:¼  a@  [9        U5      R:                  S   n"[#        U"5      S:X  a  [=        S  U" 5       5      (       a  U"nU(       d  U R>                  RA                  XS!9  UU4$ ! , (       d  f       GNa= f! , (       d  f       GN»= f! [         a     GNËf = f! , (       d  f       GN§= f)"a  
Loads a full model using the modules.json file.

Args:
    model_name_or_path (str): The name or path of the pre-trained model.
    token (Optional[Union[bool, str]]): The token to use for the model.
    cache_folder (Optional[str]): The folder to cache the model.
    revision (Optional[str], optional): The revision of the model. Defaults to None.
    trust_remote_code (bool, optional): Whether to trust remote code. Defaults to False.
    local_files_only (bool, optional): Whether to use only local files. Defaults to False.
    model_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the model. Defaults to None.
    processor_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the processor/tokenizer. Defaults to None.
    config_kwargs (Optional[Dict[str, Any]], optional): Additional keyword arguments for the config. Defaults to None.

Returns:
    Tuple[OrderedDict[str, nn.Module], OrderedDict[str, Any]]: An ordered dictionary containing the modules of the model and their kwargs.
r  r|  Nr  r  r   rA  z:This model was created with Sentence Transformers version z, but you're using version zD. Consider updating to the latest version to avoid potential issues.rR  r"  rf   rH   >   Ú
model_argsÚconfig_argsÚtokenizer_argsr<   r>   r[   )
Ú	subfolderr;   r7   r9   r:   r8   r<   r=   r>   r@   rˆ  rŠ  r‰  )r<   r=   r>   Úmodality_configÚmodule_output_name)rs   r‹  r;   r7   r9   r:   r!  rò   rÐ   éþÿÿÿé(   c              3  ó*   #   • U  H	  oS ;   v •  M     g7f)Ú0123456789abcdefNr¡   )r¢   Úcs     ry   r¥   Ú1BaseModel._load_config_modules.<locals>.<genexpr>¤  s   é € Ð8mÒZlÐUVÐ>PÖ9PÒZlùs   ‚)r9   )!r&   r%  r&  Úloadr   Úparser   rU   r�   Ú_parse_model_configÚreadrO   rU  r   Ú_load_module_class_from_refÚinspectÚ	signaturerd   rj   rh   r¯   r!   Ú_load_init_kwargsr@   r€   r°   r%   rŒ   r   Úpartsr¨   r?   Úset_base_model)#rr   rs   r;   r7   r9   r8   r:   r<   r=   r>   Ú&config_sentence_transformers_json_pathÚfInÚmodel_configÚmodel_card_pathr‚  r6  r3   rM   r>  r:  Úmodule_classÚload_signaturerš  Úinit_paramsÚuses_old_namesÚuses_new_namesÚinit_kwargsÚnew_to_old_name_mappingÚnew_nameÚold_nameÚoptional_paramsrv   Ú
local_pathÚ
path_partsÚrevision_path_parts#                                      ry   r  ÚBaseModel._load_config_modulesñ  s?  € ô< 2@ØØ/ØØ%ØØ-ñ2
Ð.ð 2Ñ=ÜÐ<ÀvÒNÐRUÜ#Ÿyšy¨›~�÷ Oð  Ó-Ø+¨|¸MÑ/JÓJÜ—M’M ,¨}Ñ"=Ð>UÑ"VÓWÔZa×ZgÒZgÔhsÓZtÓtä—‘ØPÐQ]Ð^kÑQlð  nEñ  RFð  QGð G0Ü0;¨}ð  =AðBôð
 ×$Ñ$ \Ô2ô )ØØØØ%ØØ-ñ
ˆð Ñ&ðÜ˜/°FÒ;¸sØ,/¯H©H«J�DÔ)÷ <ô +ØØØØ%ØØ-ñ
Ðô Ð#¨fÒ5¸Ü!ŸYšY s›^ˆN÷ 6ô “-ˆÜ#›ˆÜ+ˆMØ% fÑ-ˆIØ#'×#CÑ#CØÐ-À(ó$ˆLô %×.Ò.¨|×/@Ñ/@ÓAˆNô �>×,Ñ,Ó-°Ô2Ü#×-Ò-¨l×.CÑ.CÓD�	ô " )×"6Ñ"6Ó7�Ú!PÐS^Ñ!^�Ø"0°/Ð!BÀkÑ!Q�Þ!¦^Ü"-×"?Ò"?Ø*à"/°Ñ"7Ø#Ø%1Ø!)Ø)9à*;Ø%1Ø)9Ø&3Ø $§¡ñ#�Kð$ )5Ø,<Ø)6ñ/Ð+ö
 &®nØ2I×2OÑ2OÖ2QÑ.˜H hØ'¨;Õ6Ø8C¿¹ÈÓ8Q ¨HÓ 5ñ 3Rð
 (9Ð:NÐ&O�OÛ$3˜Ø# {Õ2°xÀ{Õ7RØ'ŸO™O¨HÖ5ñ %4ñ *Ð*<ÑLÀÑL‘Fô "/Ø+=Ø"/°Ñ"7Ø#Ø%1Ø!)Ø)9ñ"�Jð *×.Ñ.¨zÓ:‘Fð
 &×*Ñ*Ø&à+¨FÑ3ØØ!-Ø%Ø%5à&7Ø!-Ø%5Ø"/Ø ŸL™Lð +ð �ð  .4ˆG�M &Ñ)Ñ*Ø3@×3DÑ3DÀXÈrÓ3RˆM˜-¨Ñ/Ô0ñs ,ðv ÑÜÐ/Ó0ˆJÜ�:×#Ñ#Ó$¨Ó)Ü%)Ð*;Ó%<×%BÑ%BÀ2Ñ%FÐ"ÜÐ)Ó*¨bÓ0´SÑ8mÑZlÓ8m×5mÑ5mØ1�HÞØ× Ñ ×/Ñ/Ð0BÐ/ÑVØ˜Ð%Ð%÷a OÖNú÷4 <Ö;ûäó Úðú÷ 6Ö5úsG   œNÃ
N1 ÃNÃ+N1 ÄOÎ
NÎ
N.Î)N1 Î.N1 Î1
N?Î>N?Ï
Oc                óþ   • UR                  S0 5      R                  5        H4  u  p#X R                  ;  d  U R                  U   b  M&  X0R                  U'   M6     U R                  c  UR                  SS5      U l        gg)aÊ  Parse model configuration and merge saved prompts/defaults with user-provided values.

User-provided prompts and default_prompt_name take precedence over saved config values.
Saved prompts are only used for keys not already present in ``self.prompts``, or where the
current value is ``None`` (i.e. a default placeholder, not yet filled by the user or config).
Empty string ``""`` is treated as an intentional user-provided value and will not be overwritten.
r5   Nr6   )rŒ   r€   r5   r6   )rr   r   r�   Úprompt_texts       ry   r–  ÚBaseModel._parse_model_configª  su   € ð )5×(8Ñ(8¸ÀBÓ(G×(MÑ(MÖ(OÑ$ˆKØ§,¡,Ó.°$·,±,¸{Ñ2KÓ2SØ,7—‘˜[Ó)ñ )Pð ×#Ñ#Ñ+Ø'3×'7Ñ'7Ð8MÈtÓ'TˆDÕ$ð ,r–   c                ó0   • U R                  UUUUUUUUU	S9	$ )NrI   )r}  )rr   rs   r;   r7   r9   r8   r:   r<   r=   r>   rR   s              ry   r€  Ú!BaseModel._load_converted_modules¹  s7   € ð ×)Ñ)ØØØ%ØØ/Ø-Ø%Ø-Ø'ð *ð 

ð 
	
r–   c           	     óÀ   • [        USUUUUS9nUc  g[        USS9 n[        R                  " U5      nUR	                  SS5      sSSS5        $ ! , (       d  f       g= f)aô  
Retrieves the model_type from the config_sentence_transformers.json file.

This is used to determine whether the model being loaded matches the current class
(e.g., a SentenceTransformer model loaded with SentenceTransformer, or a SparseEncoder model
loaded with SparseEncoder). When the model type doesn't match, we switch to a converted
loading method to ensure compatibility.

Defaults to "SentenceTransformer" if the config file is missing or has no "model_type" key,
for backwards compatibility with older models.

Args:
    model_name_or_path (str): The name or path of the pre-trained model.
    token (Optional[Union[bool, str]]): The token to use for the model.
    cache_folder (Optional[str]): The folder to cache the model.
    revision (Optional[str], optional): The revision of the model. Defaults to None.
    local_files_only (bool, optional): Whether to use only local files. Defaults to False.

Returns:
    str: The model type, e.g. "SentenceTransformer", "SparseEncoder", or "CrossEncoder".
r  r|  NÚSentenceTransformerr  r  rR   )r&   r%  r&  r”  rŒ   )	rr   rs   r;   r7   r9   r:   rž  rŸ  r7  s	            ry   r~  ÚBaseModel._get_model_typeÒ  sc   € ô: 2@ØØ/ØØ%ØØ-ñ2
Ð.ð 2Ñ9Ø(äÐ8À6ÒJÈcÜ—Y’Y˜s“^ˆFà—:‘:˜lÐ,AÓB÷ K×J×Jús   �(AÁ
Ac                ó,  • UR                  S5      (       a  [        U5      $ U(       d$  [        R                  R	                  U5      (       a(  U(       a  UR                  SS5      OSn [        UUUUS9$ [        U5      $ ! [        [        4 a     Nf = f)aw  
Load a module class from a class reference string.

Args:
    class_ref: The class reference string (e.g., "sentence_transformers.sentence_transformer.modules.Pooling")
    model_name_or_path: The model name or path
    trust_remote_code: Whether to trust remote code
    revision: The model revision
    model_kwargs: Additional model kwargs

Returns:
    The module class
zsentence_transformers.Úcode_revisionN)r9   r¹  )	r*  r$   rS   r[   r\   r°   r   ÚOSErrorre   )rr   r:  rs   r8   r9   r<   r¹  s          ry   r˜  Ú%BaseModel._load_module_class_from_ref   s’   € ð. ×ÑÐ 8×9Ñ9Ü% iÓ0Ð0æ¤§¡§¡Ð/A× BÑ BÞGS˜L×,Ñ,¨_¸dÔCÐY]ˆMð	Ü4ØØ&Ø%Ø"/ñ	ð ô " )Ó,Ð,øô	 œZÐ(ó áðús   Á)B  Â BÂBc                óB   • Ub  [         R                  " USS9  U" X5      $ )a  
Evaluate the model based on an evaluator

Args:
    evaluator (BaseEvaluator): The evaluator used to evaluate the model.
    output_path (str, optional): The path where the evaluator can write the results. Defaults to None.

Returns:
    The evaluation results.
Tr  )rS   r#  )rr   Ú	evaluatorÚoutput_paths      ry   ÚevaluateÚBaseModel.evaluate)  s#   € ð Ñ"Ü�KŠK˜¨dÒ3Ù˜Ó+Ð+r–   c                óÊ   • U R                  5        H.  nX Ld  M	  [        US5      (       d  M   UR                  U5        M0     g! [         a    UR                  5          MP  f = f)z,Enable gradient checkpointing for the model.Úgradient_checkpointing_enableN)r3   r´   rÂ  rý   )rr   Úgradient_checkpointing_kwargsrv   s      ry   rÂ  Ú'BaseModel.gradient_checkpointing_enable8  sX   € ð —l‘l–nˆFØÔ!¤g¨fÐ6U×&VÓ&Vð;Ø×8Ñ8Ð9VÖWò %øô !ó ;Ø×8Ñ8×:ð;ús   ®AÁA"Á!A"c                ó:  • U R                   =nb  [        US5      (       a  UR                  $ [        U R                  5      (       aK  [        U S   S5      (       a7  [        U S   R
                  S5      (       a  U S   R
                  R                  $  [        U R                  5       5      R                  $ ! [         aZ    SS jnU R                  US9n [        U5      nUS   R                  s $ ! [         a    [        R                  " S5      s s $ f = ff = f)	z‰
Get torch.device from module, assuming that the whole module has one device.
In case there are no PyTorch parameters, fall back to CPU.
r4   r   Ú
auto_modelc                óª   • U R                   R                  5        VVs/ s H%  u  p[        R                  " U5      (       d  M"  X4PM'     nnnU$ s  snnf r    )Ú__dict__r€   r2   Ú	is_tensor)rv   r…   r†   Útupless       ry   Úfind_tensor_attributesÚ0BaseModel.device.<locals>.find_tensor_attributesS  sB   € Ø-3¯_©_×-BÑ-BÔ-DÔ[Ò-D¡T QÌÏÊÐXY×HZ›&˜1›&Ñ-D�Ñ[Ø�ùó \s   ž!AÁA)Úget_members_fnrH   Úcpu)rv   ú	nn.ModuleÚreturnzlist[tuple[str, Tensor]])Útransformers_modelr´   r4   rd   r¿   rÆ  ri   rj   ÚStopIterationÚ_named_membersr2   )rr   rÑ  rË  ÚgenÚfirst_tuples        ry   r4   ÚBaseModel.deviceB  s   € ð #'×"9Ñ"9Ð9ÐÑFÌ7ÐSeÐgo×KpÑKpØ%×,Ñ,Ð,äˆt�}‰}×Ñ¤'¨$¨q©'°<×"@Ñ"@ÄWÈTÐRSÉW×M_ÑM_Ðai×EjÑEjØ˜‘7×%Ñ%×,Ñ,Ð,ð	+Ü˜Ÿ™Ó)Ó*×1Ñ1Ð1øÜó 	+ôð ×%Ñ%Ð5KÐ%ÐLˆCð+Ü" 3›i�Ø" 1‘~×,Ñ,Ò,øÜ ó +Ü—|’| EÓ*Ô*ð+úð	+ús0   Â"B6 Â6DÃC1Ã.DÃ1 DÄDÄDÄDc           	     ój  • UcÃ  [         R                  R                  5       (       a;  [        [         R                  R	                  5       5       Vs/ s H  nSU 3PM
     nnOe[        5       (       a;  [        [         R                  R	                  5       5       Vs/ s H  nSU 3PM
     nnO[        R                  S5        S/S-  n[        R                  SSR                  [        [        U5      5       35        U R                  S5        U R                  5         [        R                  " S5      nUR!                  5       nUR!                  5       n/ nU HK  nUR#                  U R$                  R&                  XpXE4S	S
9nUR)                  5         UR+                  U5        MM     XEUS.$ s  snf s  snf )aô  
Starts a multi-process pool to infer with several independent processes.

This method is recommended if you want to predict on multiple GPUs or CPUs. It is advised
to start only one process per GPU. This method works together with predict and
stop_multi_process_pool.

Args:
    target_devices (List[str], optional): PyTorch target devices, e.g. ["cuda:0", "cuda:1", ...],
        ["npu:0", "npu:1", ...], or ["cpu", "cpu", "cpu", "cpu"]. If target_devices is None and CUDA/NPU
        is available, then all available CUDA/NPU devices will be used. If target_devices is None and
        CUDA/NPU is not available, then 4 CPU devices will be used.

Returns:
    Dict[str, Any]: A dictionary with the target processes, an input queue, and an output queue.
zcuda:znpu:z1CUDA/NPU is not available. Starting 4 CPU workersrÎ  é   z(Starting multi-process pool on devices: rø   ÚspawnT)ÚtargetÚargsÚdaemon)rñ   ÚoutputÚ	processes)r2   ÚcudaÚis_availableÚrangeÚdevice_countr   ÚnpurU   rV   rþ   Úmapr0   rn   Úshare_memoryÚmpÚget_contextr   ÚProcessrP   Ú_multi_process_workerÚstartr1  )	rr   Útarget_devicesÚiÚctxÚinput_queueÚoutput_queuerÞ  Ú	device_idÚps	            ry   Ústart_multi_process_poolÚ"BaseModel.start_multi_process_pool^  sj  € ð& Ñ!Ü�z‰z×&Ñ&×(Ñ(Ü7<¼U¿Z¹Z×=TÑ=TÓ=VÔ7WÓ!XÒ7W°! E¨!¨£+Ñ7W�Ð!X�Ü'×)Ñ)Ü6;¼E¿I¹I×<RÑ<RÓ<TÔ6UÓ!VÒ6U° D¨¨£*Ñ6U�Ð!V�ä—‘ÐOÔPØ"' ¨1¡�ä�‰Ð>¸t¿y¹yÌÌSÐR`ÓIaÓ?bÐ>cÐdÔeð 	�‰�ŒØ×ÑÔÜ�nŠn˜WÓ%ˆØ—i‘i“kˆØ—y‘y“{ˆØˆ	ã'ˆIØ—‘Ø—~‘~×;Ñ;Ø {ÐAØð ð ˆAð
 �G‰GŒIØ×Ñ˜QÖñ (ð %È9ÑUÐUùò7 "Yùâ!Vs   ÁF+ÂF0c                óà   • U S    H  nUR                  5         M     U S    H#  nUR                  5         UR                  5         M%     U S   R                  5         U S   R                  5         g)z½
Stops all processes started with start_multi_process_pool.

Args:
    pool (Dict[str, object]): A dictionary containing the input queue, output queue, and process list.

Returns:
    None
rÞ  rñ   rÝ  N)Ú	terminaterþ   Úclose)Úpoolrñ  s     ry   Ústop_multi_process_poolÚ!BaseModel.stop_multi_process_pool�  sa   € ð �kÔ"ˆAØ�K‰KŽMñ #ð �kÔ"ˆAØ�F‰FŒHØ�G‰GŽIñ #ð 	ˆW‰×ÑÔØˆX‰×ÑÕr–   c                ó   • [        S5      e)Nú0This method should be implemented in subclasses.©ÚNotImplementedError)rr   rÛ  rò   s      ry   Ú_multi_processÚBaseModel._multi_process¥  s   € Ü!Ð"TÓUÐUr–   c                ó   • [        S5      e)a>  Worker function for multi-process inference. Must be overridden by subclasses.

This is called as the target function in each spawned process by
:meth:`start_multi_process_pool`. Subclasses should implement this to
read from ``input_queue``, run inference on ``target_device``, and write
results to ``results_queue``.
rû  rü  )Útarget_deviceÚmodelrî  Úresults_queues       ry   ré  ÚBaseModel._multi_process_worker¨  s   € ô "Ð"TÓUÐUr–   c                ó    • U S   R                   $ )z:
Property to get the tokenizer that is used by this model
r   )Ú	tokenizerr“   s    ry   r  ÚBaseModel.tokenizer¸  ó   € ð
 �A‰w× Ñ Ð r–   c                ó€   •  XS   l         g! [         a'    [        S[        U S   5      R                   S35      Sef = f)zA
Property to set the tokenizer that should be used by this model
r   zThe first module (z() does not have a 'tokenizer' attribute.N)r  r   rf   rQ   ©rr   r„   s     ry   r  r  ¿  sL   € ð
	Ø %�‰GÕøÜó 	Ü Ø$¤T¨$¨q©'£]×%;Ñ%;Ð$<Ð<dÐeóàðð	ús   ‚	 Œ1=c                ó    • U S   R                   $ )z:
Property to get the processor that is used by this model
r   )Ú	processorr“   s    ry   r  ÚBaseModel.processorË  r  r–   c                ó"   • [        U S   SS5      $ )z³
Returns the maximal input sequence length for the model. Longer inputs will be truncated.

Returns:
    Optional[int]: The maximal input sequence length, or None if not defined.
r   r»   Nrš   r“   s    ry   r»   ÚBaseModel.max_seq_lengthÒ  s   € ô �t˜A‘wÐ 0°$Ó7Ð7r–   c                ó   • XS   l         g)zc
Property to set the maximal input sequence length for the model. Longer inputs will be truncated.
r   Nrº   r
  s     ry   r»   r  Ü  s   € ð
 "'ˆQ‰Õr–   c                óª   • U R                  5        H?  n[        U[        5      (       a  UR                  s  $ [        U[        5      (       d  M=  Us  $    g)aV  
Property to get the underlying transformers PreTrainedModel instance, if it exists.
Note that it's possible for a model to have multiple underlying transformers models, but this property
will return the first one it finds in the module hierarchy.

.. note::

    This property can also return e.g. ORTModelForFeatureExtraction or OVModelForFeatureExtraction instances
    from the optimum-intel and optimum-onnx libraries, if the model is loaded using ``backend="onnx"`` or
    ``backend="openvino"``.

Returns:
    PreTrainedModel or None: The underlying transformers model or None if not found.
N)r3   rb   r!   r  r   )rr   rv   s     ry   rÑ  ÚBaseModel.transformers_modelã  sB   € ð  —l‘l–nˆFä˜&¤+×.Ñ.Ø—|‘|Ò#Ü˜&¤/×2Ó2Ø’ñ %ð r–   c                ó¢   • [         R                  SU R                  R                   SU R                  R                   S35        U R                  $ )NÚ`z2._target_device` has been deprecated. Please use `z.device` instead.)rU   r�   rP   rQ   r4   r“   s    ry   Ú_target_deviceÚBaseModel._target_deviceû  sN   € ä�‰Ø�—‘×'Ñ'Ð(Ð(ZÐ[_×[iÑ[i×[rÑ[rÐZsð  tEð  Fô	
ð �{‰{Ðr–   c                ó€   • [         R                  SU R                  R                   S35        U R	                  U5        g )Nr  zF._target_device` has been deprecated. Please use `to(device)` instead.)rU   r�   rP   rQ   rn   )rr   r4   s     ry   r  r    s3   € ä�‰Ø�—‘×'Ñ'Ð(Ð(nÐoô	
ð 	�‰��r–   c                ój   •  [        U R                  5       5      R                  $ ! [         a     gf = f)zg
`torch.dtype`: The dtype of the module (assuming that all the module parameters have the same dtype).
N)ri   rj   rk   rÒ  r“   s    ry   rk   ÚBaseModel.dtype	  s1   € ð
	Ü˜Ÿ™Ó)Ó*×0Ñ0Ð0øÜó 	Ùð	ús   ‚"% ¥
2±2c                ó   • / $ )zS
Return the list of modules that should not be split when using model parallelism.
r¡   r“   s    ry   Ú_no_split_modulesÚBaseModel._no_split_modules  ó	   € ð
 ˆ	r–   c                ó   • / $ )z:
Return the list of keys to ignore when saving the model.
r¡   r“   s    ry   Ú_keys_to_ignore_on_saveÚ!BaseModel._keys_to_ignore_on_save  r  r–   c           	     ól   • U R                   R                  nU R                  5       nSU SU SU SU S3	$ )zŠReturn a usage tip snippet for the push_to_hub PR description.

Subclasses can override this to provide model-type-specific example code.
z·## Testing this pull request
You can test this pull request before merging by loading the model from this PR with the `revision` argument:
```python
from sentence_transformers import zO

# NOTE: Update this to the number of your pull request
pr_number = 2
model = z(
    "z5",
    revision=f"refs/pr/{pr_number}",
    backend="z	",
)
```
)rP   rQ   r”   )rr   r\  Ú
class_namer@   s       ry   rn  Ú BaseModel._push_to_hub_usage_tip!  s\   € ð
 —^‘^×,Ñ,ˆ
Ø×"Ñ"Ó$ˆð#ð $. ,ð /	ð 
ˆð Ø€Yð àˆYð ðð 	r–   )
rO   rN   r@   r6   ro   r?   rR   rM   r5   r8   r    ) rs   r,   r3   z4list[nn.Module] | OrderedDict[str, nn.Module] | Noner4   r,   r5   zdict[str, str] | Noner6   r,   r7   r,   r8   rÉ   r9   r,   r:   rÉ   r;   úbool | str | Noner<   údict[str, Any] | Noner=   r%  r>   r%  r?   zCardData | Noner@   ú$Literal['torch', 'onnx', 'openvino']rÐ  ÚNone)rÐ  r'  )rŽ   r,   r�   r,   rÐ  r,   )rÐ  r&  )rÐ  zlist[Modality])r©   r   rÐ  rÉ   )rÐ  z	list[str])rÐ  z
int | None)rÐ  ztorch.nn.Module)rÐ  rÉ   )rÔ   ú
np.ndarrayrÐ  r(  )rÐ  Úint)rñ   údict[str, Tensor]rÐ  r*  )r  zlist[SingleInput | PairInput]rŽ   r,   rÐ  zdict[str, Tensor | Any])r  z.list[str] | list[dict] | list[tuple[str, str]]rÐ  r*  )r  r	   rÐ  rÉ   )NTNT)r[   r0   r3  r,   r4  rÉ   r5  úlist[str] | Noner   rÉ   rÐ  r'  )rÐ  údict[str, Any])rM  r0   rÐ  r0   )NÚ
deprecated)r[   r0   r3  r,   r5  r+  rÐ  r'  )	NNNTzAdd new model.NFFN)r\  r0   rb  r,   r;   r,   r]  úbool | Noner   rÉ   r^  r0   r_  r,   r  rÉ   r`  rÉ   r5  r+  rÐ  r0   )
NNTNNFFNNF)r\  r0   r;   r,   r]  r.  r   rÉ   r^  r,   r_  r,   r  rÉ   r`  rÉ   r5  r+  r9   r,   rj  rÉ   rÐ  r0   )NFFNNN)rs   r0   r;   r$  r7   r,   r9   r,   r8   rÉ   r:   rÉ   r<   r%  r=   r%  r>   r%  rÐ  úDtuple[list[nn.Module] | OrderedDict[str, nn.Module], dict[str, Any]])r   r,  rÐ  r'  )NFFNNNN)rs   r0   r;   r$  r7   r,   r9   r,   r8   rÉ   r:   rÉ   r<   r%  r=   r%  r>   r%  rR   r,   rÐ  r/  )NF)rs   r0   r;   r$  r7   r,   r9   r,   r:   rÉ   rÐ  r0   )r:  r0   rs   r0   r8   rÉ   r9   r,   r<   r%  rÐ  rÏ  )r½  r   r¾  r,   rÐ  zdict[str, float] | float)rÃ  r%  rÐ  r'  )rÐ  ztorch.device)rë  r+  rÐ  ú2dict[Literal['input', 'output', 'processes'], Any])r÷  r0  rÐ  r'  )
r  r0   r  r*   rî  r   r  r   rÐ  r'  )rÐ  r	   )rÐ  zPreTrainedModel | None)r4   zint | str | torch.device | NonerÐ  r'  )rÐ  ztorch.dtype | None)r\  r0   rÐ  r0   )ArQ   r)  Ú__qualname__Ú__firstlineno__Ú__doc__r   rL   r-   Ú__annotations__r.   r1   rh   rp   r�   r”   Úpropertyr˜   rª   r·   r¼   rÁ   rÅ   rÍ   ÚstaticmethodrÖ   rÜ   rô   rÿ   r  r  r(  r$  rG  rN  r2  r'   rc  ra  ra   r   r}  r  r–  r€  r~  r˜  r¿  rÂ  r4   rò  rø  rþ  ré  r  Úsetterr  r»   rÑ  r  rk   r  r  rn  Ú__static_attributes__Ú__classcell__)rP   s   @ry   r*   r*   /   sB  ø‡ ñð" .Ðà37Ð$ jÓ7ð /1ÐÐ+Ó0à,LÐ$ cÓLð *.ðc2ð IMØ!Ø)-Ø*.Ø#'Ø"'Ø#Ø!&Ø#'Ø.2Ø26Ø/3Ø+/Ø8?ñ#c2à&ðc2ð Fð	c2ð
 ðc2ð 'ðc2ð (ðc2ð !ðc2ð  ðc2ð ðc2ð ðc2ð !ðc2ð ,ðc2ð 0ðc2ð -ðc2ð  )ð!c2ð" 6ð#c2ð$ 
÷%c2ñ c2ôJô,ô6ð ó8ó ð8ô ôD$ô<#ô8ô<ôð$ óó ðð  ó/ó ð/ôbð* "ð>à-ð>ð ð>ð
 
!õ>ô@7ôð6 "&Ø"&Ø+/Ø#'ðNFàðNFð ðNFð  ð	NFð
 )ðNFð !ðNFð 
õNFô`

ð "&Ø"&Ø+/Ø#'ð
àð
ð ð
ð  ð	
ð
 )ð
ð !ð
ð 
õ
ô6ð \hð'#Øð'#Ø%/ð'#ØHXð'#à	õ'#ðR  ð $(Ø Ø#Ø#'Ø.Ø'+ØØ#(Ø+/ð>
àð>
ð !ð>
ð ð	>
ð
 ð>
ð !ð>
ð ð>
ð %ð>
ð ð>
ð !ð>
ð )ð>
ð 
ô>
ó  ð>
ðF !Ø#Ø#'Ø%)Ø'+ØØ#(Ø+/Ø#Øðk%àðk%ð ðk%ð ð	k%ð
 !ðk%ð #ðk%ð %ðk%ð ðk%ð !ðk%ð )ðk%ð ðk%ð ðk%ð 
õk%ðd  $Ø"'Ø!&Ø.2Ø26Ø/3ð0sàð0sð !ð0sð !ð	0sð
 ð0sð  ð0sð ð0sð ,ð0sð 0ð0sð -ð0sð 
Nõ0sðd ð  $Ø"'Ø!&Ø.2Ø26Ø/3ðàðð !ðð !ð	ð
 ðð  ðð ðð ,ðð 0ðð -ðð 
Nôó ððD  $Ø"'Ø!&Ø.2Ø26Ø/3ðw&àðw&ð !ðw&ð !ð	w&ð
 ðw&ð  ðw&ð ðw&ð ,ðw&ð 0ðw&ð -ðw&ð 
Nõw&ôrUð(  $Ø"'Ø!&Ø.2Ø26Ø/3Ø!%ð
àð
ð !ð
ð !ð	
ð
 ð
ð  ð
ð ð
ð ,ð
ð 0ð
ð -ð
ð ð
ð 
Nõ
ð<  $Ø!&ð,Càð,Cð !ð,Cð !ð	,Cð
 ð,Cð ð,Cð 
õ,Cð\'-àð'-ð  ð'-ð  ð	'-ð
 ð'-ð ,ð'-ð 
ô'-öR,ö;ð ó+ó ð+ð8 26ð0VØ.ð0Và	;õ0Vðd óó ðò(Vð ðVØðVàðVð ðVð ð	Vð
 
óVó ðVð ó!ó ð!ð ×Ñó	ó ð	ð ó!ó ð!ð ó8ó ð8ð ×Ñó'ó ð'ð óó ðð. óó ðð ×Ñõó ðð óó ðð óó ðð óó ð÷ò r–   r*   )MÚ
__future__r   rW   r™  r&  rS   r-  r+  rp  rW  Úabcr   r   Úcollectionsr   Úmultiprocessingr   Úpathlibr   Útypingr	   r
   ÚnumpyrÒ   r2   Útorch.multiprocessingræ  rB  Úhuggingface_hubr   r   Ú	packagingr   r   r   r   r   r   Ú!transformers.dynamic_module_utilsr   r   Útransformers.utilsr   Útransformers_loggingrA  r   Ú%sentence_transformers.base.evaluationr   Ú#sentence_transformers.base.modalityr   r   Ú)sentence_transformers.base.modality_typesr   r   r   Ú%sentence_transformers.base.model_cardr   r   Ú"sentence_transformers.base.modulesr   r    r!   Ú%sentence_transformers.base.peft_mixinr"   Úsentence_transformers.utilr#   r$   r%   r&   r'   Úsentence_transformers.util.miscr(   Ú
get_loggerrQ   rU   Ú
Sequentialr*   r¡   r–   ry   Ú<module>rQ     s¢   ðÝ "ã Û Û Û 	Û Û 
Û Û ß #Ý #Ý !Ý ß ã Û Ý "Û ß +Ý ß ß WÑ Wß fÝ >å -Ý ?ß Uß VÑ Vß Xß JÑ JÝ B÷õ õ Hà	×	(Ò	(¨Ó	2€ôG�—‘Ð/°õ Gr–   