ó
    >:j  ã                  óh   • S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SK	J
r
  \ " S S\5      5       rg)	é    )ÚannotationsN)Ú	dataclass)ÚOptional)Ú
PeftConfig)ÚPeftTypec                  óä   ^ • \ rS rSr% SrSrS\S'   SrS\S'   SrS	\S
'   Sr	S	\S'   Sr
S	\S'   SrS\S'   SrS\S'   SrS\S'   SrS	\S'   SrS\S'   SrS\S'   SrS\S'   SrS\S'   U 4S jrSrU =r$ )ÚXLoraConfigé   a&  
This is the configuration class to store the configuration of a `XLoraModel`. When the config is reloaded, the
paths of the `adapters` field is disregarded in favor of the saved adapters. As such, only the keys matter during
loading.

Args:
    hidden_size (`int`):
        Hidden size of the base model.
    adapters (`dict`):
        Mapping of adapter names to the LoRA adapter id, as per PeftModel.load_adapter. *They will be automatically
        loaded*, to use as LoRA experts. When using from_pretrained, pass the new adapters dict as a keyword
        argument.
    enable_softmax (`bool`, *optional*, defaults to `True`):
        Enable softmax application for the X-LoRA classifier.
    enable_softmax_topk (`bool`, *optional*, defaults to `False`):
        Enable softmax application for the top-k LoRA adapters. Mutually exclusive to `enable_softmax` and must
        only be set if `top_k_lora` is.
    softmax_temperature (`float`, *optional*, defaults to 1.0):
        Softmax temperature, lower yields sharper predictions
    layerwise_scalings (`bool`, *optional*, defaults to `False`):
        If True, generate scalings for each LoRA adapter (each layer). If this is False, then scalings will be
        broadcasted, the same, to each layer.
    top_k_lora (`int`, *optional*, defaults to None):
        Sparsely select the top_k LoRA experts instead of the default dense method.
    xlora_depth (`int`, *optional*, defaults to 1):
        Depth of the X-LoRA classifier.
    xlora_size (`int`, *optional*, defaults to 2048):
        Hidden size of the X-LoRA classifier, irrelevant if `xlora_depth=1`.
    xlora_dropout_p (`float`, *optional*, defaults to 0.2):
        Dropout probability of the X-LoRA classifier, irrelevant if `xlora_depth=1`.
    use_trainable_adapters (`bool`, *optional*, defaults to False):
        Make the adapters trainable.
    scaling_pass_value (`float`, *optional*, defaults to 0):
        Scaling pass value.
    global_scaling_weight (`float`, *optional*, defaults to 1):
        Weight to multiply output of each LoRA adapter by.
NÚintÚhidden_sizezdict[str, str]ÚadaptersTÚboolÚenable_softmaxFÚenable_softmax_topkÚlayerwise_scalingsé   Úxlora_depthi   Ú
xlora_sizegš™™™™™É?ÚfloatÚxlora_dropout_pÚuse_trainable_adaptersg      ð?Úsoftmax_temperaturezOptional[int]Ú
top_k_lorag        Úscaling_pass_valueÚglobal_scaling_weightc                ó6  >• [         TU ]  5         [        R                  U l        U R
                  c  [        R                  " S5        SU l        U R                  c  [        R                  " S5        0 U l        U R                  (       a#  U R                  c  [        R                  " S5        U R                  (       a'  U R                  (       a  [        R                  " S5        U R                  b(  U R                  S:  a  [        R                  " S5        g g g )NzqNo value was provided for `hidden_size`. This will be set to 4096 by default, please ensure that this is correct.i   zhNo value was provided for for `adapters`. This will be set to empty, please ensure that this is correct.z5`enable_softmax_topk` enabled `top_k_lora` is not setzc`enable_softmax_topk` and `enable_softmax` are both enabled. This will result in worse performance.r   z&`top_k_lora` value must be at least 1.)ÚsuperÚ__post_init__r   ÚXLORAÚ	peft_typer   ÚwarningsÚwarnr   r   r   r   )ÚselfÚ	__class__s    €ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/peft/tuners/xlora/config.pyr   ÚXLoraConfig.__post_init__N   sÎ   ø€ Ü‰ÑÔÜ!Ÿ™ˆŒà×ÑÑ#Ü�MŠMð Dôð  $ˆDÔØ�=‰=Ñ Ü�MŠMØzôð ˆDŒMà×#×#¨¯©Ñ(?Ü�MŠMÐQÔRà×#×#¨×(;×(;Ü�MŠMØuôð �?‰?Ñ&¨4¯?©?¸QÓ+>Ü�MŠMÐBÕCð ,?Ð&ó    )r   r   r    )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   r   r   r   r   r   r   r   r   r   r   r   r   Ú__static_attributes__Ú__classcell__)r$   s   @r%   r	   r	      sŸ   ø‡ ñ$ðL €K�ÓØ#€HˆnÓ#Ø€N�DÓØ %Ð˜Ó%Ø$Ð˜Ó$Ø€K�ÓØ€J�ÓØ €O�UÓ Ø#(Ð˜DÓ(Ø!$Ð˜Ó$Ø $€J�Ó$Ø #Ð˜Ó#Ø#&Ð˜5Ó&÷Dó Dr'   r	   )Ú
__future__r   r!   Údataclassesr   Útypingr   Úpeft.configr   Úpeft.utils.peft_typesr   r	   © r'   r%   Ú<module>r6      s:   ðõ #ã Ý !Ý å "Ý *ð ôMD�*ó MDó ñMDr'   