
    ;i]-                         S SK Jr   " S S\5      r " S S\5      r " S S\5      r " S S	\5      r " S
 S\5      r " S S\5      rg)    )Optimizer1Statec                   >   ^  \ rS rSr         SU 4S jjrSrU =r$ )Lion   c                 6   > [         TU ]  SUUUSUUUUUU	U
S9  g)a  
Base Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    optim_bits (`int`, defaults to 32):
        The number of bits of the optimizer state.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
    is_paged (`bool`, defaults to `False`):
        Whether the optimizer is a paged optimizer or not.
lion        is_pagedNsuper__init__)selfparamslrbetasweight_decay
optim_bitsargsmin_8bit_sizepercentile_clipping
block_wiser   	__class__s              g/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/bitsandbytes/optim/lion.pyr   Lion.__init__	   s<    L 	 	 	
     )	-C6?g?gGz?r       N   d   TF__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r   s   @r   r   r      s*     3
 3
r   r   c                   <   ^  \ rS rSr        SU 4S jjrSrU =r$ )Lion8bit?   c
                 6   > [         T
U ]  SUUUSUSUUUUU	S9  g)aX  
8-bit Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
    is_paged (`bool`, defaults to `False`):
        Whether the optimizer is a paged optimizer or not.
r   r	   r   r
   Nr   r   r   r   r   r   r   r   r   r   r   r   s             r   r   Lion8bit.__init__@   s<    F 	 	 	
r   r   r   r   r   Nr!   r"   TFr#   r*   s   @r   r,   r,   ?   '     0
 0
r   r,   c                   <   ^  \ rS rSr        SU 4S jjrSrU =r$ )	Lion32bits   c
                 6   > [         T
U ]  SUUUSUSUUUUU	S9  g)aY  
32-bit Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
    is_paged (`bool`, defaults to `False`):
        Whether the optimizer is a paged optimizer or not.
r   r	   r    r
   Nr   r/   s             r   r   Lion32bit.__init__t   s<    F 	 	 	
r   r   r1   r#   r*   s   @r   r4   r4   s   r2   r   r4   c                   <   ^  \ rS rSr        SU 4S jjrSrU =r$ )	PagedLion   c
                 6   > [         T
U ]  SUUUSUUUUUU	SS9  g)aL  
Paged Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    optim_bits (`int`, defaults to 32):
        The number of bits of the optimizer state.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
r   r	   Tr
   Nr   )r   r   r   r   r   r   r   r   r   r   r   s             r   r   PagedLion.__init__   s<    F 	 	 	
r   r   )r   r   r   r    Nr!   r"   Tr#   r*   s   @r   r9   r9      s'     0
 0
r   r9   c                   :   ^  \ rS rSr       SU 4S jjrSrU =r$ )PagedLion8bit   c	                 6   > [         T	U ]  SUUUSUSUUUUSS9  g)aR  
Paged 8-bit Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    optim_bits (`int`, defaults to 32):
        The number of bits of the optimizer state.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
r   r	   r   Tr
   Nr   
r   r   r   r   r   r   r   r   r   r   s
            r   r   PagedLion8bit.__init__   s<    D 	 	 	
r   r   r   r   r   Nr!   r"   Tr#   r*   s   @r   r>   r>      $     /
 /
r   r>   c                   :   ^  \ rS rSr       SU 4S jjrSrU =r$ )PagedLion32biti  c	                 6   > [         T	U ]  SUUUSUSUUUUSS9  g)aS  
Paged 32-bit Lion optimizer.

Arguments:
    params (`torch.tensor`):
        The input parameters to optimize.
    lr (`float`, defaults to 1e-4):
        The learning rate.
    betas (`tuple(float, float)`, defaults to (0.9, 0.999)):
        The beta values are the decay rates of the first and second-order moment of the optimizer.
    weight_decay (`float`, defaults to 0):
        The weight decay value for the optimizer.
    optim_bits (`int`, defaults to 32):
        The number of bits of the optimizer state.
    args (`object`, defaults to `None`):
        An object with additional arguments.
    min_8bit_size (`int`, defaults to 4096):
        The minimum number of elements of the parameter tensors for 8-bit optimization.
    percentile_clipping (`int`, defaults to 100):
        Adapts clipping threshold automatically by tracking the last 100 gradient norms and clipping the gradient at a certain percentile to improve stability.
    block_wise (`bool`, defaults to `True`):
        Whether to independently quantize each block of tensors to reduce outlier effects and improve stability.
r   r	   r    Tr
   Nr   rA   s
            r   r   PagedLion32bit.__init__  s<    D 	 	 	
r   r   rC   r#   r*   s   @r   rF   rF     rD   r   rF   N)bitsandbytes.optim.optimizerr   r   r,   r4   r9   r>   rF   r   r   r   <module>rJ      sW   
 94
? 4
n1
 1
h1
 1
h1
 1
h0
O 0
f0
_ 0
r   