o
    1Aiȇ                     @  sx  d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
 d dlmZ d dlmZmZ d dlmZ d dlmZmZ d dlZd d	lmZ d d
lmZ d dlmZmZ d dlmZmZmZmZ d dl m!Z!m"Z"m#Z#m$Z$m%Z% d dl&m'Z'm(Z(m)Z)m*Z*m+Z+ d dl,m-Z- d dl.m/Z/ d dl0m1Z1 d dl2m3Z3 d dl4m5Z5m6Z6m7Z7 d dl8m9Z9 ddl:m;Z; dd Z<G dd de;Z=dS )    )annotationsN)contextmanager)asdictreplace)Enum)partialreduce)chain)LiteralOptional)nn)tqdm)is_bnb_4bit_availableis_bnb_available)BaseTunerLayercheck_target_module_existsonload_layerreplicate_layers)2TRANSFORMERS_MODELS_TO_LORA_TARGET_MODULES_MAPPINGModulesToSaveWrapper_freeze_adapter_get_submodulesget_quantization_config)dare_linear	dare_tiesmagnitude_prunetask_arithmeticties)dispatch_aqlm)dispatch_awq)
LoraConfig)dispatch_gptq)Conv2d	LoraLayerdispatch_default)dispatch_megatron   )	BaseTunerc                 C  s   ||d< ||fS )Nadapter_names )targetargskwargsr(   r)   r)   >/data/cameron/vidgen/svd_motion_lora/Motion-LoRA/LoRA/model.py_adapter_names_pre_forward_hook8   s   r.   c                      sB  e Zd ZU dZdZded< dN fddZdOddZedd Z	dPddZ
dd Zdd ZdQddZedd ZdR fddZdSdTd"d#ZdUdVd&d'ZdNd(d)ZdNd*d+ZdWd.d/Zed0d1 Zd2d3 Zed4d5 Z	$			6dXdYd;d<Z	=	6	6	$	6	6	>dZd[dAdBZ	6	$	6d\dCdDZdEdF Zd]dGdHZ	6d^d_dJdKZd`dLdMZ  Z S )a	LoraModelaR
  
    Creates Low Rank Adapter (LoRA) model from a pretrained transformers model.

    The method is described in detail in https://arxiv.org/abs/2106.09685.

    Args:
        model ([`torch.nn.Module`]): The model to be adapted.
        config ([`LoraConfig`]): The configuration of the Lora model.
        adapter_name (`str`): The name of the adapter, defaults to `"default"`.

    Returns:
        `torch.nn.Module`: The Lora model.

    Example:

        ```py
        >>> from transformers import AutoModelForSeq2SeqLM
        >>> from peft import LoraModel, LoraConfig

        >>> config = LoraConfig(
        ...     task_type="SEQ_2_SEQ_LM",
        ...     r=8,
        ...     lora_alpha=32,
        ...     target_modules=["q", "v"],
        ...     lora_dropout=0.01,
        ... )

        >>> model = AutoModelForSeq2SeqLM.from_pretrained("t5-base")
        >>> lora_model = LoraModel(model, config, "default")
        ```

        ```py
        >>> import torch
        >>> import transformers
        >>> from peft import LoraConfig, PeftModel, get_peft_model, prepare_model_for_kbit_training

        >>> rank = ...
        >>> target_modules = ["q_proj", "k_proj", "v_proj", "out_proj", "fc_in", "fc_out", "wte"]
        >>> config = LoraConfig(
        ...     r=4, lora_alpha=16, target_modules=target_modules, lora_dropout=0.1, bias="none", task_type="CAUSAL_LM"
        ... )
        >>> quantization_config = transformers.BitsAndBytesConfig(load_in_8bit=True)

        >>> tokenizer = transformers.AutoTokenizer.from_pretrained(
        ...     "kakaobrain/kogpt",
        ...     revision="KoGPT6B-ryan1.5b-float16",  # or float32 version: revision=KoGPT6B-ryan1.5b
        ...     bos_token="[BOS]",
        ...     eos_token="[EOS]",
        ...     unk_token="[UNK]",
        ...     pad_token="[PAD]",
        ...     mask_token="[MASK]",
        ... )
        >>> model = transformers.GPTJForCausalLM.from_pretrained(
        ...     "kakaobrain/kogpt",
        ...     revision="KoGPT6B-ryan1.5b-float16",  # or float32 version: revision=KoGPT6B-ryan1.5b
        ...     pad_token_id=tokenizer.eos_token_id,
        ...     use_cache=False,
        ...     device_map={"": rank},
        ...     torch_dtype=torch.float16,
        ...     quantization_config=quantization_config,
        ... )
        >>> model = prepare_model_for_kbit_training(model)
        >>> lora_model = get_peft_model(model, config)
        ```

    **Attributes**:
        - **model** ([`~transformers.PreTrainedModel`]) -- The model to be adapted.
        - **peft_config** ([`LoraConfig`]): The configuration of the Lora model.
    lora_strprefixreturnNonec                   s   t  ||| d S N)super__init__)selfmodelconfigadapter_name	__class__r)   r-   r7      s   zLoraModel.__init__r:   r    c                 C  s2   t | jdkr|jdkrt| jj ddS dS )z
        A helper method to check the config when a new adapter is being added.

        Raise a ValueError if there is something wrong with the config or if it conflicts with existing adapters.

        r&   nonezf supports only 1 adapter with bias. When using multiple adapters, set bias to 'none' for all adapters.N)lenpeft_configbias
ValueErrorr=   __name__)r8   r:   r)   r)   r-   _check_new_adapter_config   s
   	z#LoraModel._check_new_adapter_configc                 C  s
   t | |S r5   )r   )lora_configkeyr)   r)   r-   _check_target_module_exists   s   
z%LoraModel._check_target_module_existsr@   r9   	nn.Modulec                 C  s   |j rt||j  dS dS )a  
        A private method to modify the model structure before adapter is applied.

        Args:
            peft_config (`PeftConfig`):
                The prepared adapter config.
            model (`nn.Module`):
                The model that is going to be adapted.
        N)layer_replicationr   )r8   r@   r9   r)   r)   r-   _prepare_model   s   
zLoraModel._prepare_modelc                   sP   d u rt dtt|j |j }tt fdd| }|j||j	}	|j||j
}
|	|
|j|j|j|j|jt| jddt| jddd	}g d}|D ]}t| j|d	}|d urf||| d
< qRddlm} t|trt||s|j||	|
|j|j|j|jd d S | j|||fi |}|| jkr|d | |||| d S )NzCurrent Key shouldn't be `None`c                   s   t d|  d S )Nz.*\.$)rematch)rF   current_keyr)   r-   <lambda>   s    z/LoraModel._create_and_replace.<locals>.<lambda>is_loaded_in_8bitFis_loaded_in_4bit)	r
lora_alphalora_dropoutfan_in_fan_outinit_lora_weights
use_rslorause_doraloaded_in_8bitloaded_in_4bit)gptqaqlmawq)method_quantization_configr   )AdaLoraLayer)rT   rU   rW   rX   rY   )rB   listr	   rank_patternkeysalpha_patternnextfiltergetrS   rT   rU   rV   rW   rX   rY   getattrr9   r   peft.tuners.adalorara   
isinstancer#   update_layer_create_new_moduleactive_adapterrequires_grad__replace_module)r8   rE   r;   r*   target_nameparentrO   pattern_keystarget_name_keyrS   alphar,   quant_methodsquant_methodquantization_configra   
new_moduler)   rN   r-   _create_and_replace   sJ   	



zLoraModel._create_and_replacec                 C  s   t ||| t|dr|j}t|ds |j|_t|dr |j|_t|dd d ur>t|dr3|j|j_n|j|_||jj |	 D ]\}}| j
|v sOd|v r`t|drW|jn|j}||j qBd S )N
base_layerrA   stateranknumqweight)setattrhasattrr{   weightrA   ri   r|   todevicenamed_modulesr2   r~   )r8   rr   
child_namery   childnamemoduler   r)   r)   r-   rp      s$   



zLoraModel._replace_modulec                 C  s   |  D ]\}}| j|vrd|_q| jD ]H}| j| j}|dkr!q|dkr6|  D ]\}}d|v r4d|_q)q|dkrU| D ]}t|trSt	|drS|jd urSd|j_q>qt
d| dd S )	NFr>   allrA   T	lora_onlyzRequested bias: z, is not implemented.)named_parametersr2   requires_gradactive_adaptersr@   rA   modulesrk   r#   r   NotImplementedError)r8   r9   nprn   rA   mr)   r)   r-    _mark_only_adapters_as_trainable   s,   

z*LoraModel._mark_only_adapters_as_trainablec           	      K  s   g }t  rddlm} || t rddlm} || |ttt	t
tg d }|D ]}|||fd| i|}|d ur? nq,|d u rLtd| d|S )Nr   )dispatch_bnb_8bit)dispatch_bnb_4bitrE   zTarget module z is not supported. Currently, only the following modules are supported: `torch.nn.Linear`, `torch.nn.Embedding`, `torch.nn.Conv2d`, `transformers.pytorch_utils.Conv1D`.)r   Zpeft.tuners.lora.bnbr   appendr   r   extendr   r   r!   r%   r$   rB   )	rE   r;   r*   r,   dispatchersr   r   ry   
dispatcherr)   r)   r-   rm     s&   


zLoraModel._create_new_moduler   c                   s.   zt  |W S  ty   t| j| Y S w )z1Forward missing attributes to the wrapped module.)r6   __getattr__AttributeErrorri   r9   )r8   r   r<   r)   r-   r   4  s
   zLoraModel.__getattr__F	inferenceboolc                 C  sF   i }| j  D ]\}}dd t| D }|rd|d< q|||< |S )Nc                 S  s&   i | ]\}}|t |tr|jn|qS r)   )rk   r   value).0kvr)   r)   r-   
<dictcomp>>  s   & z5LoraModel.get_peft_config_as_dict.<locals>.<dictcomp>Tinference_mode)r@   itemsr   )r8   r   config_dictrF   r   r:   r)   r)   r-   get_peft_config_as_dict;  s   z!LoraModel.get_peft_config_as_dictTenabledc                 C  s,   | j  D ]}t|ttfr|| qd S r5   )r9   r   rk   r   r   enable_adapters)r8   r   r   r)   r)   r-   _set_adapter_layersD  s
   
zLoraModel._set_adapter_layersc                 C  s   | j dd dS )zyEnable all adapters.

        Call this if you have previously disabled all adapters and want to re-enable them.
        Tr   N)r   r8   r)   r)   r-   enable_adapter_layersI  s   zLoraModel.enable_adapter_layersc                 C  sF   | j D ]}| j| j}|dkrd| d}t| q| jdd dS )zDisable all adapters.

        When disabling all adapters, the model output corresponds to the output of the base model.
        r>   z>Careful, disabling adapter layers with bias configured to be 'zP' does not produce the same output as the the base model would without adaption.Fr   N)r   r@   rA   warningswarnr   )r8   rn   valmsgr)   r)   r-   disable_adapter_layersP  s   


z LoraModel.disable_adapter_layersr;   str | list[str]c                 C  sF   | j  D ]}t|tr|jrtd |  || q|| _	dS )a   Set the active adapter(s).

        Additionally, this function will set the specified adapters to trainable (i.e., requires_grad=True). If this is
        not desired, use the following code.

        ```py
        >>> for name, param in model_peft.named_parameters():
        ...     if ...:  # some check on name (ex. if 'lora' in name)
        ...         param.requires_grad = False
        ```

        Args:
            adapter_name (`str` or `list[str]`): Name of the adapter(s) to be activated.
        zJAdapter cannot be set when the model is merged. Unmerging the model first.N)
r9   r   rk   r#   mergedr   r   unmergeset_adapterrn   )r8   r;   r   r)   r)   r-   r   _  s   



zLoraModel.set_adapterc                 o  s    | dd }|d u rd V  d S | jrtdg }|  D ]}t|tr6tt|d}|j|dd}|	| qd V  |D ]}|
  q<d S )Nr(   z?Cannot pass `adapter_names` when the model is in training mode.)r(   T)with_kwargs)poptrainingrB   r   rk   r#   r   r.   register_forward_pre_hookr   remove)r8   r+   r,   r(   hook_handlesr   pre_forwardhandler)   r)   r-   _enable_peft_forward_hooksv  s$   


z$LoraModel._enable_peft_forward_hooksc                 C  s2   t | jdddkrtd| jdrtddS )zVerify that the configuration supports merging.

        Currently gptq quantization and replicated layers do not support merging.
        quantization_methodNr\   z9Cannot merge LORA layers when the model is gptq quantizedrI   z>Cannot merge LORA layers when base model layers are replicated)ri   r9   rB   r@   rh   r   r)   r)   r-   _check_merge_allowed  s
   zLoraModel._check_merge_allowedc                 C  s4   | j d u r|d tvrtdtt|d  | _ | S )N
model_typez0Please specify `target_modules` in `peft_config`)target_modulesr   rB   set)r@   model_configr)   r)   r-   _prepare_adapter_config  s   

z!LoraModel._prepare_adapter_configNprogressbar
safe_merger(   Optional[list[str]]c              	     s  |r     fdd j D }d|rdnd d }t|| |dD ]g}zt j|\}}	}
W n	 ty:   Y q$w t|	D t|	drY|rN|	j||d	  	||
|	
 |	 n#t|	tr||	j|	j }t|drv|rr|j||d	 |
 }t||
| W d    n1 sw   Y  q$ jS )
Nc                      g | ]\}} j |vr|qS r)   r2   r   rF   _r   r)   r-   
<listcomp>      z:LoraModel._unload_and_optionally_merge.<locals>.<listcomp>z
Unloading zand merging  r9   )disabledescr{   )r   r(   )r   r9   r   r   r   r   r   r   mergerp   get_base_layerrk   r   modules_to_savern   r   )r8   r   r   r   r(   key_listr   rF   rr   r*   rq   ry   r)   r   r-   _unload_and_optionally_merge  s4   



z&LoraModel._unload_and_optionally_mergesvdtotalmajority_sign_methodLiteral['total', 'frequency']c                   s  |t  j v rdS |D ]}|t  j vr td| dqt|dkr)dn|} fdd|D }|dv rItt|dkrDtd	|d
 }n|dkrRt|}n|dr^|p\t|}ntd|  fdd|D }|swtd| tt|dkrtd|d
 t	krd
 fdd|D }n|d
 tkrttj fdd|D }n
td|d
  dt j|d
  |||d j|<   j| t j|  fdd j D }|D ]}t j|\}}}t|tr||jv r|j| j}|j| j}n||jv r|j| }|j| }nq|jd |_|jd |_|dkrg g }}t||D ]>\}}||jv rG|j| j}|j| j}n||jv rX|j| }|j| }nq0||j| |j|   ||j q0t|d
krztdt j!|d
d}t j!|dd}||jd|j"d
 ddf< ||jddd|j"d f< q|dv r j#||||||||	|
|||d\|_|_q|dv rӈ $|||||	|
\|_|_qdS )a	  
        This method adds a new adapter by merging the given adapters with the given weights.

        When using the `cat` combination_type you should be aware that rank of the resulting adapter will be equal to
        the sum of all adapters ranks. So it's possible that the mixed adapter may become too big and result in OOM
        errors.

        Args:
            adapters (`list`):
                List of adapter names to be merged.
            weights (`list`):
                List of weights for each adapter.
            adapter_name (`str`):
                Name of the new adapter.
            combination_type (`str`):
                The merging type can be one of [`svd`, `linear`, `cat`, `ties`, `ties_svd`, `dare_ties`, `dare_linear`,
                `dare_ties_svd`, `dare_linear_svd`, `magnitude_prune`, `magnitude_prune_svd`]. When using the `cat`
                combination_type, the rank of the resulting adapter is equal to the sum of all adapters ranks (the
                mixed adapter may be too big and result in OOM errors).
            svd_rank (`int`, *optional*):
                Rank of output adapter for svd. If None provided, will use max rank of merging adapters.
            svd_clamp (`float`, *optional*):
                A quantile threshold for clamping SVD decomposition output. If None is provided, do not perform
                clamping. Defaults to None.
            svd_full_matrices (`bool`, *optional*):
                Controls whether to compute the full or reduced SVD, and consequently, the shape of the returned
                tensors U and Vh. Defaults to True.
            svd_driver (`str`, *optional*):
                Name of the cuSOLVER method to be used. This keyword argument only works when merging on CUDA. Can be
                one of [None, `gesvd`, `gesvdj`, `gesvda`]. For more info please refer to `torch.linalg.svd`
                documentation. Defaults to None.
            density (`float`, *optional*):
                Value between 0 and 1. 0 means all values are pruned and 1 means no values are pruned. Should be used
                with [`ties`, `ties_svd`, `dare_ties`, `dare_linear`, `dare_ties_svd`, `dare_linear_svd`,
                `magnintude_prune`, `magnitude_prune_svd`]
            majority_sign_method (`str`):
                The method, should be one of ["total", "frequency"], to use to get the magnitude of the sign values.
                Should be used with [`ties`, `ties_svd`, `dare_ties`, `dare_ties_svd`]
        NAdapter  does not existr&   linearc                   s   g | ]} j | jqS r)   )r@   rS   r   adapterr   r)   r-   r     s    z2LoraModel.add_weighted_adapter.<locals>.<listcomp>)r   r   r   r   r   zkAll adapters must have the same r value when using combination_type linear, ties, dare_ties or dare_linear.r   catr   zInvalid combination_type: c                   s   g | ]
}t  j| jqS r)   )typer@   r   r   r   r)   r-   r     s    z'Found no adapter matching the names in zall adapter configs should follow the same target modules type. Combining adapters with `target_modules` type being a mix of list/set and string is not supported.|c                 3  s$    | ]}d  j | j dV  qdS )()Nr@   r   r   r   r)   r-   	<genexpr>  s   " z1LoraModel.add_weighted_adapter.<locals>.<genexpr>c                 3  s    | ]	} j | jV  qd S r5   r   r   r   r)   r-   r   !  s    zInvalid type z found in target_modules)rS   rT   r   c                   r   r)   r   r   r   r)   r-   r   1  r   g        z9No matching LoRAs found. Please raise an issue on GitHub.)dim)r   ties_svddare_linear_svddare_ties_svdmagnitude_prune_svdfull_matricesdriver)r   r   r   r   r   )%rb   r@   rd   rB   r?   r   sumendswithmaxr1   joinr   operatoror_	TypeErrorr   inject_adapterr9   r   r   r   rk   r#   lora_Ar   lora_Blora_embedding_Alora_embedding_Bdatazipr   scalingtorchr   shape1_svd_generalized_task_arithmetic_weighted_adapter-_generalized_task_arithmetic_weighted_adapter)r8   adaptersweightsr;   combination_typesvd_rank	svd_clampsvd_full_matrices
svd_driverdensityr   r   adapters_ranksnew_ranktarget_module_typesnew_target_modulesr   rF   r   r*   target_lora_Atarget_lora_Bloras_Aloras_Br   current_adapter_lora_Acurrent_adapter_lora_Br)   r   r-   add_weighted_adapter  s   5








zLoraModel.add_weighted_adapterc                   sD  g }g }t  fdd|D }t||D ]\}}| jv s"| jv r1|| || j|   qt|dkr<td fdd|D }t	|
|d j}|dkrZt||}n5|dkrft||||	}n)|d	krqt|||}n|d
kr}t||||	}n|dkrt|||}ntd| t t}|r j dd dk}|s|jdd}n| }t dr js|r|j}tjj|||d\}}}|d d d |f }|d | }|t| }|d |d d f }|
d urt| | g}t||
}| }|||}|||}|r| |j!j"}| |j!j"}||fS )Nc                 3  s    | ]}| j v V  qd S r5   )r   r   r*   r)   r-   r     s    zNLoraModel._svd_generalized_task_arithmetic_weighted_adapter.<locals>.<genexpr>r   z9No matching LoRAs found. Please raise an issue on Github.c                   s   g | ]}  |qS r)   )get_delta_weightr   r  r)   r-   r         zOLoraModel._svd_generalized_task_arithmetic_weighted_adapter.<locals>.<listcomp>r   r   r   r   r   z*Invalid value passed to combination type:       )r&   r&   r&   )	start_dimrV   r   )#anyr   r   r   r   r   r?   rB   r   tensorr   r   r   r   r   r   r   rk   r"   r   sizeflattensqueezer   rV   Tlinalgr   diagr   quantileclampreshaper   r   )r8   r  r  r  r  r*   r  r  r	  r   r$  r   r   valid_adaptersvalid_weightsis_embeddingr   r   delta_weightconv2d
conv2d_1x1USVhdisthi_vallow_valr)   r  r-   r   n  s\   


z;LoraModel._svd_generalized_task_arithmetic_weighted_adapterc                   sr  g }g }g }	t ||D ]@\}
}|
|jv r!|j|
 j}|j|
 j}n|
|jv r1|j|
 }|j|
 }nq|t||j	|
   ||j
 |	|j
 qt||d j}||	g}|d j t|D ]I\}}|dkrtt||||< qd|dkrt||||||< qd|dkrt|||||< qd|dkrt||||||< qd|dkrt|||||< qdtd fdd	|D }|S )
Nr   r   r   r   r   r   zInvalid combination typec                   s   g | ]}|  qS r)   )r   )r   deltadtyper)   r-   r     r  zKLoraModel._generalized_task_arithmetic_weighted_adapter.<locals>.<listcomp>)r   r   r   r   r   r   r   mathsqrtr   r   r   r  r   r   r4  	enumerater   r   r   r   r   rB   )r8   r  r  r  r*   r	  r   r'  lora_A_deltaslora_B_deltasr   r   r  r  lora_deltasitask_tensorsr)   r3  r-   r    s>   




z7LoraModel._generalized_task_arithmetic_weighted_adapterc                   s   |t  j vrtd| d j|=  fdd j D }d}|D ] }t j|\}}}t|trE|	| |du rE|j
dd }q%|pIg  _dS )z
        Deletes an existing adapter.

        Args:
            adapter_name (str): Name of the adapter to be deleted.
        r   r   c                   r   r)   r   r   r   r)   r-   r     r   z,LoraModel.delete_adapter.<locals>.<listcomp>N)rb   r@   rd   rB   r9   r   r   rk   r#   delete_adapterr   rn   )r8   r;   r   new_adapterrF   r   r*   r)   r   r-   r=    s   

zLoraModel.delete_adaptertorch.nn.Modulec                 C  s   | j |||dS )aG  
        This method merges the LoRa layers into the base model. This is needed if someone wants to use the base model
        as a standalone model.

        Args:
            progressbar (`bool`):
                whether to show a progressbar indicating the unload and merge process
            safe_merge (`bool`):
                whether to activate the safe merging check to check if there is any potential Nan in the adapter
                weights
            adapter_names (`List[str]`, *optional*):
                The list of adapter names that should be merged. If None, all active adapters will be merged. Defaults
                to `None`.
        Example:

        ```py
        >>> from transformers import AutoModelForCausalLM
        >>> from peft import PeftModel

        >>> base_model = AutoModelForCausalLM.from_pretrained("tiiuae/falcon-40b")
        >>> peft_model_id = "smangrul/falcon-40B-int4-peft-lora-sfttrainer-sample"
        >>> model = PeftModel.from_pretrained(base_model, peft_model_id)
        >>> merged_model = model.merge_and_unload()
        ```
        )r   r   r(   r   )r8   r   r   r(   r)   r)   r-   merge_and_unload  s   zLoraModel.merge_and_unloadc                 C  s   | j ddS )z
        Gets back the base model by removing all the lora modules without merging. This gives back the original base
        model.
        F)r   r@  r   r)   r)   r-   unload  s   zLoraModel.unload)r3   r4   )r:   r    r3   r4   )r@   r    r9   rH   )r9   rH   r3   r4   )r   r1   )F)r   r   )T)r   r   r3   r4   )r;   r   r3   r4   )TFFN)r   r   r   r   r(   r   )r   NNTNNr   )r   r   r3   r4   )NTN)r;   r1   r3   r4   )FFN)r   r   r   r   r(   r   r3   r?  )r3   r?  )!rC   
__module____qualname____doc__r2   __annotations__r7   rD   staticmethodrG   rJ   rz   rp   r   rm   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r=  rA  rB  __classcell__r)   r)   r<   r-   r/   >   s^   
 F


8

!	





' 6
D
, r/   )>
__future__r   r5  r   rL   r   
contextlibr   dataclassesr   r   enumr   	functoolsr   r   	itertoolsr	   typingr
   r   r   r   r   peft.import_utilsr   r   peft.tuners.tuners_utilsr   r   r   r   
peft.utilsr   r   r   r   r   peft.utils.merge_utilsr   r   r   r   r   Zpeft.tuners.lora.aqlmr   Zpeft.tuners.lora.awqr   Zpeft.tuners.lora.configr    Zpeft.tuners.lora.gptqr!   peft.tuners.lora.layerr"   r#   r$   Zpeft.tuners.lora.tp_layerr%   Ztuner_utilsr'   r.   r/   r)   r)   r)   r-   <module>   s6   