Buckets:

HuggingFaceDocBuilder's picture
download
raw
34.8 kB
import{s as ga,o as fa,n as ha}from"../chunks/scheduler.78382b47.js";import{S as _a,i as ba,e as n,s as r,c as p,h as va,a as s,d as o,b as a,f as _,g as u,j as d,k as b,l as e,m as T,n as c,t as m,o as g,p as f}from"../chunks/index.6dd35eb6.js";import{C as $a,H as kr,E as xa}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8259e816.js";import{D as $}from"../chunks/Docstring.a33db07d.js";import{C as ya}from"../chunks/CodeBlock.92738f97.js";import{E as Ta}from"../chunks/ExampleCodeBlock.2077b698.js";function Ca(mt){let y,Q="Example:",k,B,L;return B=new ya({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()`,lang:"py",wrap:!1}}),{c(){y=n("p"),y.textContent=Q,k=r(),p(B.$$.fragment)},l(x){y=s(x,"P",{"data-svelte-h":!0}),d(y)!=="svelte-11lpom8"&&(y.textContent=Q),k=a(x),u(B.$$.fragment,x)},m(x,M){T(x,y,M),T(x,k,M),c(B,x,M),L=!0},p:ha,i(x){L||(m(B.$$.fragment,x),L=!0)},o(x){g(B.$$.fragment,x),L=!1},d(x){x&&(o(y),o(k)),f(B,x)}}}function wa(mt){let y,Q,k,B,L,x,M,gt,O,Er="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.",ft,Y,ht,l,K,Mt,xe,Dr=`A base tuner model that provides the common methods and attributes for all tuners that are injectable into a
torch.nn.Module`,kt,ye,jr="For adding a new Tuner class, one needs to overwrite the following methods:",Et,Te,qr=`<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>`,Dt,Ce,Wr="The easiest is to check what is done in the <code>peft.tuners.lora.LoraModel</code> class.",jt,U,ee,qt,we,Fr="Deletes an existing adapter.",Wt,E,te,Ft,Be,Ir="Disable all adapters in-place.",It,Le,Vr="When disabling all adapters, the model output corresponds to the output of the base model.",Vt,A,re,Zt,Pe,Zr="Enable all adapters in-place",Nt,H,ae,Ut,Me,Nr=`This method gets the config from a model in dictionary form. If model has not attribute config, then this
method returns a default config.`,At,D,ne,Ht,ke,Ur=`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.`,Rt,Ee,Ar="The corresponding PEFT config is directly retrieved from the <code>peft_config</code> attribute of the BaseTuner class.",Jt,j,se,St,De,Hr="This method merges the adapter layers into the base model.",Gt,je,Rr=`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>.`,Xt,w,oe,zt,qe,Jr="This method merges the adapter layers into the base model.",Qt,We,Sr=`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.`,Ot,Fe,Gr="It is important to assign the returned model to a variable and use it, this is not an in-place operation!",Yt,R,Kt,J,le,er,Ie,Xr="Set the active adapter(s).",tr,S,de,rr,Ve,zr="Enable or disable gradients on the given adapter(s).",ar,q,ie,nr,Ze,Qr="Whether it is possible for the adapter of this model to be converted to LoRA.",sr,Ne,Or="Normally, this works if the PEFT method is additive, i.e. W’ = W_base + delta_weight.",or,W,pe,lr,Ue,Yr="Return the base model by removing all the PEFT modules.",dr,Ae,Kr="It is important to assign the returned model to a variable and use it, this is not an in-place operation!",ir,G,ue,pr,He,ea="This method unmerges all merged adapter layers from the base model.",_t,ce,bt,v,me,ur,Re,ta="A tuner layer mixin that provides the common methods and attributes for all tuners.",cr,P,ge,mr,Je,ra="Delete an adapter from the layer",gr,Se,aa="This should be called on all adapter layers, or else we will get an inconsistent state.",fr,Ge,na=`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.`,hr,F,fe,_r,Xe,sa="Toggle the enabling and disabling of adapters",br,ze,oa="Takes care of setting the requires_grad flag for the adapter weights.",vr,I,he,$r,Qe,la="(Recursively) get the base_layer.",xr,Oe,da="This is necessary for the case that the tuner layer wraps another tuner layer.",yr,V,_e,Tr,Ye,ia="Set the active adapter(s).",Cr,Ke,pa=`Additionally, this function will set the specified adapter to trainable (i.e., requires_grad=True) unless
inference_mode is True.`,wr,X,be,Br,et,ua="Enable or disable gradients on the given adapter(s).",Lr,Z,ve,Pr,tt,ca="Whether it is possible for this layer type to be converted to LoRA.",Mr,rt,ma="Normally, this works if the PEFT method is additive, i.e. W’ = W_base + delta_weight.",vt,$e,$t,ct,xt;return L=new $a({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),M=new kr({props:{title:"Tuners",local:"tuners",headingTag:"h1"}}),Y=new kr({props:{title:"BaseTuner",local:"peft.tuners.tuners_utils.BaseTuner",headingTag:"h2"}}),K=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L230"}}),ee=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L527"}}),te=new $({props:{name:"disable_adapter_layers",anchor:"peft.tuners.tuners_utils.BaseTuner.disable_adapter_layers",parameters:[],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L503"}}),re=new $({props:{name:"enable_adapter_layers",anchor:"peft.tuners.tuners_utils.BaseTuner.enable_adapter_layers",parameters:[],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L520"}}),ae=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1244"}}),ne=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L743"}}),se=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1192"}}),oe=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L686"}}),R=new Ta({props:{anchor:"peft.tuners.tuners_utils.BaseTuner.merge_and_unload.example",$$slots:{default:[Ca]},$$scope:{ctx:mt}}}),le=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1230"}}),de=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L543"}}),ie=new $({props:{name:"supports_lora_conversion",anchor:"peft.tuners.tuners_utils.BaseTuner.supports_lora_conversion",parameters:[{name:"adapter_name",val:": str = 'default'"}],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L1353"}}),pe=new $({props:{name:"unload",anchor:"peft.tuners.tuners_utils.BaseTuner.unload",parameters:[],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L724"}}),ue=new $({props:{name:"unmerge_adapter",anchor:"peft.tuners.tuners_utils.BaseTuner.unmerge_adapter",parameters:[],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L1221"}}),ce=new kr({props:{title:"BaseTunerLayer",local:"peft.tuners.tuners_utils.BaseTunerLayer",headingTag:"h2"}}),me=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1373"}}),ge=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1559"}}),fe=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1505"}}),he=new $({props:{name:"get_base_layer",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.get_base_layer",parameters:[],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L1398"}}),_e=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1524"}}),be=new $({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/vr_3296/src/peft/tuners/tuners_utils.py#L1596"}}),ve=new $({props:{name:"supports_lora_conversion",anchor:"peft.tuners.tuners_utils.BaseTunerLayer.supports_lora_conversion",parameters:[{name:"adapter_name",val:": str = 'default'"}],source:"https://github.com/huggingface/peft/blob/vr_3296/src/peft/tuners/tuners_utils.py#L1698"}}),$e=new xa({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/tuners.md"}}),{c(){y=n("meta"),Q=r(),k=n("p"),B=r(),p(L.$$.fragment),x=r(),p(M.$$.fragment),gt=r(),O=n("p"),O.innerHTML=Er,ft=r(),p(Y.$$.fragment),ht=r(),l=n("div"),p(K.$$.fragment),Mt=r(),xe=n("p"),xe.textContent=Dr,kt=r(),ye=n("p"),ye.textContent=jr,Et=r(),Te=n("ul"),Te.innerHTML=qr,Dt=r(),Ce=n("p"),Ce.innerHTML=Wr,jt=r(),U=n("div"),p(ee.$$.fragment),qt=r(),we=n("p"),we.textContent=Fr,Wt=r(),E=n("div"),p(te.$$.fragment),Ft=r(),Be=n("p"),Be.textContent=Ir,It=r(),Le=n("p"),Le.textContent=Vr,Vt=r(),A=n("div"),p(re.$$.fragment),Zt=r(),Pe=n("p"),Pe.textContent=Zr,Nt=r(),H=n("div"),p(ae.$$.fragment),Ut=r(),Me=n("p"),Me.textContent=Nr,At=r(),D=n("div"),p(ne.$$.fragment),Ht=r(),ke=n("p"),ke.innerHTML=Ur,Rt=r(),Ee=n("p"),Ee.innerHTML=Ar,Jt=r(),j=n("div"),p(se.$$.fragment),St=r(),De=n("p"),De.textContent=Hr,Gt=r(),je=n("p"),je.innerHTML=Rr,Xt=r(),w=n("div"),p(oe.$$.fragment),zt=r(),qe=n("p"),qe.textContent=Jr,Qt=r(),We=n("p"),We.textContent=Sr,Ot=r(),Fe=n("p"),Fe.textContent=Gr,Yt=r(),p(R.$$.fragment),Kt=r(),J=n("div"),p(le.$$.fragment),er=r(),Ie=n("p"),Ie.textContent=Xr,tr=r(),S=n("div"),p(de.$$.fragment),rr=r(),Ve=n("p"),Ve.textContent=zr,ar=r(),q=n("div"),p(ie.$$.fragment),nr=r(),Ze=n("p"),Ze.textContent=Qr,sr=r(),Ne=n("p"),Ne.textContent=Or,or=r(),W=n("div"),p(pe.$$.fragment),lr=r(),Ue=n("p"),Ue.textContent=Yr,dr=r(),Ae=n("p"),Ae.textContent=Kr,ir=r(),G=n("div"),p(ue.$$.fragment),pr=r(),He=n("p"),He.textContent=ea,_t=r(),p(ce.$$.fragment),bt=r(),v=n("div"),p(me.$$.fragment),ur=r(),Re=n("p"),Re.textContent=ta,cr=r(),P=n("div"),p(ge.$$.fragment),mr=r(),Je=n("p"),Je.textContent=ra,gr=r(),Se=n("p"),Se.textContent=aa,fr=r(),Ge=n("p"),Ge.textContent=na,hr=r(),F=n("div"),p(fe.$$.fragment),_r=r(),Xe=n("p"),Xe.textContent=sa,br=r(),ze=n("p"),ze.textContent=oa,vr=r(),I=n("div"),p(he.$$.fragment),$r=r(),Qe=n("p"),Qe.textContent=la,xr=r(),Oe=n("p"),Oe.textContent=da,yr=r(),V=n("div"),p(_e.$$.fragment),Tr=r(),Ye=n("p"),Ye.textContent=ia,Cr=r(),Ke=n("p"),Ke.textContent=pa,wr=r(),X=n("div"),p(be.$$.fragment),Br=r(),et=n("p"),et.textContent=ua,Lr=r(),Z=n("div"),p(ve.$$.fragment),Pr=r(),tt=n("p"),tt.textContent=ca,Mr=r(),rt=n("p"),rt.textContent=ma,vt=r(),p($e.$$.fragment),$t=r(),ct=n("p"),this.h()},l(t){const h=va("svelte-u9bgzb",document.head);y=s(h,"META",{name:!0,content:!0}),h.forEach(o),Q=a(t),k=s(t,"P",{}),_(k).forEach(o),B=a(t),u(L.$$.fragment,t),x=a(t),u(M.$$.fragment,t),gt=a(t),O=s(t,"P",{"data-svelte-h":!0}),d(O)!=="svelte-dsnslo"&&(O.innerHTML=Er),ft=a(t),u(Y.$$.fragment,t),ht=a(t),l=s(t,"DIV",{class:!0});var i=_(l);u(K.$$.fragment,i),Mt=a(i),xe=s(i,"P",{"data-svelte-h":!0}),d(xe)!=="svelte-1k0hvlq"&&(xe.textContent=Dr),kt=a(i),ye=s(i,"P",{"data-svelte-h":!0}),d(ye)!=="svelte-fkgwsm"&&(ye.textContent=jr),Et=a(i),Te=s(i,"UL",{"data-svelte-h":!0}),d(Te)!=="svelte-uumdnf"&&(Te.innerHTML=qr),Dt=a(i),Ce=s(i,"P",{"data-svelte-h":!0}),d(Ce)!=="svelte-1sc4mfu"&&(Ce.innerHTML=Wr),jt=a(i),U=s(i,"DIV",{class:!0});var yt=_(U);u(ee.$$.fragment,yt),qt=a(yt),we=s(yt,"P",{"data-svelte-h":!0}),d(we)!=="svelte-1cw64z1"&&(we.textContent=Fr),yt.forEach(o),Wt=a(i),E=s(i,"DIV",{class:!0});var at=_(E);u(te.$$.fragment,at),Ft=a(at),Be=s(at,"P",{"data-svelte-h":!0}),d(Be)!=="svelte-1hrol74"&&(Be.textContent=Ir),It=a(at),Le=s(at,"P",{"data-svelte-h":!0}),d(Le)!=="svelte-1ecn6m6"&&(Le.textContent=Vr),at.forEach(o),Vt=a(i),A=s(i,"DIV",{class:!0});var Tt=_(A);u(re.$$.fragment,Tt),Zt=a(Tt),Pe=s(Tt,"P",{"data-svelte-h":!0}),d(Pe)!=="svelte-1l6xdbj"&&(Pe.textContent=Zr),Tt.forEach(o),Nt=a(i),H=s(i,"DIV",{class:!0});var Ct=_(H);u(ae.$$.fragment,Ct),Ut=a(Ct),Me=s(Ct,"P",{"data-svelte-h":!0}),d(Me)!=="svelte-wp66wq"&&(Me.textContent=Nr),Ct.forEach(o),At=a(i),D=s(i,"DIV",{class:!0});var nt=_(D);u(ne.$$.fragment,nt),Ht=a(nt),ke=s(nt,"P",{"data-svelte-h":!0}),d(ke)!=="svelte-1ybn6sj"&&(ke.innerHTML=Ur),Rt=a(nt),Ee=s(nt,"P",{"data-svelte-h":!0}),d(Ee)!=="svelte-fvf2kw"&&(Ee.innerHTML=Ar),nt.forEach(o),Jt=a(i),j=s(i,"DIV",{class:!0});var st=_(j);u(se.$$.fragment,st),St=a(st),De=s(st,"P",{"data-svelte-h":!0}),d(De)!=="svelte-kun7ud"&&(De.textContent=Hr),Gt=a(st),je=s(st,"P",{"data-svelte-h":!0}),d(je)!=="svelte-1f1s101"&&(je.innerHTML=Rr),st.forEach(o),Xt=a(i),w=s(i,"DIV",{class:!0});var N=_(w);u(oe.$$.fragment,N),zt=a(N),qe=s(N,"P",{"data-svelte-h":!0}),d(qe)!=="svelte-kun7ud"&&(qe.textContent=Jr),Qt=a(N),We=s(N,"P",{"data-svelte-h":!0}),d(We)!=="svelte-1xvyps2"&&(We.textContent=Sr),Ot=a(N),Fe=s(N,"P",{"data-svelte-h":!0}),d(Fe)!=="svelte-1t73dx4"&&(Fe.textContent=Gr),Yt=a(N),u(R.$$.fragment,N),N.forEach(o),Kt=a(i),J=s(i,"DIV",{class:!0});var wt=_(J);u(le.$$.fragment,wt),er=a(wt),Ie=s(wt,"P",{"data-svelte-h":!0}),d(Ie)!=="svelte-8teaja"&&(Ie.textContent=Xr),wt.forEach(o),tr=a(i),S=s(i,"DIV",{class:!0});var Bt=_(S);u(de.$$.fragment,Bt),rr=a(Bt),Ve=s(Bt,"P",{"data-svelte-h":!0}),d(Ve)!=="svelte-aqtirv"&&(Ve.textContent=zr),Bt.forEach(o),ar=a(i),q=s(i,"DIV",{class:!0});var ot=_(q);u(ie.$$.fragment,ot),nr=a(ot),Ze=s(ot,"P",{"data-svelte-h":!0}),d(Ze)!=="svelte-1nhbp7j"&&(Ze.textContent=Qr),sr=a(ot),Ne=s(ot,"P",{"data-svelte-h":!0}),d(Ne)!=="svelte-61ytn0"&&(Ne.textContent=Or),ot.forEach(o),or=a(i),W=s(i,"DIV",{class:!0});var lt=_(W);u(pe.$$.fragment,lt),lr=a(lt),Ue=s(lt,"P",{"data-svelte-h":!0}),d(Ue)!=="svelte-5oaxgp"&&(Ue.textContent=Yr),dr=a(lt),Ae=s(lt,"P",{"data-svelte-h":!0}),d(Ae)!=="svelte-1t73dx4"&&(Ae.textContent=Kr),lt.forEach(o),ir=a(i),G=s(i,"DIV",{class:!0});var Lt=_(G);u(ue.$$.fragment,Lt),pr=a(Lt),He=s(Lt,"P",{"data-svelte-h":!0}),d(He)!=="svelte-2eloeq"&&(He.textContent=ea),Lt.forEach(o),i.forEach(o),_t=a(t),u(ce.$$.fragment,t),bt=a(t),v=s(t,"DIV",{class:!0});var C=_(v);u(me.$$.fragment,C),ur=a(C),Re=s(C,"P",{"data-svelte-h":!0}),d(Re)!=="svelte-1fdxdjn"&&(Re.textContent=ta),cr=a(C),P=s(C,"DIV",{class:!0});var z=_(P);u(ge.$$.fragment,z),mr=a(z),Je=s(z,"P",{"data-svelte-h":!0}),d(Je)!=="svelte-950rwb"&&(Je.textContent=ra),gr=a(z),Se=s(z,"P",{"data-svelte-h":!0}),d(Se)!=="svelte-1nnxg1l"&&(Se.textContent=aa),fr=a(z),Ge=s(z,"P",{"data-svelte-h":!0}),d(Ge)!=="svelte-1vxxy19"&&(Ge.textContent=na),z.forEach(o),hr=a(C),F=s(C,"DIV",{class:!0});var dt=_(F);u(fe.$$.fragment,dt),_r=a(dt),Xe=s(dt,"P",{"data-svelte-h":!0}),d(Xe)!=="svelte-2or2k8"&&(Xe.textContent=sa),br=a(dt),ze=s(dt,"P",{"data-svelte-h":!0}),d(ze)!=="svelte-ujp0ui"&&(ze.textContent=oa),dt.forEach(o),vr=a(C),I=s(C,"DIV",{class:!0});var it=_(I);u(he.$$.fragment,it),$r=a(it),Qe=s(it,"P",{"data-svelte-h":!0}),d(Qe)!=="svelte-6rdpda"&&(Qe.textContent=la),xr=a(it),Oe=s(it,"P",{"data-svelte-h":!0}),d(Oe)!=="svelte-dptqqh"&&(Oe.textContent=da),it.forEach(o),yr=a(C),V=s(C,"DIV",{class:!0});var pt=_(V);u(_e.$$.fragment,pt),Tr=a(pt),Ye=s(pt,"P",{"data-svelte-h":!0}),d(Ye)!=="svelte-8teaja"&&(Ye.textContent=ia),Cr=a(pt),Ke=s(pt,"P",{"data-svelte-h":!0}),d(Ke)!=="svelte-1020tdh"&&(Ke.textContent=pa),pt.forEach(o),wr=a(C),X=s(C,"DIV",{class:!0});var Pt=_(X);u(be.$$.fragment,Pt),Br=a(Pt),et=s(Pt,"P",{"data-svelte-h":!0}),d(et)!=="svelte-aqtirv"&&(et.textContent=ua),Pt.forEach(o),Lr=a(C),Z=s(C,"DIV",{class:!0});var ut=_(Z);u(ve.$$.fragment,ut),Pr=a(ut),tt=s(ut,"P",{"data-svelte-h":!0}),d(tt)!=="svelte-520ku0"&&(tt.textContent=ca),Mr=a(ut),rt=s(ut,"P",{"data-svelte-h":!0}),d(rt)!=="svelte-61ytn0"&&(rt.textContent=ma),ut.forEach(o),C.forEach(o),vt=a(t),u($e.$$.fragment,t),$t=a(t),ct=s(t,"P",{}),_(ct).forEach(o),this.h()},h(){b(y,"name","hf:doc:metadata"),b(y,"content",Ba),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(A,"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(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(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(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(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(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(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(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(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(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(P,"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(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(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(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),b(Z,"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")},m(t,h){e(document.head,y),T(t,Q,h),T(t,k,h),T(t,B,h),c(L,t,h),T(t,x,h),c(M,t,h),T(t,gt,h),T(t,O,h),T(t,ft,h),c(Y,t,h),T(t,ht,h),T(t,l,h),c(K,l,null),e(l,Mt),e(l,xe),e(l,kt),e(l,ye),e(l,Et),e(l,Te),e(l,Dt),e(l,Ce),e(l,jt),e(l,U),c(ee,U,null),e(U,qt),e(U,we),e(l,Wt),e(l,E),c(te,E,null),e(E,Ft),e(E,Be),e(E,It),e(E,Le),e(l,Vt),e(l,A),c(re,A,null),e(A,Zt),e(A,Pe),e(l,Nt),e(l,H),c(ae,H,null),e(H,Ut),e(H,Me),e(l,At),e(l,D),c(ne,D,null),e(D,Ht),e(D,ke),e(D,Rt),e(D,Ee),e(l,Jt),e(l,j),c(se,j,null),e(j,St),e(j,De),e(j,Gt),e(j,je),e(l,Xt),e(l,w),c(oe,w,null),e(w,zt),e(w,qe),e(w,Qt),e(w,We),e(w,Ot),e(w,Fe),e(w,Yt),c(R,w,null),e(l,Kt),e(l,J),c(le,J,null),e(J,er),e(J,Ie),e(l,tr),e(l,S),c(de,S,null),e(S,rr),e(S,Ve),e(l,ar),e(l,q),c(ie,q,null),e(q,nr),e(q,Ze),e(q,sr),e(q,Ne),e(l,or),e(l,W),c(pe,W,null),e(W,lr),e(W,Ue),e(W,dr),e(W,Ae),e(l,ir),e(l,G),c(ue,G,null),e(G,pr),e(G,He),T(t,_t,h),c(ce,t,h),T(t,bt,h),T(t,v,h),c(me,v,null),e(v,ur),e(v,Re),e(v,cr),e(v,P),c(ge,P,null),e(P,mr),e(P,Je),e(P,gr),e(P,Se),e(P,fr),e(P,Ge),e(v,hr),e(v,F),c(fe,F,null),e(F,_r),e(F,Xe),e(F,br),e(F,ze),e(v,vr),e(v,I),c(he,I,null),e(I,$r),e(I,Qe),e(I,xr),e(I,Oe),e(v,yr),e(v,V),c(_e,V,null),e(V,Tr),e(V,Ye),e(V,Cr),e(V,Ke),e(v,wr),e(v,X),c(be,X,null),e(X,Br),e(X,et),e(v,Lr),e(v,Z),c(ve,Z,null),e(Z,Pr),e(Z,tt),e(Z,Mr),e(Z,rt),T(t,vt,h),c($e,t,h),T(t,$t,h),T(t,ct,h),xt=!0},p(t,[h]){const i={};h&2&&(i.$$scope={dirty:h,ctx:t}),R.$set(i)},i(t){xt||(m(L.$$.fragment,t),m(M.$$.fragment,t),m(Y.$$.fragment,t),m(K.$$.fragment,t),m(ee.$$.fragment,t),m(te.$$.fragment,t),m(re.$$.fragment,t),m(ae.$$.fragment,t),m(ne.$$.fragment,t),m(se.$$.fragment,t),m(oe.$$.fragment,t),m(R.$$.fragment,t),m(le.$$.fragment,t),m(de.$$.fragment,t),m(ie.$$.fragment,t),m(pe.$$.fragment,t),m(ue.$$.fragment,t),m(ce.$$.fragment,t),m(me.$$.fragment,t),m(ge.$$.fragment,t),m(fe.$$.fragment,t),m(he.$$.fragment,t),m(_e.$$.fragment,t),m(be.$$.fragment,t),m(ve.$$.fragment,t),m($e.$$.fragment,t),xt=!0)},o(t){g(L.$$.fragment,t),g(M.$$.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(oe.$$.fragment,t),g(R.$$.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),g(ve.$$.fragment,t),g($e.$$.fragment,t),xt=!1},d(t){t&&(o(Q),o(k),o(B),o(x),o(gt),o(O),o(ft),o(ht),o(l),o(_t),o(bt),o(v),o(vt),o($t),o(ct)),o(y),f(L,t),f(M,t),f(Y,t),f(K),f(ee),f(te),f(re),f(ae),f(ne),f(se),f(oe),f(R),f(le),f(de),f(ie),f(pe),f(ue),f(ce,t),f(me),f(ge),f(fe),f(he),f(_e),f(be),f(ve),f($e,t)}}}const Ba='{"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 La(mt){return fa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qa extends _a{constructor(y){super(),ba(this,y,La,wa,ga,{})}}export{qa as component};

Xet Storage Details

Size:
34.8 kB
·
Xet hash:
0497e95b54e1508b52b48c8198764d64d9dd74085c725f75c6e41e787b671aae

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.