§
    Ý˜ºhy  ã                   ó¼  — d dl Z d dlZd dlmZ 	 d dlZn5# eef$ r+ d dlZ eej	        ¦  «        j
        dk    r ed¦  «        ‚Y nw xY wd„ Zd„ Zd„ Zd„ Zd	„ Zd
„ Zdd„Z eej        j        ¦  «         ed¦  «        k    rd„ Zej        j        ZeZneZeZeeeeeeeej        j        ej        j        ej        j        ej        j        ej        j        dœZd„ ZdS )é    N)Úparseé   zºYour currently installed version of Keras is Keras 3, but this is not yet supported in Transformers. Please install the backwards-compatible tf-keras package with `pip install tf-keras`.c           
      óØ   — t          j        | ¦  «        } ddt           j                             | t          j        t          j        d¦  «        | j        ¦  «        z  ¦  «        z   z  }| |z  S )a~  
    Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when
    initially created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
    0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) Also see
    https://huggingface.co/papers/1606.08415
    ç      à?ç      ð?ç       @)ÚtfÚconvert_to_tensorÚmathÚerfÚcastÚsqrtÚdtype)ÚxÚcdfs     úc/var/www/html/services/rag-service/venv/lib/python3.11/site-packages/transformers/activations_tf.pyÚ_gelur   "   sU   € õ 	Ô˜QÑÔ€AØ
�•r”w—{’{ 1¥r¤w­r¬w°s©|¬|¸Q¼WÑ'EÔ'EÑ#EÑFÔFÑFÑ
G€Càˆs‰7€Nó    c                 óF  — t          j        | ¦  «        } t          j        t          j        | j        ¦  «        }t          j        d| j        ¦  «        }ddt          j        t          j        d|z  ¦  «        | |t          j        | d¦  «        z  z   z  ¦  «        z   z  }| |z  S )zú
    Gaussian Error Linear Unit. This is a smoother version of the GELU. Original paper: https://huggingface.co/papers/1606.0841

    Args:
        x: float Tensor to perform activation

    Returns:
        `x` with the GELU activation applied.
    ç÷Hmâä¦?r   r   r   é   )	r	   r
   r   r   Úpir   Útanhr   Úpow)r   r   Úcoeffr   s       r   Ú	_gelu_newr   /   s…   € õ 	Ô˜QÑÔ€AÝ	Œ•”˜!œ'Ñ	"Ô	"€BÝŒG�H˜aœgÑ&Ô&€EØ
�•r”w�rœw s¨R¡xÑ0Ô0°A¸ÅÄÀqÈ!ÁÄÑ8LÑ4LÑMÑNÔNÑNÑ
O€Càˆs‰7€Nr   c                 ó’   — t          j        | ¦  «        } | t          j        t           j                             | ¦  «        ¦  «        z  S )N)r	   r
   r   r   Úsoftplus©r   s    r   Úmishr    A   s7   € Ý
Ô˜QÑÔ€Aà�rŒw•r”w×'Ò'¨Ñ*Ô*Ñ+Ô+Ñ+Ð+r   c                 óê   — t          j        | ¦  «        } t          j        d| j        ¦  «        }t          j        d| j        ¦  «        }d| z  dt          j        | |z  d|| z  | z  z   z  ¦  «        z   z  S )Nr   g€ÑÓ3Eˆé?r   r   )r	   r
   r   r   r   )r   Úcoeff1Úcoeff2s      r   Ú	gelu_fastr$   G   sl   € Ý
Ô˜QÑÔ€AÝŒW�X˜qœwÑ'Ô'€FÝŒW�\ 1¤7Ñ+Ô+€Fà�‰7�c�BœG A¨¡J°#¸À¹
ÀQ¹Ñ2FÑ$GÑHÔHÑHÑIÐIr   c                 ó¨   — t          j        | ¦  «        } t          j        d| j        ¦  «        }| t           j                             || z  ¦  «        z  S )Ng¬Zd;û?)r	   r
   r   r   r   Úsigmoid)r   r   s     r   Ú
quick_gelur'   O   sB   € Ý
Ô˜QÑÔ€AÝŒG�E˜1œ7Ñ#Ô#€EØ�rŒw�Š˜u q™yÑ)Ô)Ñ)Ð)r   c                 óH   — t          j        t          | ¦  «        dd¦  «        S )a¨  
    Clip the range of possible GeLU outputs between [-10, 10]. This is especially useful for quantization purpose, as
    it allows mapping 2 negatives values in the GeLU spectrum. For more information on this trick, please refer to
    https://huggingface.co/papers/2004.09602

    Gaussian Error Linear Unit. Original Implementation of the gelu activation function in Google Bert repo when
    initially created. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
    0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) Also see
    https://huggingface.co/papers/1606.08415 :param x: :return:
    iöÿÿÿé
   )r	   Úclip_by_valuer   r   s    r   Úgelu_10r+   U   s   € õ Ô�E !™HœH c¨2Ñ.Ô.Ð.r   éÿÿÿÿc                 óz   — t          j        | d|¬¦  «        \  }}|t           j                             |¦  «        z  S )aÐ  
    Gated Linear Unit. Implementation as defined in the original paper (see https://huggingface.co/papers/1612.08083), where
    the input `x` is split in two halves across a dimension (`axis`), A and B, returning A * sigmoid(B).

    Args:
        `x`: float Tensor to perform activation
        `axis`: dimension across which `x` be split in half

    Returns:
        `x` with the GLU activation applied (with its size halved across the dimension `axis`).
    r   )Úaxis)r	   Úsplitr   r&   )r   r.   ÚaÚbs       r   Úglur2   c   s7   € õ Œ8�A�q˜tÐ$Ñ$Ô$�D€A€qØ�rŒw�Š˜qÑ!Ô!Ñ!Ð!r   z2.4c                 óD   — t           j                             | d¬¦  «        S )NT)Úapproximate)ÚkerasÚactivationsÚgelur   s    r   Úapproximate_gelu_wrapr8   u   s   € ÝÔ ×%Ò% a°TÐ%Ñ:Ô:Ð:r   )r7   r+   r$   Úgelu_newr2   r    r'   Úrelur&   ÚsiluÚswishr   c           	      ó    — | t           v rt           |          S t          d| › dt          t                                ¦   «         ¦  «        › �¦  «        ‚)Nz	function z not found in ACT2FN mapping )ÚACT2FNÚKeyErrorÚlistÚkeys)Úactivation_strings    r   Úget_tf_activationrC   �   sO   € Ø�FÐ"Ð"ÝÐ'Ô(Ð(åÐhÐ#4ÐhÐhÕSWÕX^×XcÒXcÑXeÔXeÑSfÔSfÐhÐhÑiÔiÐir   )r,   )r   Ú
tensorflowr	   Úpackaging.versionr   Útf_kerasr5   ÚModuleNotFoundErrorÚImportErrorÚ__version__ÚmajorÚ
ValueErrorr   r   r    r$   r'   r+   r2   ÚversionÚVERSIONr8   r6   r7   r9   r:   r&   r<   r   r>   rC   © r   r   ú<module>rO      s×  ðð €€€à Ð Ð Ð Ø #Ð #Ð #Ð #Ð #Ð #ð

ØÐÐÐÐøØ˜[Ð)ð 
ð 
ð 
Ø€L€L€Là€uˆUÔÑÔÔ%¨Ò)Ð)Øˆjð&ñ
ô 
ð 	
ð *Ð)ð
øøøð
ð 
ð 
ðð ð ð$,ð ,ð ,ðJð Jð Jð*ð *ð *ð/ð /ð /ð"ð "ð "ð "ð  	€5ˆŒÔ	ÑÔ   e¡¤Ò,Ð,ð;ð ;ð ;ð ÔÔ!€DØ$€H€Hà€DØ€Hð ØØØØØØØÔÔ"ØÔ Ô(ØÔÔ#ØÔÔ$ØÔÔ"ð
ð 
€ð jð jð jð jð js   � •/AÁA