
    bi/                    P   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Zd dl	Z	d dlm
Z
mZ d dlmZmZ d dlmZ d dlmZ d dlmZ d	d
lmZ d	dlmZmZmZmZmZmZmZ d	dl m!Z! d Z"d Z#	 ddZ$	 d	 	 	 	 	 	 	 ddZ%	 	 	 	 	 	 	 	 ddZ&	 	 	 d	 	 	 ddZ'dddZ(	 d	 	 	 	 	 	 	 ddZ)y)    )annotationsN)Optional)file_existshf_hub_download)EntryNotFoundErrorLocalEntryNotFoundError)	load_file)http_user_agent)PEFT_TYPE_TO_PREFIX_MAPPING   )INCLUDE_LINEAR_LAYERS_SHORTHAND)EMBEDDING_LAYER_NAMESSAFETENSORS_WEIGHTS_NAMEWEIGHTS_NAMEAuxiliaryTrainingWrappercheck_file_exists_on_hf_hubinfer_devicematch_target_against_key)PeftTypec                    t        | d      xrH t        | j                  t        j                  j
                  t        j                  j                  f      S )z.Check if the layer has an embedding base layer
base_layer)hasattr
isinstancer   torchnnLinear	Embedding)layers    S/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/peft/utils/save_and_load.pyhas_valid_embedding_base_layerr    ,   s;    5,'oJu7G7G%((//[`[c[c[m[mIn,oo    c                j    | j                         D ]   \  }}|s||k(  s|t        |dd      k(  s|c S  y)z7Get the name of the embedding module for a given layer.r   N)named_modulesgetattr)modelr   is_embedding_in_target_modulesnamemodules        r   get_embedding_layer_namer)   1   sE    ++- f.6U?vQXY^`lnrQsGsK r!   c           
     2   ! |rt        | d|       } | j                  |    || j                         } j                  t        j
                  t        j                  fv r j                  }|dk(  r|D ci c]  }d|v s|||    }}nh|dk(  r|D ci c]  }d|v sd|v s|||    }}nF|dk(  r;i }|D ]3  }d|v s||   ||<   |j                  d      d   dz   }||v s,||   ||<   5 nt        |j                         D 	ci c]  \  }}	d|v r||v sd|v s||	 }}}	 j                  t        j                  k(  r^ j                  }
|
P|
j                         D 	ci c]  \  }}	|j                  d	| d
      |	 }
}}	|
 _        | j                  |
||      } j                  rd| d!!fd}|j                         D 	ci c]  \  }}	 ||      |	 }}}	nK j                  t        j                  k(  r j                  }|dk(  r|D ci c]  }d|v s|||    }}n|dk(  r|D ci c]  }d|v sd|v s|||    }}n|dk(  r<i }|D ]3  }d|v s||   ||<   |j                  d      d   dz   }||v s,||   ||<   5 nt         j                  t        j                   k(  r9|D ci c],  }|j                  d	      d   j#                  d      s'|||   . }}nC j$                  ri } j                  t        j&                  k(  r\| j(                  |   j*                  |d<   | j(                  |   j,                  |d<   | j(                  |   j.                  j0                  }nA j2                  r$| j(                  |   j.                  j0                  }n| j5                  |      }||d<   nt j                  t        j6                  k(  rt8         j                     }|D ci c]  }||v s|||    }}t;        j<                         dk(  rt?        j@                  d       | jC                         D ]t  \  }}tE        |d      s|jF                  j                         D ]E  \  }}	t;        j<                         dk(  r|	jI                  tJ        jL                        n|	|| d| <   G v nw j                  t        jN                  k(  rht8         j                     }|D ci c]  }||v s|||    }} jP                  r"d| |vrtS        d      |d|z      |d|z   <   |d|z      |d|z   <   n j                  t        jT                  k(  r|D ci c]  }d|v s|||    }}n j                  t        jV                  k(  r>i } jX                  dk  rtJ        jZ                  }nP jX                  dk  rtJ        j\                  }n0 jX                  dk  rtJ        j^                  }ntJ        j`                  } jb                  r|D ]  }d |v s||   je                   jd                        \  }}|jg                  |d!z   |jI                  |"      i       |jg                  |d#z   tK        jh                  |d$      ddddddf   jk                         i        n|D ci c]  }d |v s|||    }}|d%|z      |d%|z   <   n_ j                  tm        t              v r,t8         j                     }|D ci c]  }||v s|||    }}ntS        d& j                         | jC                         D ]  \  }}to        |tp              s|j#                  d'      r|js                  d'      }|j                         D 	ci c]/  \  }}	|j#                  | d	      s|js                  | d	      |	1 }}}	|jg                  |ju                  ||      j                         D 	ci c]  \  }}	| d	| |	 c}	}        d(}tE         d)      rto         jv                  tx              rT jv                  tz        k7  rAtE        | d*      r| j}                         n| }t         fd+|jC                         D              }n$ jv                  rt         fd,t        D              } j                  t        j                  k(  xs t         d-d      du}|d.k(  r|r|st?        j@                  d/       d0}n|d.k(  rt        t        | d1d      d2d      }t         d3d      }d(}|mt        j                  j                  t        j                  j                  |d4            }|xs t        |d4      }|t?        j@                  d5| d6       d(}n|}|rN|rL|rJ|| j                  j                  j                  |      j                  k7  rt?        j@                  d7       d0}nd(}|rtE        | d8      r|| j                         | j                         fD ]X  }|rt        |      st        | ||      }|s!|jg                  |j                         D 	ci c]  \  }}	||v s||	 c}	}       Z n|rt?        j@                  d9       |j                         D 	ci c]  \  }}	|j                  d	| d
      |	 }}}	|S c c}w c c}w c c}	}w c c}	}w c c}	}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}w c c}	}w c c}	}w c c}	}w c c}	}w ):uQ  
    Get the state dict of the Peft model.

    Args:
        model ([`PeftModel`]): The Peft model. When using torch.nn.DistributedDataParallel, DeepSpeed or FSDP,
            the model should be the underlying model/unwrapped model (i.e. model.module).
        state_dict (`dict`, *optional*, defaults to `None`):
            The state dict of the model. If not provided, the state dict of the passed model will be used.
        adapter_name (`str`, *optional*, defaults to `"default"`):
            The name of the adapter whose state dict should be returned.
        unwrap_compiled (`bool`, *optional*, defaults to `False`):
            Whether to unwrap the model if torch.compile was used.
        save_embedding_layers (`Union[bool, str]`, , *optional*, defaults to `auto`):
            If `True`, save the embedding layers in addition to adapter weights. If `auto`, checks the common embedding
            layers `peft.utils.other.EMBEDDING_LAYER_NAMES` in config's `target_modules` when available. Based on it
            sets the boolean flag. This only works for 🤗 transformers models.
    	_orig_modNnonelora_allbias	lora_onlyr   . lora_magnitude_vector..weightc                4    | j                        r| d d } | S )Niendswith)knew_dora_suffixs    r   renamed_dora_weightsz7get_peft_model_state_dict.<locals>.renamed_dora_weightsv   s    ::o.#2Ar!   boft_	boft_only	adaption_prefix_task_colsprefix_task_rowsprompt_embeddingsWindowszWindows has issues saving integers into safetensors. Hence, we convert shira_indices to float32 before saving on Windows OS. The shira_indices will always be converted to integers when loading.shira_indices.shira_indices.zbase_model.vera_A.zModel was initialised to not save vera_A and vera_B but config now specifies to save projection! Set `config.save_projection` to `False`.zbase_model.vera_B.internal_xlora_classifier   i   l        vblora_logits_topk_indices)dtype_topk_weightsdimzbase_model.vblora_vector_bank.zUnknown PEFT type passed: _fsdp_wrapped_module.Ftarget_modulesget_base_modelc              3     K   | ]5  \  }t        fd t        D              rt        j                         7 yw)c              3  R   K   | ]  }t        j                  d | d         yw)z(.*\.)?$N)rematch).0er8   s     r   	<genexpr>z6get_peft_model_state_dict.<locals>.<genexpr>.<genexpr>  s$     Srxx71#Q3Ss   $'N)anyr   r   rN   )rU   _r8   configs     @r   rW   z,get_peft_model_state_dict.<locals>.<genexpr>  s9      (AqS=RSS ))>)>B(s   ;?c              3  :   K   | ]  }|j                   v   y w)N)rN   )rU   r8   rZ   s     r   rW   z,get_peft_model_state_dict.<locals>.<genexpr>  s     'bqV-B-B(B'bs   trainable_token_indicesautozXSetting `save_embedding_layers` to `True` as embedding layers found in `target_modules`.TrZ   
vocab_sizebase_model_name_or_pathzconfig.jsonz Could not find a config file in z4 - will assume that the vocabulary was not modified.zdSetting `save_embedding_layers` to `True` as the embedding layer has been resized during finetuning.get_input_embeddingsuY   Could not identify embedding layer(s) because the model is not a 🤗 transformers model.)Or$   peft_config
state_dict	peft_typer   LORAADALORAr/   splitNotImplementedErroritemsrank_patternreplace!resize_state_dict_by_rank_patternuse_doraBOFTADAPTION_PROMPT
startswithis_prompt_learningMULTITASK_PROMPT_TUNINGprompt_encoderr?   r@   	embeddingweightinference_modeget_prompt_embedding_to_saveSHIRAr   platformsystemwarningswarnr#   r   rC   tor   float32VERAsave_projection
ValueErrorXLORAVBLORAnum_vectorsuint8int16int32int64save_only_topk_weightstopkupdatesoftmax
contiguouslistr   r   removeprefixadapter_state_dictrN   strr   rO   rX   r   TRAINABLE_TOKENSospathexistsjoinr   rZ   	__class__from_pretrainedr^   r`   get_output_embeddingsr    r)   )"r%   rb   adapter_nameunwrap_compiledsave_embedding_layersr/   r8   	to_return	bias_namevri   r:   rA   shira_prefixr'   r(   vera_prefixindices_dtypelogitsindicesprefixmodule_state_dictembedding_is_targeted_modelusing_trainable_tokensr^   model_idhas_base_configlocal_config_existsr   r   embedding_module_namerZ   r9   s"                                   @@r   get_peft_model_state_dictr   9   sj   ( {E2|,F%%'
 HMM8+;+;<< {{6>3=NaAJqM)NINU]3=]aAQW[\Q\JqM)]I][ I Ea<#-a=IaL ! 0 3f <I J./9)/D	),E &%&/oo&7sdaW\l^_N_ekopepQTs	sx///!..L'Q]QcQcQefA		Al^*<b A1 Dff&2#!CCLR[]ij	?? !7|nGLO
 AJ@QR1-a0!3RIR			X]]	*{{6>3=NaAJqM)NINU]3=]aAQW[\Q\JqM)]I][ I Ea<#-a=IaL ! 0 3f <I J./9)/D	),E &%			X55	5/9f!QWWS\"=M=X=XYd=eQ
1%f	f		"	"	x???,1,@,@,N,_,_I(),1,@,@,N,_,_I() % 4 4\ B L L S S$$$)$8$8$F$P$P$W$W!$)$F$F|$T!):	%&			X^^	+263C3CD/9O!\Q=NQ
1%O	O??	)MMt "//1 		LD&v/"00668 DAq 08/@I/MU]]+ST oaS9:		 
		X]]	*1&2B2BC/9N![A=MQ
1%N	N!! $L>2*D @  >HH\_kHk=lI*\9:=GH\_kHk=lI*\9:			X^^	+/9^!=X\]=]Q
1%^	^			X__	,	$!KKM%'!KKM%'!KKM!KKM(( s"a'&0m&8&8&EOFG$$a/&97::M:;Z%[\$$a/&95==UW;XYZ\]_b`b_bYb;c;n;n;p%qr	s 4>VaTUAUJqM)VIVEO,|;F
	2\AB 
		T(^	+,V-=-=>/9I!Vq[Q
1%I	I5f6F6F5GHII ++- ff6767 (()@A ;E:J:J:L!26!QPQP\P\`d_eef]gPh$qz*A-! ! .4.G.GVg.h.n.n.pqdaD61#!q: "v'(f++S1v7L7LPo7o 07u>N/OU))+UZF$' ("002( %!
 ""$''bLa'b$b! 	H555uIbdh9iqu9u  &+@I_pq $	&	(WUHd;\4P
6#<dC   "$''..h1V"W(`,GR_,`F~6xj@tu #("( u||55EEhOZZZMMv %)!$)!0F!G002E4O4O4QR 	jE ),J5,Q(@Od(e%($$z7G7G7I%htq!MbfgMgad%hi	j 
qr CL//BST$!QQ|n-r2A5TITK O] t  g S
 O] g" P& O _( W J! r\ &i
 Us   5	j=?j=k!kkk  kk	kk1k?k3(k#k#+	k(5k((	k-2k-	k2$k2)	k73k7>	k<k<l$l,lll lc                   |s|g fS g }| j                         }|j                         D ]  \  }}||vr||   j                  d   dk(  r(||   j                         dz  |j                         k(  rH||   j                  |j                  k7  se|j	                  ||j                  ||   j                  f        |D ]	  \  }}}||=  ||fS )Nr=   r      )rb   rh   shapenumelappend)r%   peft_model_state_dictignore_mismatched_sizes
mismatchedrb   keytensorrY   s           r   _find_mismatched_keysr   C  s     #$b((J!!#J,224 JVj  sO!!"%*C1F1F1H11LPVP\P\P^1^ c?  FLL0sFLL*S/2G2GHIJ   '	Q!#&' !*,,r!   c                   i }| j                         D ]n  \  }}||v r`|j                  |      d   }d|v r;dj                  |j                  d      dd       }|j                  || d|       }n| d| }|||<   j|||<   p |S )zbUtility function to remap the state_dict keys to fit the PEFT model by inserting the adapter name.r   r1   N)rh   rf   r   rj   )rb   r   parameter_prefixr   r   valsuffixsuffix_to_replaces           r   $_insert_adapter_name_into_state_dictr   _  s     $$& 
-Ss"YY/03Ff}$'HHV\\#->qr-B$C!kk"3~QGXFY5Z[Q|n-),!#&),!#&
- ! r!   c                    | j                   |   }|}| j                         D ]l  \  }}t        |t              s|j	                  |      }	|j                  d      r|j                  d      }|	D ]  }
| d|
 }| d|	|
    }||   ||<   ||=   n |j                  s|j                  t        j                  k(  r|}n|j                  t        j                  k(  r|}n|j                  t        v ri }t        |j                     }|j                  t        j                  k(  r^|j                  rQ| j                  |   j                   \  }}t#        |j%                               }|D ]  }
d|
v s	||
   j'                  t(        j*                        }|
j-                  dd      }||
j-                  dd         }t)        j.                  |d|j1                  dd	      z
  gd
      }t)        j2                  |      }t)        j4                  g |j                   dd |      j7                  t9        d            j'                  |j:                        j=                  d||      }|||<   ||
= ||
j-                  dd      =  t?        |||      }|j                  t        j@                  k(  r#|jB                  }|| jE                  ||       n|j                  t        jF                  k(  rtI        jJ                         dk(  rtM        jN                  d       | j                         D ]^  \  }}tQ        |d      s| d| |v s|jS                  | d|       }|j'                  t(        jT                        |jV                  |<   ` n|j                  t        jX                  k(  rc|jZ                  rd|vrt]        d      |jZ                  sd|v rtM        jN                  d       n|jZ                  stM        jN                  d       n|j                  t        j^                  k(  r4d|   fd}|ja                         D 
ci c]  \  }
} ||
      | }}
}n@|j                  t        jb                  k(  r#te        d |D              rt]        d      tf        ti        | ||      \  }}|rH| jk                  |dd      }| jm                         D ]   }tQ        |d      s|jo                  |       " n| jk                  |d      }|j                  r/| jp                  |   jr                  jk                  d|d    id       |j                  t        jt                  k(  r | jp                  |   jk                  |d       |rcd!jw                  |D cg c]  \  }}}d"| d#| d$| d% c}}}      }d&| jx                  jz                   d'| d}tM        jN                  |       |S c c}}
w c c}}}w )(a  
    Set the state dict of the Peft model.

    Args:
        model ([`PeftModel`]):
            The Peft model.
        peft_model_state_dict (`dict`):
            The state dict of the Peft model.
        adapter_name (`str`, *optional*, defaults to `"default"`):
            The name of the adapter whose state dict should be set.
        ignore_mismatched_sizes (`bool`, *optional*, defaults to `False`):
            Whether to ignore mismatched in the state dict.
        low_cpu_mem_usage (`bool`, `optional`, defaults to `False`):
            This argument must be `True` if the `model` was loaded with adapter weights on the meta device, e.g. after
            calling `inject_adapter_in_model` with `low_cpu_mem_usage=True`. Otherwise, leave it as `False`.

    rM   r1   rH   r2   rJ   r   r=   T)keepdimrK   Nz-inf)r   r   rB   zWindows has issues saving integers into safetensors. Hence, we had converted shira_indices to float32 before saving on Windows OS. The shira_indices will always be converted to integers when loading.rC   rD   zbase_model.vera_AzXSpecified to load vera_A and vera_B from state dictionary however they were not present!zSpecified to not load vera_A and vera_B from state dictionary however they are present in state dictionary! Consider using them to ensure checkpoint loading is correct on all platforms using `peft_config.save_projection = True`zSpecified to not load vera_A and vera_B from state dictionary. This means we will be relying on PRNG initialisation to restore these projections using `config.projection_prng_key`, which may not be accurate on all system configurations.r3   c                4    | j                        r| dz   } | S )Nr4   r6   )r8   old_dora_suffixs    r   r:   z7set_peft_model_state_dict.<locals>.renamed_dora_weights  s    ::o.IAr!   c              3  $   K   | ]  }d |v  
 yw)z.oft_r.N )rU   r   s     r   rW   z,set_peft_model_state_dict.<locals>.<genexpr>  s     E9#Es   zTrying to load old OFT checkpoint, which is no longer supported. Please install PEFT <= v0.15.2 to load it or train a new OFT adapter.)r   F)strictassign%_move_adapter_to_device_of_base_layer)r   rt   rA   
z- z: found shape z in the checkpoint and z in the model instantiatedzSome weights of zy were not initialized from the model checkpoint and are being ignored because you passed `ignore_mismatched_sizes=True`: )>ra   r#   r   r   adapter_state_dict_load_mapro   r   rp   rc   r   rn   r   r   r   r   vblora_vector_bankr   r   keysr|   r   longrj   catsumlogzerosfill_floatdevicescatterr   re   ri   resize_modules_by_rank_patternrw   rx   ry   rz   r{   r   popintrC   r~   r   r   rd   rh   OFTrX   rg   r   load_state_dictmodulesr   rr   rs   rq   r   r   __name__)!r%   r   r   r   low_cpu_mem_usagerZ   rb   r'   r(   key_mapr8   
lookup_key	store_keyr   r   rY   state_dict_keysr   original_keytopk_weightstopk_logitsmatrixri   shira_indices_valuesr:   mismatched_keysload_resultr   shape1shape2mismatched_warningmsgr   s!                                   @r   set_peft_model_state_dictr   r  s   0 |,F&J
 ++- +ff67 88FG67 (()@A + $vQqc]
#fAgaj\2	(=j(I
9% z*++&   F$4$48P8P$P *			X^^	+ *			8	8 "6v7G7GHx.63P3P"55lCIINK":??#45O$ P #a'"1((4A#$99_b#AL#-aii.Y#ZL#(99lA@P@PQS]a@P@b<b-cik#lL"'))L"9K$L{'8'8"'=$L$LMuV}-K../ Q4	  06J|,"1"199_o#NO/P2 !E\DT!
 x///!..L'44\<P/ I-$
 !& 3 3 5 `f6?3|n=AVV/D/H/HD6Q`am`nIo/p, >R=T=TUZU^U^=_,,\:` .%%*=EZ*Z n  ++0CG\0\<
 ++E
 . !7|nEO
 MbLgLgLi$jDAq%9!%<a%?$j!$j-E/DEE  ]  "!-B$>U.*? ++,A%X\+]mmo 	KFvFG<<\J	K ++,A%+P  \*44DD,-@AB4 	E 	
 8;;;\*::;PY^:_!YY ,; 'C SEx/FvhNhi
 u778 9XXjWkkln 	 	cU %k@s   W,W2T)weights_onlyc                0    t        j                  |d| i|S )zCall torch.load and handle weights_only.

    Defaults to weights_only=True to anticipate upcoming switch on the PyTorch side.

    r   )r   load)r   argskwargss      r   
torch_loadr   '  s     ::tA,A&AAr!   c                   j                  dd      #t        j                  j                  | d         n| }|
t	               }dfd	}dvrt               d<   t        j                  j                  t        j                  j                  |t                    r(t        j                  j                  |t              }d}n7t        j                  j                  t        j                  j                  |t                    r't        j                  j                  |t              }d}nt        j                  j                  r. |d      }j                  dd       	 t        | |fddi}d}nj                  d	d      }	|	j                  d
d      }	 |d      }t        | |j                  dd      j                  dd      |	      }
|
}|
rt        | t        fi }n	 t        | t        fi }|rNt%        t&        j(                  d      r&|t'        j*                  d      k(  rt-        |d      }n.t-        ||      }n t/        |t'        j*                  |            }|s|}|S i }|j1                         D ]  \  }}|j3                  d      rd}n|j3                  d      rd}nt#        d      |j5                  |      }|j1                         D ](  \  }}t7        j8                  |||      \  }}|dkD  s&|} n | | }|||<    |S # t        $ r  |d      }t        | |fddi}d}Y Bw xY w# t         $ r$ t#        d|  d|  dt         dt         d|  d      w xY w)aP  
    A helper method to load the PEFT weights from the HuggingFace Hub or locally

    Args:
        model_id (`str`):
            The local path to the adapter weights or the name of the adapter to load from the HuggingFace Hub.
        device (`str`):
            The device to load the weights onto.
        key_mapping (dict, *optional*, defaults to None)
            Extra mapping of PEFT `state_dict` keys applied before loading the `state_dict`. When this mapping is
            applied, the PEFT-specific `"base_model.model"` prefix is removed beforehand and the adapter name (e.g.
            `"default"`) is not inserted yet. Only pass this argument if you know what you're doing.
        hf_hub_download_kwargs (`dict`):
            Additional arguments to pass to the `hf_hub_download` method when loading from the HuggingFace Hub.
    	subfolderNTc                    | rt         nt        }j                  dd       #t        j                  j                  d   |      S |S )Nr   )r   r   getr   r   r   )use_safetensorsweights_namehf_hub_download_kwargss     r   get_hub_filenamez+load_peft_weights.<locals>.get_hub_filenameK  sK    3B/ &))+t<H GGLL/<lK	
 	
r!   
user_agentF)r   local_files_onlytokenuse_auth_tokenrevision	repo_type)repo_idfilenamer   r   r   zCan't find weights for z in z8 or in the Hugging Face Hub. Please check that the file z or z is present at r1   mpscpu)r   )map_locationzbase_model.model.zbase_model.zAn error occurred while trying to load a PEFT state_dict with key_mapping. This should not happen. Please open an issue on https://github.com/huggingface/peft/issues and report the error.r   )T)r   r   r   r   r   r
   r   r   r   huggingface_hub	constantsHF_HUB_OFFLINEr   r   r   r   r   r   r   r   backendsr   safe_load_filer   rh   ro   r   rS   subn)r   r   key_mappingr   r   r   r  r   hub_filenamer   has_remote_safetensors_fileadapters_weightsremapped_adapters_weightsr   r   r   patternreplacementkey_new	n_replacekey_with_prefixs      `                 r   load_peft_weightsr  0  s   ( "%%k48D 	X5kBC 	 ~
 11/>/@|,	ww~~bggll4)ABC77<<&>?	T<8	977<<l3		"	"	1	1'=""#5t<	$&xoPToXnoH"O '**7D9=*../?FE'=&1!+//
DA,00dC'
# 6&&( )H*8\\E[\ 5>>5)ve9L/L-huE-hvF%hU\\&=QR$4!4 %$- %'!(..0 	=HC~~12,.& w 
 ""6*C(3(9(9(; $%'WWWk3%G"q=!C "(.O9<%o6'	=* %$Q ' 	$ ,EBL&xoPToXnoH#O	$> &  -hZtH: F22>tD\C]]lmulvvwy s   #L +M #L?>L?-M/)NdefaultFr]   )F)r%   ztorch.nn.Moduler   dict[str, torch.Tensor]r   boolreturnzRtuple[dict[str, torch.Tensor], list[tuple[str, tuple[int, ...], tuple[int, ...]]]])rb   r  r   r   r   r   r  r  )r  FF)r   r  r   r  )NN)r   r   r   zOptional[str]r  zOptional[dict[str, str]]r  dict)*
__future__r   r   rx   rS   rz   typingr   r  r   r   r   huggingface_hub.errorsr   r   safetensors.torchr	   r
  transformers.utilsr
   peft.mappingr   r  r   otherr   r   r   r   r   r   r   
peft_typesr   r    r)   r   r   r   r   r   r  r   r!   r   <module>r$     s   # 	  	     8 N 9 . 4 6   !p
 bhGV mr--3J-ei-W-8!'!7:!NQ!!, $)#q "	q
 qj $( B Z^{%{%({%>V{%	{%r!   