ó
    eT–hü  ã                   óF   • S SK Jr  S SKJr   " S S\R                  5      rg)é    )ÚpartialNc                   ó0   ^ • \ rS rSrSrSrU 4S jrSrU =r$ )ÚGradientCheckpointingLayeré   aÜ  Base class for layers with gradient checkpointing.

This class enables gradient checkpointing functionality for a layer. By default, gradient checkpointing is disabled
(`gradient_checkpointing = False`). When `model.set_gradient_checkpointing()` is called, gradient checkpointing is
enabled by setting `gradient_checkpointing = True` and assigning a checkpointing function to `_gradient_checkpointing_func`.

Important:

    When using gradient checkpointing with `use_reentrant=True`, inputs that require gradients (e.g. hidden states)
    must be passed as positional arguments (`*args`) rather than keyword arguments to properly propagate gradients.

    Example:

        ```python
        >>> # Correct - hidden_states passed as positional arg
        >>> out = self.layer(hidden_states, attention_mask=attention_mask)

        >>> # Incorrect - hidden_states passed as keyword arg
        >>> out = self.layer(hidden_states=hidden_states, attention_mask=attention_mask)
        ```
Fc                 ó²   >• U R                   (       a6  U R                  (       a%  U R                  " [        [        TU ]  40 UD6/UQ76 $ [        TU ]  " U0 UD6$ )N)Úgradient_checkpointingÚtrainingÚ_gradient_checkpointing_funcr   ÚsuperÚ__call__)ÚselfÚargsÚkwargsÚ	__class__s      €ÚT/var/www/auris/envauris/lib/python3.13/site-packages/transformers/modeling_layers.pyr   Ú#GradientCheckpointingLayer.__call__-   sN   ø€ Ø×&×&¨4¯=¯=Ø×4Ò4´W¼U¹WÑ=MÑ5XÐQWÑ5XÐ`Ð[_Ò`Ð`Ü‰wÒ Ð0¨Ñ0Ð0ó    © )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s   ø† ñð, #Ð÷1ó 1r   r   )Ú	functoolsr   Útorch.nnÚnnÚModuler   r   r   r   Ú<module>r       s   ðõ å ô1 §¡õ 1r   