+
    Ljo              
          ^ RI t ^ RIHu Ht ^ RI Ht ^RIHt ^RIHtH	t	 ]! 4       '       d   ^ RI
t
R]P                  R]P                  R]P                  R]P                  R	]P                  /tR
 R lt ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      t ! R R]P"                  4      tR# )    N)nn)	deprecate)is_torch_npu_availableis_torch_versionswishsilumishgelureluc                D    V ^8  d   QhR\         R\        P                  /# )   act_fnreturn)strr   Module)formats   "H/app/.local/lib/python3.14/site-packages/diffusers/models/activations.py__annotate__r   $   s"     m m3 m299 m    c           	         V P                  4       p V \        9   d   \        V ,          ! 4       # \        RV  R\        \        P	                  4       4       24      h)zHelper function to get activation function from string.

Args:
    act_fn (str): Name of activation function.

Returns:
    nn.Module: Activation function.
zactivation function z not found in ACT2FN mapping )lowerACT2CLS
ValueErrorlistkeys)r   s   &r   get_activationr   $   sO     \\^Fv  /x7TUYZaZfZfZhUiTjkllr   c                   H   a a ] tR t^5t oRtV 3R ltV3R lR ltRtVtV ;t	# )FP32SiLUz@
SiLU activation function with input upcasted to torch.float32.
c                $   < \         SV `  4        R # N)super__init__)self	__class__s   &r   r"   FP32SiLU.__init__:   s    r   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# )r   inputsr   torchTensor)r   __classdict__s   "r   r   FP32SiLU.__annotate__=   s'     F Fell Fu|| Fr   c                    \         P                  ! VP                  4       R R7      P                  VP                  4      # )F)inplace)Fr   floattodtype)r#   r'   s   &&r   forwardFP32SiLU.forward=   s(    vvfllne477EEr    
__name__
__module____qualname____firstlineno____doc__r"   r3   __static_attributes____classdictcell____classcell__r$   r+   s   @@r   r   r   5   s!     F F Fr   r   c                   ^   a a ] tR t^At oRtRV3R lV 3R llltV3R lR ltR tRtVt	V ;t
# )	GELUa  
GELU activation function with tanh approximation support with `approximate="tanh"`.

Parameters:
    dim_in (`int`): The number of channels in the input.
    dim_out (`int`): The number of channels in the output.
    approximate (`str`, *optional*, defaults to `"none"`): If `"tanh"`, use tanh approximation.
    bias (`bool`, defaults to True): Whether to use a bias in the linear layer.
c                2   < V ^8  d   QhRS[ RS[ RS[RS[/# )r   dim_indim_outapproximatebias)intr   bool)r   r+   s   "r   r   GELU.__annotate__L   s*     ' 's 'S 's 'SW 'r   c                j   < \         SV `  4        \        P                  ! WVR 7      V n        W0n        R# rF   N)r!   r"   r   LinearprojrE   )r#   rC   rD   rE   rF   r$   s   &&&&&r   r"   GELU.__init__L   s&    IIfD9	&r   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# r   gater   r(   )r   r+   s   "r   r   rI   Q   s#     : : :%,, :r   c                R   VP                   P                  R 8X  dm   \        RR4      '       d[   \        P                  ! VP                  \        P                  R7      V P                  R7      P                  VP                  R7      # \        P                  ! WP                  R7      # )mps<2.0.0r2   )rE   )
devicetyper   r/   r
   r1   r)   float32rE   r2   r#   rR   s   &&r   r
   	GELU.geluQ   sq    ;;u$)9#w)G)G66$'''6DDTDTUXX_c_i_iXjjvvd(8(899r   c                J    V P                  V4      pV P                  V4      pV# r    )rN   r
   r#   hidden_statess   &&r   r3   GELU.forwardW   s$    		-0		-0r   )rE   rN   )noneTr7   r8   r9   r:   r;   r"   r
   r3   r<   r=   r>   r?   s   @@r   rA   rA   A   s(     ' '
: : r   rA   c                   ^   a a ] tR t^]t oRtRV3R lV 3R llltV3R lR ltR tRtVt	V ;t
# )	GEGLUa6  
A [variant](https://huggingface.co/papers/2002.05202) of the gated linear unit activation function.

Parameters:
    dim_in (`int`): The number of channels in the input.
    dim_out (`int`): The number of channels in the output.
    bias (`bool`, defaults to True): Whether to use a bias in the linear layer.
c                ,   < V ^8  d   QhRS[ RS[ RS[/# r   rC   rD   rF   rG   rH   )r   r+   s   "r   r   GEGLU.__annotate__g   s"     > >s >S > >r   c                l   < \         SV `  4        \        P                  ! W^,          VR7      V n        R# r   rL   Nr!   r"   r   rM   rN   r#   rC   rD   rF   r$   s   &&&&r   r"   GEGLU.__init__g   s$    IIfk=	r   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# rQ   r(   )r   r+   s   "r   r   rh   k   s#       %,, r   c                $   VP                   P                  R 8X  da   \        RR4      '       dO   \        P                  ! VP                  \        P                  R7      4      P                  VP                  R7      # \        P                  ! V4      # )rT   rU   rV   rW   )	rX   rY   r   r/   r
   r1   r)   rZ   r2   r[   s   &&r   r
   
GEGLU.geluk   s_    ;;u$)9#w)G)G66$'''67:::LLvvd|r   c                B   \        V4      ^ 8  g   VP                  RR4      e   Rp\        RRV4       V P                  V4      p\	        4       '       d!   \
        P                  ! VR^R7      ^ ,          # VP                  ^RR7      w  rWP                  V4      ,          # )r   scaleNzThe `scale` argument is deprecated and will be ignored. Please remove it, as passing it will raise an error in the future. `scale` should directly be passed while calling the underlying pipeline component i.e., via `cross_attention_kwargs`.z1.0.0)dimrE   rs   )	lengetr   rN   r   	torch_npu	npu_gegluchunkr
   )r#   r_   argskwargsdeprecation_messagerR   s   &&*,  r   r3   GEGLU.forwardq   s    t9q=FJJw5A #Ugw(;<		-0!##&&}"!LQOO"/"5"5aR"5"@M 99T?22r   rN   Trb   r?   s   @@r   rd   rd   ]   s(     > > 
3 
3r   rd   c                   L   a a ] tR t^~t oRtRV3R lV 3R llltR tRtVtV ;t	# )SwiGLUau  
A [variant](https://huggingface.co/papers/2002.05202) of the gated linear unit activation function. It's similar to
`GEGLU` but uses SiLU / Swish instead of GeLU.

Parameters:
    dim_in (`int`): The number of channels in the input.
    dim_out (`int`): The number of channels in the output.
    bias (`bool`, defaults to True): Whether to use a bias in the linear layer.
c                ,   < V ^8  d   QhRS[ RS[ RS[/# rf   rg   )r   r+   s   "r   r   SwiGLU.__annotate__   s"     $ $s $S $ $r   c                   < \         SV `  4        \        P                  ! W^,          VR7      V n        \        P
                  ! 4       V n        R# rj   )r!   r"   r   rM   rN   SiLU
activationrl   s   &&&&r   r"   SwiGLU.__init__   s1    IIfk=	'')r   c                |    V P                  V4      pVP                  ^RR7      w  rWP                  V4      ,          # )r   rt   ru   )rN   rz   r   )r#   r_   rR   s   && r   r3   SwiGLU.forward   s:    		-0+11!1<t444r   r   rN   r   r6   r?   s   @@r   r   r   ~   s     $ $5 5r   r   c                   X   a a ] tR t^t oRtRV3R lV 3R llltV3R lR ltRtVtV ;t	# )ApproximateGELUal  
The approximate form of the Gaussian Error Linear Unit (GELU). For more details, see section 2 of this
[paper](https://huggingface.co/papers/1606.08415).

Parameters:
    dim_in (`int`): The number of channels in the input.
    dim_out (`int`): The number of channels in the output.
    bias (`bool`, defaults to True): Whether to use a bias in the linear layer.
c                ,   < V ^8  d   QhRS[ RS[ RS[/# rf   rg   )r   r+   s   "r   r   ApproximateGELU.__annotate__   s"     : :s :S : :r   c                ^   < \         SV `  4        \        P                  ! WVR 7      V n        R# rK   rk   rl   s   &&&&r   r"   ApproximateGELU.__init__   s     IIfD9	r   c                N   < V ^8  d   QhRS[ P                  RS[ P                  /# )r   xr   r(   )r   r+   s   "r   r   r      s#     , , ,%,, ,r   c                l    V P                  V4      pV\        P                  ! R V,          4      ,          # )gZd;?)rN   r)   sigmoid)r#   r   s   &&r   r3   ApproximateGELU.forward   s'    IIaL5==+++r   r   r   r6   r?   s   @@r   r   r      s#     : :, , ,r   r   c                   H   a a ] tR t^t oRV3R lV 3R llltR tRtVtV ;t# )LinearActivationc                2   < V ^8  d   QhRS[ RS[ RS[RS[/# )r   rC   rD   rF   r   )rG   rH   r   )r   r+   s   "r   r   LinearActivation.__annotate__   s*     5 5s 5S 5 5QT 5r   c                ~   < \         SV `  4        \        P                  ! WVR 7      V n        \        V4      V n        R# rK   )r!   r"   r   rM   rN   r   r   )r#   rC   rD   rF   r   r$   s   &&&&&r   r"   LinearActivation.__init__   s,    IIfD9	(4r   c                F    V P                  V4      pV P                  V4      # r    )rN   r   r^   s   &&r   r3   LinearActivation.forward   s    		-0}--r   r   )Tr   )	r7   r8   r9   r:   r"   r3   r<   r=   r>   r?   s   @@r   r   r      s     5 5. .r   r   )r)   torch.nn.functionalr   
functionalr/   utilsr   utils.import_utilsr   r   rx   r   MishrA   ReLUr   r   r   r   rd   r   r   r   r5   r   r   <module>r      s          I  RWW
BGG
BGG
BGG
BGGm"	Fryy 	F299 83BII 3B5RYY 5.,bii ,(	.ryy 	.r   