import{s as na,o as sa,n as oa}from"../chunks/scheduler.78382b47.js";import{S as la,i as da,e as n,s as r,c as u,h as ia,a as s,d as o,b as a,f as _,g as c,j as i,k as b,l as e,m as T,n as m,t as g,o as f,p as h}from"../chunks/index.6dd35eb6.js";import{C as pa,H as yr,E as ua}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8d7e60c0.js";import{D as x}from"../chunks/Docstring.57cb1354.js";import{C as ca}from"../chunks/CodeBlock.4d4112a9.js";import{E as ma}from"../chunks/ExampleCodeBlock.7440be11.js";function ga(dt){let y,X="Example:",k,B,L;return B=new ca({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBZnJvbSUyMHBlZnQlMjBpbXBvcnQlMjBQZWZ0TW9kZWwlMEElMEFtb2RlbF9pZCUyMCUzRCUyMC4uLiUwQWJhc2VfbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBcGVmdF9tb2RlbF9pZCUyMCUzRCUyMC4uLiUwQW1vZGVsJTIwJTNEJTIwUGVmdE1vZGVsLmZyb21fcHJldHJhaW5lZChiYXNlX21vZGVsJTJDJTIwcGVmdF9tb2RlbF9pZCklMEFtZXJnZWRfbW9kZWwlMjAlM0QlMjBtb2RlbC5tZXJnZV9hbmRfdW5sb2FkKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> peft <span class="hljs-keyword">import</span> PeftModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>base_model = AutoModelForCausalLM.from_pretrained(model_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>peft_model_id = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PeftModel.from_pretrained(base_model, peft_model_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>merged_model = model.merge_and_unload()`,wrap:!1}}),{c(){y=n("p"),y.textContent=X,k=r(),u(B.$$.fragment)},l(v){y=s(v,"P",{"data-svelte-h":!0}),i(y)!=="svelte-11lpom8"&&(y.textContent=X),k=a(v),c(B.$$.fragment,v)},m(v,P){T(v,y,P),T(v,k,P),m(B,v,P),L=!0},p:oa,i(v){L||(g(B.$$.fragment,v),L=!0)},o(v){f(B.$$.fragment,v),L=!1},d(v){v&&(o(y),o(k)),h(B,v)}}}function fa(dt){let y,X,k,B,L,v,P,it,Q,Tr="A tuner (or adapter) is a module that can be plugged into a <code>torch.nn.Module</code>. <code>BaseTuner</code> base class for other tuners and provides shared methods and attributes for preparing an adapter configuration and replacing a target module with the adapter module. <code>BaseTunerLayer</code> is a base class for adapter layers. It offers methods and attributes for managing adapters such as activating and disabling adapters.",pt,O,ut,l,Y,Ct,ve,Cr=`A base tuner model that provides the common methods and attributes for all tuners that are injectable into a
torch.nn.Module`,wt,$e,wr="For adding a new Tuner class, one needs to overwrite the following methods:",Bt,xe,Br=`<li><strong>_prepare_adapter_config</strong>:
A private method to eventually prepare the adapter config, for example in case the field <code>target_modules</code> is
missing.</li> <li><strong>_create_and_replace</strong>:
A private method to create and replace the target module with the adapter module.</li> <li><strong>_check_target_module_exists</strong>:
A private helper method to check if the passed module’s key name matches any of the target modules in the
adapter_config.</li>`,Lt,ye,Lr="The easiest is to check what is done in the <code>peft.tuners.lora.LoraModel</code> class.",Mt,N,K,Pt,Te,Mr="Deletes an existing adapter.",kt,D,ee,Dt,Ce,Pr="Disable all adapters in-place.",Et,we,kr="When disabling all adapters, the model output corresponds to the output of the base model.",qt,H,te,jt,Be,Dr="Enable all adapters in-place",Ft,U,re,It,Le,Er=`This method gets the config from a model in dictionary form. If model has not attribute config, then this
method returns a default config.`,Wt,E,ae,Vt,Me,qr=`Creates adapter layers and replaces the target modules with the adapter layers. This method is called under the
hood by <code>peft.mapping.get_peft_model</code> if a non-prompt tuning adapter class is passed.`,Zt,Pe,jr="The corresponding PEFT config is directly retrieved from the <code>peft_config</code> attribute of the BaseTuner class.",Nt,q,ne,Ht,ke,Fr="This method merges the adapter layers into the base model.",Ut,De,Ir=`Merging adapters can lead to a speed up of the forward pass. A copy of the adapter weights is still kept in
memory, which is required to unmerge the adapters. In order to merge the adapter weights without keeping them
in memory, please call <code>merge_and_unload</code>.`,At,C,se,Jt,Ee,Wr="This method merges the adapter layers into the base model.",Rt,qe,Vr=`This is needed if someone wants to use the base model as a standalone model. The returned model has the same
architecture as the original base model.`,St,je,Zr="It is important to assign the returned model to a variable and use it, this is not an in-place operation!",Gt,A,zt,J,oe,Xt,Fe,Nr="Set the active adapter(s).",Qt,j,le,Ot,Ie,Hr="Sets the active adapter(s) on auxiliary modules.",Yt,We,Ur=`If the subclass (e.g. <code>LoraModel</code>) supports auxiliary modules like <code>modules_to_save</code>, it should call this
method in <code>set_adapter</code> to ensure that those auxiliary modules are being set correctly.`,Kt,R,de,er,Ve,Ar="Enable or disable gradients on the given adapter(s).",tr,F,ie,rr,Ze,Jr="Return the base model by removing all the PEFT modules.",ar,Ne,Rr="It is important to assign the returned model to a variable and use it, this is not an in-place operation!",nr,S,pe,sr,He,Sr="This method unmerges all merged adapter layers from the base model.",ct,ue,mt,$,ce,or,Ue,Gr="A tuner layer mixin that provides the common methods and attributes for all tuners.",lr,M,me,dr,Ae,zr="Delete an adapter from the layer",ir,Je,Xr="This should be called on all adapter layers, or else we will get an inconsistent state.",pr,Re,Qr=`This method will also set a new active adapter if the deleted adapter was an active adapter. It is important
that the new adapter is chosen in a deterministic way, so that the same adapter is chosen on all layers.`,ur,I,ge,cr,Se,Or="Toggle the enabling and disabling of adapters",mr,Ge,Yr="Takes care of setting the requires_grad flag for the adapter weights.",gr,W,fe,fr,ze,Kr="(Recursively) get the base_layer.",hr,Xe,ea="This is necessary for the case that the tuner layer wraps another tuner layer.",_r,V,he,br,Qe,ta="Set the active adapter(s).",vr,Oe,ra=`Additionally, this function will set the specified adapter to trainable (i.e., requires_grad=True) unless
inference_mode is True.`,$r,G,_e,xr,Ye,aa="Enable or disable gradients on the given adapter(s).",gt,be,ft,lt,ht;return L=new pa({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),P=new yr({props:{title:"Tuners",local:"tuners",headingTag:"h1"}}),O=new yr({props:{title:"BaseTuner",local:"peft.tuners.tuners_utils.BaseTuner",headingTag:"h2"}}),Y=new x({props:{name:"class peft.tuners.tuners_utils.BaseTuner",anchor:"peft.tuners.tuners_utils.BaseTuner",parameters:[{name:"model",val:""},{name:"peft_config",val:": Union[PeftConfig, dict[str, PeftConfig]]"},{name:"adapter_name",val:": str"},{name:"low_cpu_mem_usage",val:": bool = False"},{name:"state_dict",val:": Optional[dict[str, torch.Tensor]] = None"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
The model to which the adapter tuner layers will be attached.`,name:"model"},{anchor:"peft.tuners.tuners_utils.BaseTuner.forward",description:`<strong>forward</strong> (<code>Callable</code>) &#x2014;
The forward method of the model.`,name:"forward"},{anchor:"peft.tuners.tuners_utils.BaseTuner.peft_config",description:`<strong>peft_config</strong> (<code>Union[</code>PeftConfig<code>, dict[str, PeftConfig]]</code>) &#x2014;
The adapter configuration object, it should be a dictionary of <code>str</code> to <code>PeftConfig</code> objects. One can also
pass a PeftConfig object and a new adapter will be created with the default name <code>adapter</code> or create a new
dictionary with a key <code>adapter_name</code> and a value of that peft config.`,name:"peft_config"},{anchor:"peft.tuners.tuners_utils.BaseTuner.config",description:`<strong>config</strong> (<code>dict[str, Any]</code>) &#x2014;
The model configuration object, it should be a dictionary of <code>str</code> to <code>Any</code> objects.`,name:"config"},{anchor:"peft.tuners.tuners_utils.BaseTuner.targeted_module_names",description:`<strong>targeted_module_names</strong> (<code>list[str]</code>) &#x2014;
The list of module names that were actually adapted. Can be useful to inspect if you want to quickly
double-check that the <code>config.target_modules</code> were specified correctly.`,name:"targeted_module_names"},{anchor:"peft.tuners.tuners_utils.BaseTuner.targeted_parameter_names",description:`<strong>targeted_parameter_names</strong> (<code>list[str]</code>) &#x2014;
The list of parameter names that were actually adapted. Can be useful to inspect if you want to quickly
double-check that the <code>config.target_parameters</code> were specified correctly.`,name:"targeted_parameter_names"},{anchor:"peft.tuners.tuners_utils.BaseTuner.prefix",description:`<strong>prefix</strong> (<code>str</code>) &#x2014;
The PEFT-method specific unique prefix. E.g. <code>&quot;lora_&quot;</code> for LoRA.`,name:"prefix"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L212"}}),K=new x({props:{name:"delete_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.delete_adapter",parameters:[{name:"adapter_name",val:": str"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.delete_adapter.adapter_name",description:"<strong>adapter_name</strong> (str) &#x2014; Name of the adapter to be deleted.",name:"adapter_name"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L472"}}),ee=new x({props:{name:"disable_adapter_layers",anchor:"peft.tuners.tuners_utils.BaseTuner.disable_adapter_layers",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L448"}}),te=new x({props:{name:"enable_adapter_layers",anchor:"peft.tuners.tuners_utils.BaseTuner.enable_adapter_layers",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L465"}}),re=new x({props:{name:"get_model_config",anchor:"peft.tuners.tuners_utils.BaseTuner.get_model_config",parameters:[{name:"model",val:": nn.Module"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.get_model_config.model",description:`<strong>model</strong> (<code>nn.Module</code>) &#x2014;
Model to get the config from.`,name:"model"},{anchor:"peft.tuners.tuners_utils.BaseTuner.get_model_config.default",description:`<strong>default</strong> (<code>dict|None</code>, <em>optional</em>) &#x2014;:
What to return if model does not have a config attribute.`,name:"default"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1142"}}),ae=new x({props:{name:"inject_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter",parameters:[{name:"model",val:": nn.Module"},{name:"adapter_name",val:": str"},{name:"autocast_adapter_dtype",val:": bool = True"},{name:"low_cpu_mem_usage",val:": bool = False"},{name:"state_dict",val:": Optional[dict[str, torch.Tensor]] = None"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter.model",description:`<strong>model</strong> (<code>nn.Module</code>) &#x2014;
The model to be tuned.`,name:"model"},{anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code>) &#x2014;
The adapter name.`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter.autocast_adapter_dtype",description:`<strong>autocast_adapter_dtype</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to autocast the adapter dtype. Defaults to <code>True</code>.`,name:"autocast_adapter_dtype"},{anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter.low_cpu_mem_usage",description:`<strong>low_cpu_mem_usage</strong> (<code>bool</code>, <code>optional</code>, defaults to <code>False</code>) &#x2014;
Create empty adapter weights on meta device. Useful to speed up the loading process.`,name:"low_cpu_mem_usage"},{anchor:"peft.tuners.tuners_utils.BaseTuner.inject_adapter.state_dict",description:`<strong>state_dict</strong> (<code>dict</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
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 <code>target_modules</code> 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.`,name:"state_dict"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L664"}}),ne=new x({props:{name:"merge_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.merge_adapter",parameters:[{name:"adapter_names",val:": Optional[list[str]] = None"},{name:"safe_merge",val:": bool = False"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_adapter.adapter_names",description:`<strong>adapter_names</strong> (<code>list[str]</code>, <em>optional</em>) &#x2014;
The list of adapter names that should be merged. If <code>None</code>, all active adapters will be merged.
Defaults to <code>None</code>.`,name:"adapter_names"},{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_adapter.safe_merge",description:`<strong>safe_merge</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If <code>True</code>, the merge operation will be performed in a copy of the original weights and check for NaNs
before merging the weights. This is useful if you want to check if the merge operation will produce
NaNs. Defaults to <code>False</code>.`,name:"safe_merge"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1075"}}),se=new x({props:{name:"merge_and_unload",anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload",parameters:[{name:"progressbar",val:": bool = False"},{name:"safe_merge",val:": bool = False"},{name:"adapter_names",val:": Optional[list[str]] = None"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload.progressbar",description:`<strong>progressbar</strong> (<code>bool</code>) &#x2014;
whether to show a progressbar indicating the unload and merge process (default: False).`,name:"progressbar"},{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload.safe_merge",description:`<strong>safe_merge</strong> (<code>bool</code>) &#x2014;
whether to activate the safe merging check to check if there is any potential Nan in the adapter
weights.`,name:"safe_merge"},{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload.adapter_names",description:`<strong>adapter_names</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
The list of adapter names that should be merged. If None, all active adapters will be merged. Defaults
to <code>None</code>.`,name:"adapter_names"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L607"}}),A=new ma({props:{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload.example",$$slots:{default:[ga]},$$scope:{ctx:dt}}}),oe=new x({props:{name:"set_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.set_adapter",parameters:[{name:"adapter_name",val:": str | list[str]"},{name:"inference_mode",val:": bool = False"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.set_adapter.adapter_name",description:`<strong>adapter_name</strong> (str, list[str]) &#x2014;
The name(s) of the adapter(s) to set as active`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTuner.set_adapter.inference_mode",description:`<strong>inference_mode</strong> (bool, optional) &#x2014;
Whether the activated adapter should be frozen (i.e. <code>requires_grad=False</code>). Default is False.`,name:"inference_mode"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1128"}}),le=new x({props:{name:"set_auxiliary_adapters",anchor:"peft.tuners.tuners_utils.BaseTuner.set_auxiliary_adapters",parameters:[{name:"adapter_name",val:": str | list[str]"},{name:"inference_mode",val:": bool"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.set_auxiliary_adapters.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code> or <code>list[str]</code>) &#x2014;
The name(s) of the adapter(s) to be set as active. The adapters must be loaded first.`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTuner.set_auxiliary_adapters.inference_mode",description:`<strong>inference_mode</strong> (bool, optional) &#x2014;
Whether the activated adapter should be frozen (i.e. <code>requires_grad=False</code>). Default is False.`,name:"inference_mode"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1113"}}),de=new x({props:{name:"set_requires_grad",anchor:"peft.tuners.tuners_utils.BaseTuner.set_requires_grad",parameters:[{name:"adapter_names",val:": str | Sequence[str]"},{name:"requires_grad",val:": bool = True"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTuner.set_requires_grad.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code> or <code>Sequence[str]</code>) &#x2014;
The name of the adapter(s) whose gradients should be enabled/disabled.`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTuner.set_requires_grad.requires_grad",description:`<strong>requires_grad</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable (<code>True</code>, default) or disable (<code>False</code>).`,name:"requires_grad"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L488"}}),ie=new x({props:{name:"unload",anchor:"peft.tuners.tuners_utils.BaseTuner.unload",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L645"}}),pe=new x({props:{name:"unmerge_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.unmerge_adapter",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1104"}}),ue=new yr({props:{title:"BaseTunerLayer",local:"peft.tuners.tuners_utils.BaseTunerLayer",headingTag:"h2"}}),ce=new x({props:{name:"class peft.tuners.tuners_utils.BaseTunerLayer",anchor:"peft.tuners.tuners_utils.BaseTunerLayer",parameters:[],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.is_pluggable",description:`<strong>is_pluggable</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether the adapter layer can be plugged to any pytorch module`,name:"is_pluggable"},{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.active_adapters",description:`<strong>active_adapters</strong> (Union[List<code>str</code>, <code>str</code>], <em>optional</em>) &#x2014;
The name of the active adapter.`,name:"active_adapters"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1263"}}),me=new x({props:{name:"delete_adapter",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.delete_adapter",parameters:[{name:"adapter_name",val:": str"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.delete_adapter.adapter_name",description:"<strong>adapter_name</strong> (<code>str</code>) &#x2014; The name of the adapter to delete",name:"adapter_name"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1452"}}),ge=new x({props:{name:"enable_adapters",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.enable_adapters",parameters:[{name:"enabled",val:": bool"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.enable_adapters.enabled",description:"<strong>enabled</strong> (bool) &#x2014; True to enable adapters, False to disable adapters",name:"enabled"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1395"}}),fe=new x({props:{name:"get_base_layer",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.get_base_layer",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1288"}}),he=new x({props:{name:"set_adapter",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_adapter",parameters:[{name:"adapter_names",val:": str | list[str]"},{name:"inference_mode",val:": bool = False"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_adapter.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code> or <code>list[str]</code>) &#x2014;
The name(s) of the adapter(s) to set as active.`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_adapter.inference_mode",description:`<strong>inference_mode</strong> (bool, optional) &#x2014;
Whether the activated adapter should be frozen (i.e. <code>requires_grad=False</code>). Default is False.`,name:"inference_mode"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1413"}}),_e=new x({props:{name:"set_requires_grad",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_requires_grad",parameters:[{name:"adapter_names",val:": str | Sequence[str]"},{name:"requires_grad",val:": bool = True"}],parametersDescription:[{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_requires_grad.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code> or <code>Sequence[str]</code>) &#x2014;
The name of the adapter(s) whose gradients should be enabled/disabled.`,name:"adapter_name"},{anchor:"peft.tuners.tuners_utils.BaseTunerLayer.set_requires_grad.requires_grad",description:`<strong>requires_grad</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to enable (<code>True</code>, default) or disable (<code>False</code>).`,name:"requires_grad"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/tuners/tuners_utils.py#L1489"}}),be=new ua({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/tuners.md"}}),{c(){y=n("meta"),X=r(),k=n("p"),B=r(),u(L.$$.fragment),v=r(),u(P.$$.fragment),it=r(),Q=n("p"),Q.innerHTML=Tr,pt=r(),u(O.$$.fragment),ut=r(),l=n("div"),u(Y.$$.fragment),Ct=r(),ve=n("p"),ve.textContent=Cr,wt=r(),$e=n("p"),$e.textContent=wr,Bt=r(),xe=n("ul"),xe.innerHTML=Br,Lt=r(),ye=n("p"),ye.innerHTML=Lr,Mt=r(),N=n("div"),u(K.$$.fragment),Pt=r(),Te=n("p"),Te.textContent=Mr,kt=r(),D=n("div"),u(ee.$$.fragment),Dt=r(),Ce=n("p"),Ce.textContent=Pr,Et=r(),we=n("p"),we.textContent=kr,qt=r(),H=n("div"),u(te.$$.fragment),jt=r(),Be=n("p"),Be.textContent=Dr,Ft=r(),U=n("div"),u(re.$$.fragment),It=r(),Le=n("p"),Le.textContent=Er,Wt=r(),E=n("div"),u(ae.$$.fragment),Vt=r(),Me=n("p"),Me.innerHTML=qr,Zt=r(),Pe=n("p"),Pe.innerHTML=jr,Nt=r(),q=n("div"),u(ne.$$.fragment),Ht=r(),ke=n("p"),ke.textContent=Fr,Ut=r(),De=n("p"),De.innerHTML=Ir,At=r(),C=n("div"),u(se.$$.fragment),Jt=r(),Ee=n("p"),Ee.textContent=Wr,Rt=r(),qe=n("p"),qe.textContent=Vr,St=r(),je=n("p"),je.textContent=Zr,Gt=r(),u(A.$$.fragment),zt=r(),J=n("div"),u(oe.$$.fragment),Xt=r(),Fe=n("p"),Fe.textContent=Nr,Qt=r(),j=n("div"),u(le.$$.fragment),Ot=r(),Ie=n("p"),Ie.textContent=Hr,Yt=r(),We=n("p"),We.innerHTML=Ur,Kt=r(),R=n("div"),u(de.$$.fragment),er=r(),Ve=n("p"),Ve.textContent=Ar,tr=r(),F=n("div"),u(ie.$$.fragment),rr=r(),Ze=n("p"),Ze.textContent=Jr,ar=r(),Ne=n("p"),Ne.textContent=Rr,nr=r(),S=n("div"),u(pe.$$.fragment),sr=r(),He=n("p"),He.textContent=Sr,ct=r(),u(ue.$$.fragment),mt=r(),$=n("div"),u(ce.$$.fragment),or=r(),Ue=n("p"),Ue.textContent=Gr,lr=r(),M=n("div"),u(me.$$.fragment),dr=r(),Ae=n("p"),Ae.textContent=zr,ir=r(),Je=n("p"),Je.textContent=Xr,pr=r(),Re=n("p"),Re.textContent=Qr,ur=r(),I=n("div"),u(ge.$$.fragment),cr=r(),Se=n("p"),Se.textContent=Or,mr=r(),Ge=n("p"),Ge.textContent=Yr,gr=r(),W=n("div"),u(fe.$$.fragment),fr=r(),ze=n("p"),ze.textContent=Kr,hr=r(),Xe=n("p"),Xe.textContent=ea,_r=r(),V=n("div"),u(he.$$.fragment),br=r(),Qe=n("p"),Qe.textContent=ta,vr=r(),Oe=n("p"),Oe.textContent=ra,$r=r(),G=n("div"),u(_e.$$.fragment),xr=r(),Ye=n("p"),Ye.textContent=aa,gt=r(),u(be.$$.fragment),ft=r(),lt=n("p"),this.h()},l(t){const p=ia("svelte-u9bgzb",document.head);y=s(p,"META",{name:!0,content:!0}),p.forEach(o),X=a(t),k=s(t,"P",{}),_(k).forEach(o),B=a(t),c(L.$$.fragment,t),v=a(t),c(P.$$.fragment,t),it=a(t),Q=s(t,"P",{"data-svelte-h":!0}),i(Q)!=="svelte-dsnslo"&&(Q.innerHTML=Tr),pt=a(t),c(O.$$.fragment,t),ut=a(t),l=s(t,"DIV",{class:!0});var d=_(l);c(Y.$$.fragment,d),Ct=a(d),ve=s(d,"P",{"data-svelte-h":!0}),i(ve)!=="svelte-1k0hvlq"&&(ve.textContent=Cr),wt=a(d),$e=s(d,"P",{"data-svelte-h":!0}),i($e)!=="svelte-fkgwsm"&&($e.textContent=wr),Bt=a(d),xe=s(d,"UL",{"data-svelte-h":!0}),i(xe)!=="svelte-uumdnf"&&(xe.innerHTML=Br),Lt=a(d),ye=s(d,"P",{"data-svelte-h":!0}),i(ye)!=="svelte-1sc4mfu"&&(ye.innerHTML=Lr),Mt=a(d),N=s(d,"DIV",{class:!0});var _t=_(N);c(K.$$.fragment,_t),Pt=a(_t),Te=s(_t,"P",{"data-svelte-h":!0}),i(Te)!=="svelte-1cw64z1"&&(Te.textContent=Mr),_t.forEach(o),kt=a(d),D=s(d,"DIV",{class:!0});var Ke=_(D);c(ee.$$.fragment,Ke),Dt=a(Ke),Ce=s(Ke,"P",{"data-svelte-h":!0}),i(Ce)!=="svelte-1hrol74"&&(Ce.textContent=Pr),Et=a(Ke),we=s(Ke,"P",{"data-svelte-h":!0}),i(we)!=="svelte-1ecn6m6"&&(we.textContent=kr),Ke.forEach(o),qt=a(d),H=s(d,"DIV",{class:!0});var bt=_(H);c(te.$$.fragment,bt),jt=a(bt),Be=s(bt,"P",{"data-svelte-h":!0}),i(Be)!=="svelte-1l6xdbj"&&(Be.textContent=Dr),bt.forEach(o),Ft=a(d),U=s(d,"DIV",{class:!0});var vt=_(U);c(re.$$.fragment,vt),It=a(vt),Le=s(vt,"P",{"data-svelte-h":!0}),i(Le)!=="svelte-wp66wq"&&(Le.textContent=Er),vt.forEach(o),Wt=a(d),E=s(d,"DIV",{class:!0});var et=_(E);c(ae.$$.fragment,et),Vt=a(et),Me=s(et,"P",{"data-svelte-h":!0}),i(Me)!=="svelte-1ybn6sj"&&(Me.innerHTML=qr),Zt=a(et),Pe=s(et,"P",{"data-svelte-h":!0}),i(Pe)!=="svelte-fvf2kw"&&(Pe.innerHTML=jr),et.forEach(o),Nt=a(d),q=s(d,"DIV",{class:!0});var tt=_(q);c(ne.$$.fragment,tt),Ht=a(tt),ke=s(tt,"P",{"data-svelte-h":!0}),i(ke)!=="svelte-kun7ud"&&(ke.textContent=Fr),Ut=a(tt),De=s(tt,"P",{"data-svelte-h":!0}),i(De)!=="svelte-1f1s101"&&(De.innerHTML=Ir),tt.forEach(o),At=a(d),C=s(d,"DIV",{class:!0});var Z=_(C);c(se.$$.fragment,Z),Jt=a(Z),Ee=s(Z,"P",{"data-svelte-h":!0}),i(Ee)!=="svelte-kun7ud"&&(Ee.textContent=Wr),Rt=a(Z),qe=s(Z,"P",{"data-svelte-h":!0}),i(qe)!=="svelte-1xvyps2"&&(qe.textContent=Vr),St=a(Z),je=s(Z,"P",{"data-svelte-h":!0}),i(je)!=="svelte-1t73dx4"&&(je.textContent=Zr),Gt=a(Z),c(A.$$.fragment,Z),Z.forEach(o),zt=a(d),J=s(d,"DIV",{class:!0});var $t=_(J);c(oe.$$.fragment,$t),Xt=a($t),Fe=s($t,"P",{"data-svelte-h":!0}),i(Fe)!=="svelte-8teaja"&&(Fe.textContent=Nr),$t.forEach(o),Qt=a(d),j=s(d,"DIV",{class:!0});var rt=_(j);c(le.$$.fragment,rt),Ot=a(rt),Ie=s(rt,"P",{"data-svelte-h":!0}),i(Ie)!=="svelte-4dpw8p"&&(Ie.textContent=Hr),Yt=a(rt),We=s(rt,"P",{"data-svelte-h":!0}),i(We)!=="svelte-y2ktyw"&&(We.innerHTML=Ur),rt.forEach(o),Kt=a(d),R=s(d,"DIV",{class:!0});var xt=_(R);c(de.$$.fragment,xt),er=a(xt),Ve=s(xt,"P",{"data-svelte-h":!0}),i(Ve)!=="svelte-aqtirv"&&(Ve.textContent=Ar),xt.forEach(o),tr=a(d),F=s(d,"DIV",{class:!0});var at=_(F);c(ie.$$.fragment,at),rr=a(at),Ze=s(at,"P",{"data-svelte-h":!0}),i(Ze)!=="svelte-5oaxgp"&&(Ze.textContent=Jr),ar=a(at),Ne=s(at,"P",{"data-svelte-h":!0}),i(Ne)!=="svelte-1t73dx4"&&(Ne.textContent=Rr),at.forEach(o),nr=a(d),S=s(d,"DIV",{class:!0});var yt=_(S);c(pe.$$.fragment,yt),sr=a(yt),He=s(yt,"P",{"data-svelte-h":!0}),i(He)!=="svelte-2eloeq"&&(He.textContent=Sr),yt.forEach(o),d.forEach(o),ct=a(t),c(ue.$$.fragment,t),mt=a(t),$=s(t,"DIV",{class:!0});var w=_($);c(ce.$$.fragment,w),or=a(w),Ue=s(w,"P",{"data-svelte-h":!0}),i(Ue)!=="svelte-1fdxdjn"&&(Ue.textContent=Gr),lr=a(w),M=s(w,"DIV",{class:!0});var z=_(M);c(me.$$.fragment,z),dr=a(z),Ae=s(z,"P",{"data-svelte-h":!0}),i(Ae)!=="svelte-950rwb"&&(Ae.textContent=zr),ir=a(z),Je=s(z,"P",{"data-svelte-h":!0}),i(Je)!=="svelte-1nnxg1l"&&(Je.textContent=Xr),pr=a(z),Re=s(z,"P",{"data-svelte-h":!0}),i(Re)!=="svelte-1vxxy19"&&(Re.textContent=Qr),z.forEach(o),ur=a(w),I=s(w,"DIV",{class:!0});var nt=_(I);c(ge.$$.fragment,nt),cr=a(nt),Se=s(nt,"P",{"data-svelte-h":!0}),i(Se)!=="svelte-2or2k8"&&(Se.textContent=Or),mr=a(nt),Ge=s(nt,"P",{"data-svelte-h":!0}),i(Ge)!=="svelte-ujp0ui"&&(Ge.textContent=Yr),nt.forEach(o),gr=a(w),W=s(w,"DIV",{class:!0});var st=_(W);c(fe.$$.fragment,st),fr=a(st),ze=s(st,"P",{"data-svelte-h":!0}),i(ze)!=="svelte-6rdpda"&&(ze.textContent=Kr),hr=a(st),Xe=s(st,"P",{"data-svelte-h":!0}),i(Xe)!=="svelte-dptqqh"&&(Xe.textContent=ea),st.forEach(o),_r=a(w),V=s(w,"DIV",{class:!0});var ot=_(V);c(he.$$.fragment,ot),br=a(ot),Qe=s(ot,"P",{"data-svelte-h":!0}),i(Qe)!=="svelte-8teaja"&&(Qe.textContent=ta),vr=a(ot),Oe=s(ot,"P",{"data-svelte-h":!0}),i(Oe)!=="svelte-1020tdh"&&(Oe.textContent=ra),ot.forEach(o),$r=a(w),G=s(w,"DIV",{class:!0});var Tt=_(G);c(_e.$$.fragment,Tt),xr=a(Tt),Ye=s(Tt,"P",{"data-svelte-h":!0}),i(Ye)!=="svelte-aqtirv"&&(Ye.textContent=aa),Tt.forEach(o),w.forEach(o),gt=a(t),c(be.$$.fragment,t),ft=a(t),lt=s(t,"P",{}),_(lt).forEach(o),this.h()},h(){b(y,"name","hf:doc:metadata"),b(y,"content",ha),b(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(l,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,y),T(t,X,p),T(t,k,p),T(t,B,p),m(L,t,p),T(t,v,p),m(P,t,p),T(t,it,p),T(t,Q,p),T(t,pt,p),m(O,t,p),T(t,ut,p),T(t,l,p),m(Y,l,null),e(l,Ct),e(l,ve),e(l,wt),e(l,$e),e(l,Bt),e(l,xe),e(l,Lt),e(l,ye),e(l,Mt),e(l,N),m(K,N,null),e(N,Pt),e(N,Te),e(l,kt),e(l,D),m(ee,D,null),e(D,Dt),e(D,Ce),e(D,Et),e(D,we),e(l,qt),e(l,H),m(te,H,null),e(H,jt),e(H,Be),e(l,Ft),e(l,U),m(re,U,null),e(U,It),e(U,Le),e(l,Wt),e(l,E),m(ae,E,null),e(E,Vt),e(E,Me),e(E,Zt),e(E,Pe),e(l,Nt),e(l,q),m(ne,q,null),e(q,Ht),e(q,ke),e(q,Ut),e(q,De),e(l,At),e(l,C),m(se,C,null),e(C,Jt),e(C,Ee),e(C,Rt),e(C,qe),e(C,St),e(C,je),e(C,Gt),m(A,C,null),e(l,zt),e(l,J),m(oe,J,null),e(J,Xt),e(J,Fe),e(l,Qt),e(l,j),m(le,j,null),e(j,Ot),e(j,Ie),e(j,Yt),e(j,We),e(l,Kt),e(l,R),m(de,R,null),e(R,er),e(R,Ve),e(l,tr),e(l,F),m(ie,F,null),e(F,rr),e(F,Ze),e(F,ar),e(F,Ne),e(l,nr),e(l,S),m(pe,S,null),e(S,sr),e(S,He),T(t,ct,p),m(ue,t,p),T(t,mt,p),T(t,$,p),m(ce,$,null),e($,or),e($,Ue),e($,lr),e($,M),m(me,M,null),e(M,dr),e(M,Ae),e(M,ir),e(M,Je),e(M,pr),e(M,Re),e($,ur),e($,I),m(ge,I,null),e(I,cr),e(I,Se),e(I,mr),e(I,Ge),e($,gr),e($,W),m(fe,W,null),e(W,fr),e(W,ze),e(W,hr),e(W,Xe),e($,_r),e($,V),m(he,V,null),e(V,br),e(V,Qe),e(V,vr),e(V,Oe),e($,$r),e($,G),m(_e,G,null),e(G,xr),e(G,Ye),T(t,gt,p),m(be,t,p),T(t,ft,p),T(t,lt,p),ht=!0},p(t,[p]){const d={};p&2&&(d.$$scope={dirty:p,ctx:t}),A.$set(d)},i(t){ht||(g(L.$$.fragment,t),g(P.$$.fragment,t),g(O.$$.fragment,t),g(Y.$$.fragment,t),g(K.$$.fragment,t),g(ee.$$.fragment,t),g(te.$$.fragment,t),g(re.$$.fragment,t),g(ae.$$.fragment,t),g(ne.$$.fragment,t),g(se.$$.fragment,t),g(A.$$.fragment,t),g(oe.$$.fragment,t),g(le.$$.fragment,t),g(de.$$.fragment,t),g(ie.$$.fragment,t),g(pe.$$.fragment,t),g(ue.$$.fragment,t),g(ce.$$.fragment,t),g(me.$$.fragment,t),g(ge.$$.fragment,t),g(fe.$$.fragment,t),g(he.$$.fragment,t),g(_e.$$.fragment,t),g(be.$$.fragment,t),ht=!0)},o(t){f(L.$$.fragment,t),f(P.$$.fragment,t),f(O.$$.fragment,t),f(Y.$$.fragment,t),f(K.$$.fragment,t),f(ee.$$.fragment,t),f(te.$$.fragment,t),f(re.$$.fragment,t),f(ae.$$.fragment,t),f(ne.$$.fragment,t),f(se.$$.fragment,t),f(A.$$.fragment,t),f(oe.$$.fragment,t),f(le.$$.fragment,t),f(de.$$.fragment,t),f(ie.$$.fragment,t),f(pe.$$.fragment,t),f(ue.$$.fragment,t),f(ce.$$.fragment,t),f(me.$$.fragment,t),f(ge.$$.fragment,t),f(fe.$$.fragment,t),f(he.$$.fragment,t),f(_e.$$.fragment,t),f(be.$$.fragment,t),ht=!1},d(t){t&&(o(X),o(k),o(B),o(v),o(it),o(Q),o(pt),o(ut),o(l),o(ct),o(mt),o($),o(gt),o(ft),o(lt)),o(y),h(L,t),h(P,t),h(O,t),h(Y),h(K),h(ee),h(te),h(re),h(ae),h(ne),h(se),h(A),h(oe),h(le),h(de),h(ie),h(pe),h(ue,t),h(ce),h(me),h(ge),h(fe),h(he),h(_e),h(be,t)}}}const ha='{"title":"Tuners","local":"tuners","sections":[{"title":"BaseTuner","local":"peft.tuners.tuners_utils.BaseTuner","sections":[],"depth":2},{"title":"BaseTunerLayer","local":"peft.tuners.tuners_utils.BaseTunerLayer","sections":[],"depth":2}],"depth":1}';function _a(dt){return sa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ca extends la{constructor(y){super(),da(this,y,_a,fa,na,{})}}export{Ca as component};
