ó
    >:j„  ã                  ó¼   • S SK Jr  S SKrS SKJr   S SKJr  S SK	J
r
Jr  S SKJr  S SKJrJr  \R"                  " \5      r " S S	\5      rg! \ a	    S SKJr   NBf = f)
é    )ÚannotationsN)ÚCallable)ÚSelf)ÚTensorÚnn)ÚModule)ÚfullnameÚimport_from_stringc                  ó  ^ • \ rS rSr% Sr/ SQrS\S'   S\R                  " 5       SSSS4               SU 4S	 jjjr	SS
 jr
SS jrU 4S jrSS.SS jjr\      S               SS jj5       rSrU =r$ )ÚDenseé   aÊ  Applies a linear transformation with an optional activation function.

Passes the embedding through a feed-forward layer (``nn.Linear`` + activation), useful for
dimensionality reduction or projecting embeddings into a different space.

Args:
    in_features: Size of the input dimension.
    out_features: Size of the output dimension.
    bias: Whether to include a bias vector in the linear layer.
    activation_function: Activation function applied after the linear layer.
        If ``None``, uses ``nn.Identity()``. Defaults to ``nn.Tanh()``.
    init_weight: Initial value for the weight matrix of the linear layer.
    init_bias: Initial value for the bias vector of the linear layer.
    module_input_name: The key in the features dictionary to read the input from.
        Defaults to ``"sentence_embedding"``.
    module_output_name: The key in the features dictionary to store the output in.
        If ``None``, uses the same key as ``module_input_name``.
)Úin_featuresÚout_featuresÚbiasÚactivation_functionÚmodule_input_nameÚmodule_output_namez	list[str]Úconfig_keysTNÚsentence_embeddingc	                óŽ  >• [         T	U ]  5         Xl        X l        X0l        Uc  [
        R                  " 5       OUU l        [
        R                  " XUS9U l	        Xpl
        Ub  UOUU l        Ub%  [
        R                  " U5      U R                  l        Ub.  U(       a&  [
        R                  " U5      U R                  l        g g g )N)r   )ÚsuperÚ__init__r   r   r   r   ÚIdentityr   ÚLinearÚlinearr   r   Ú	ParameterÚweight)
Úselfr   r   r   r   Úinit_weightÚ	init_biasr   r   Ú	__class__s
            €Úe/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sentence_transformers/base/modules/dense.pyr   ÚDense.__init__0   s    ø€ ô 	‰ÑÔØ&ÔØ(ÔØŒ	Ø4GÑ4O¤2§;¢;¤=ÐUhˆÔ Ü—i’i ÀÑEˆŒØ!2ÔØ8JÑ8VÑ"4Ð\mˆÔàÑ"Ü!#§¢¨kÓ!:ˆD�K‰KÔàÑ ¦TÜ!Ÿ|š|¨IÓ6ˆD�K‰KÕð &*Ð ó    c           	     ó”   • UR                  U R                  U R                  U R                  XR                     5      5      05        U$ ©N)Úupdater   r   r   r   )r   Úfeaturess     r"   ÚforwardÚDense.forwardJ   s@   € Ø�‰Ø×$Ñ$ d×&>Ñ&>¸t¿{¹{È8×TjÑTjÑKkÓ?lÓ&mÐnô	
ð ˆr$   c                ó   • U R                   $ r&   )r   )r   s    r"   Úget_embedding_dimensionÚDense.get_embedding_dimensionP   s   € Ø× Ñ Ð r$   c                óT   >• [         TU ]  5       n[        U R                  5      US'   U$ )Nr   )r   Úget_config_dictr	   r   )r   Úconfigr!   s     €r"   r/   ÚDense.get_config_dictS   s+   ø€ Ü‘Ñ(Ó*ˆÜ(0°×1IÑ1IÓ(JˆÐ$Ñ%Øˆr$   ©Úsafe_serializationc               óD   • U R                  U5        U R                  XS9  g )Nr2   )Úsave_configÚsave_torch_weights)r   Úoutput_pathr3   ÚargsÚkwargss        r"   ÚsaveÚ
Dense.saveX   s!   € Ø×Ñ˜Ô%Ø×Ñ ÐÒSr$   c                ó.  • UUUUUS.n	U R                   " SSU0U	D6n
SU
;   aV  U(       d  U
S   R                  S5      (       a  [        U
S   5      " 5       U
S'   O[        R	                  SU
S    S35        U
S	 U " S0 U
D6nU R
                  " SXS.U	D6nU$ )	N)Ú	subfolderÚtokenÚcache_folderÚrevisionÚlocal_files_onlyÚmodel_name_or_pathr   ztorch.zActivation function path 'zÁ' is not trusted, falling back to the default activation function (Tanh). Please load the model with `trust_remote_code=True` to allow loading custom activation functions via the configuration.)rB   Úmodel© )Úload_configÚ
startswithr
   ÚloggerÚwarningÚload_torch_weights)ÚclsrB   r=   r>   r?   r@   rA   Útrust_remote_coder9   Ú
hub_kwargsr0   rC   s               r"   ÚloadÚ
Dense.load\   sÇ   € ð #ØØ(Ø Ø 0ñ
ˆ
ð —’ÑUÐ4FÐUÈ*ÑUˆØ  FÓ*Þ  FÐ+@Ñ$A×$LÑ$LÈX×$VÑ$VÜ0BÀ6ÐJ_ÑC`Ô0aÓ0c�Ð,Ò-ä—‘Ø0°Ð8MÑ1NÐ0Oð P7ð 7ôð Ð0Ð1Ù‘�f‘ˆØ×&Ò&ÐhÐ:LÑhÐ]gÑhˆØˆr$   )r   r   r   r   r   r   r   )r   Úintr   rO   r   Úboolr   z!Callable[[Tensor], Tensor] | Noner   úTensor | Noner    rQ   r   Ústrr   ú
str | None)r(   zdict[str, Tensor])ÚreturnrO   )r7   rR   r3   rP   rT   ÚNone)Ú NNNFF)rB   rR   r=   rR   r>   zbool | str | Noner?   rS   r@   rS   rA   rP   rK   rP   rT   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   ÚTanhr   r)   r,   r/   r:   ÚclassmethodrM   Ú__static_attributes__Ú__classcell__)r!   s   @r"   r   r      s  ø‡ ñò&€K�ó ð ØACÇÂÃØ%)Ø#'Ø!5Ø)-ð7àð7ð ð7ð ð	7ð
 ?ð7ð #ð7ð !ð7ð ð7ð '÷7ð 7ô4ô!õð
 HL÷ Tð ð Ø#'Ø#'Ø#Ø!&Ø"'ð àð ð ð ð !ð	 ð
 !ð ð ð ð ð ð  ð ð 
ô ó ö r$   r   )Ú
__future__r   ÚloggingÚcollections.abcr   Útypingr   ÚImportErrorÚtyping_extensionsÚtorchr   r   Ú)sentence_transformers.base.modules.moduler   Úsentence_transformers.utilr	   r
   Ú	getLoggerrW   rG   r   rD   r$   r"   Ú<module>rk      sS   ðÝ "ã Ý $ð'Ý÷ å <ß Cà	×	Ò	˜8Ó	$€ôjˆFõ jøð ó 'ß&ð'ús   ’A ÁAÁA