ó
    >:j&  ã                  óÌ   • % S SK Jr  S SKJrJrJr  S SKrSSKJr  \(       a  SSK	J
r
  SSKJr  0 rS\S	'   0 rS
\S'   0 rS
\S'   0 rS\S'   SS jr   S           SS jjrg)é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚOptionalNé   )ÚPeftType)Ú
PeftConfig)Ú	BaseTunerz dict[PeftType, type[PeftConfig]]ÚPEFT_TYPE_TO_CONFIG_MAPPINGzdict[PeftType, type[BaseTuner]]ÚPEFT_TYPE_TO_TUNER_MAPPINGÚ PEFT_TYPE_TO_MIXED_MODEL_MAPPINGzdict[PeftType, str]ÚPEFT_TYPE_TO_PREFIX_MAPPINGc                ó&   • [         U S      " S0 U D6$ )z�
Returns a Peft config object from a dictionary.

Args:
    config_dict (`Dict[str, Any]`): Dictionary containing the configuration parameters.
Ú	peft_type© )r   )Úconfig_dicts    ÚI/home/mande/repo/quber/.venv/lib/python3.13/site-packages/peft/mapping.pyÚget_peft_configr   $   s   € ô ' {°;Ñ'?Ò@ÑOÀ;ÑOÐOó    c                ó   • U R                   (       d  U R                  (       a  [        S5      eU R                  [        R                  5       ;  a  [        SU R                   S35      e[        U R                     nU" XX#US9nUR                  $ )a,  
Create PEFT layers and inject them into the model in-place.

Currently the API does not support prompt learning methods and adaption prompt.

This function is similar to [`get_peft_model`] but it does not return a [`PeftModel`] instance. Instead, it returns
the original, mutated instance of the passed model.

Args:
    peft_config (`PeftConfig`):
        Configuration object containing the parameters of the PEFT model.
    model (`torch.nn.Module`):
        The input model where the adapter will be injected.
    adapter_name (`str`, `optional`, defaults to `"default"`):
        The name of the adapter to be injected, if not provided, the default adapter name is used ("default").
    low_cpu_mem_usage (`bool`, `optional`, defaults to `False`):
        Create empty adapter weights on meta device. Useful to speed up the loading process.
    state_dict (`dict`, *optional*, defaults to `None`)
        If a `state_dict` is passed here, the adapters will be injected based on the entries of the state_dict.
        This can be useful when the exact `target_modules` of the PEFT method is unknown, for instance because the
        checkpoint was created without meta data. Note that the values from the `state_dict` are not used, only the
        keys are used to determine the correct layers that should be adapted.
zN`create_and_replace` does not support prompt learning and adaption prompt yet.z+`inject_adapter_in_model` does not support z" yet. Please use `get_peft_model`.)Úadapter_nameÚlow_cpu_mem_usageÚ
state_dict)Úis_prompt_learningÚis_adaption_promptÚ
ValueErrorr   r   ÚkeysÚmodel)Úpeft_configr   r   r   r   Ú	tuner_clsÚ
peft_models          r   Úinject_adapter_in_modelr"   /   sŽ   € ð< ×%×%¨×)G×)GÜÐiÓjÐjà×ÑÔ$>×$CÑ$CÓ$EÓEÜØ9¸+×:OÑ:OÐ9PÐPrÐsó
ð 	
ô +¨;×+@Ñ+@ÑA€Iñ Ø¨Ðgqñ€Jð ×ÑÐr   )r   zdict[str, Any]Úreturnr	   )ÚdefaultFN)r   r	   r   útorch.nn.Moduler   Ústrr   Úboolr   z!Optional[dict[str, torch.Tensor]]r#   r%   )Ú
__future__r   Útypingr   r   r   ÚtorchÚutilsr   Úconfigr	   Útuners.tuners_utilsr
   r   Ú__annotations__r   r   r   r   r"   r   r   r   Ú<module>r/      s£   ðö #ç /Ñ /ã å ö Ý"Ý.ð ACÐ Ð=Ó BØ>@Ð Ð;Ó @ØDFÐ  Ð"AÓ FØ35Ð Ð0Ó 5ôPð "Ø#Ø48ð-Øð-àð-ð ð-ð ð	-ð
 2ð-ð ö-r   