import{s as ot,n as rt,o as at}from"../chunks/scheduler.78382b47.js";import{S as it,i as st,e as i,s as o,c as m,h as ft,a as s,d as n,b as r,f as v,g as d,j as _,k as $,l as t,m as p,n as c,t as g,o as u,p as h}from"../chunks/index.6dd35eb6.js";import{C as pt,H as ke,E as lt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8d7e60c0.js";import{D as T}from"../chunks/Docstring.57cb1354.js";function mt(qe){let x,se,ae,fe,N,pe,O,le,E,Ge='<code>PeftConfigMixin</code> is the base configuration class for storing the adapter configuration of a <a href="/docs/peft/v0.18.0.rc0/en/package_reference/peft_model#peft.PeftModel">PeftModel</a>, and <a href="/docs/peft/v0.18.0.rc0/en/package_reference/config#peft.PromptLearningConfig">PromptLearningConfig</a> is the base configuration class for soft prompt methods (p-tuning, prefix tuning, and prompt tuning). These base classes contain methods for saving and loading model configurations from the Hub, specifying the PEFT method to use, type of task to perform, and model configurations like number of layers and number of attention heads.',me,D,de,f,H,we,K,Ke=`This is the base configuration class for PEFT adapter models. It contains all the methods that are common to all
PEFT adapter models. This class inherits from <a href="https://huggingface.co/docs/transformers/v4.57.1/en/main_classes/model#transformers.utils.PushToHubMixin" rel="nofollow">PushToHubMixin</a> which contains the methods to
push your model to the Hub. The method <code>save_pretrained</code> will save the configuration of your adapter model in a
directory. The method <code>from_pretrained</code> will load the configuration of your adapter model from a directory.`,Me,b,j,Le,W,We="Check kwargs before initializing the config instance.",Ne,B,Be="Subclasses can override this method to add specific checks.",Oe,k,I,Ee,J,Je="Loads a configuration file from a json file.",De,y,V,He,Q,Qe="This method loads the configuration of your adapter model from a set of kwargs.",je,X,Xe=`The appropriate configuration type is determined by the <code>peft_type</code> argument. If <code>peft_type</code> is not provided,
the calling class type is instantiated.`,Ie,w,z,Ve,Y,Ye="This method loads the configuration of your adapter model from a directory.",ze,M,U,Ue,Z,Ze="This method saves the configuration of your adapter model in a directory.",Fe,L,F,Se,ee,et="Returns the configuration for your adapter model as a dictionary.",ce,S,ge,P,A,Ae,te,tt='This is the base configuration class to store the configuration of a <a href="/docs/peft/v0.18.0.rc0/en/package_reference/peft_model#peft.PeftModel">PeftModel</a>.',ue,R,he,C,q,Re,ne,nt=`This is the base configuration class to store the configuration of <code>PrefixTuning</code>, <a href="/docs/peft/v0.18.0.rc0/en/package_reference/p_tuning#peft.PromptEncoder">PromptEncoder</a>, or
<code>PromptTuning</code>.`,_e,G,ve,ie,$e;return N=new pt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),O=new ke({props:{title:"Configuration",local:"configuration",headingTag:"h1"}}),D=new ke({props:{title:"PeftConfigMixin",local:"peft.config.PeftConfigMixin",headingTag:"h2"}}),H=new T({props:{name:"class peft.config.PeftConfigMixin",anchor:"peft.config.PeftConfigMixin",parameters:[{name:"task_type",val:": Optional[TaskType] = None"},{name:"peft_type",val:": Optional[PeftType] = None"},{name:"auto_mapping",val:": Optional[dict] = None"},{name:"peft_version",val:": Optional[str] = None"}],parametersDescription:[{anchor:"peft.config.PeftConfigMixin.peft_type",description:"<strong>peft_type</strong> (Union[<code>~peft.utils.config.PeftType</code>, <code>str</code>]) &#x2014; The type of Peft method to use.",name:"peft_type"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L77"}}),j=new T({props:{name:"check_kwargs",anchor:"peft.config.PeftConfigMixin.check_kwargs",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L328"}}),I=new T({props:{name:"from_json_file",anchor:"peft.config.PeftConfigMixin.from_json_file",parameters:[{name:"path_json_file",val:": str"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"peft.config.PeftConfigMixin.from_json_file.path_json_file",description:`<strong>path_json_file</strong> (<code>str</code>) &#x2014;
The path to the json file.`,name:"path_json_file"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L266"}}),V=new T({props:{name:"from_peft_type",anchor:"peft.config.PeftConfigMixin.from_peft_type",parameters:[{name:"**kwargs",val:""}],parametersDescription:[{anchor:"peft.config.PeftConfigMixin.from_peft_type.kwargs",description:`<strong>kwargs</strong> (configuration keyword arguments) &#x2014;
Keyword arguments passed along to the configuration initialization.`,name:"kwargs"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L165"}}),z=new T({props:{name:"from_pretrained",anchor:"peft.config.PeftConfigMixin.from_pretrained",parameters:[{name:"pretrained_model_name_or_path",val:": str"},{name:"subfolder",val:": Optional[str] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"peft.config.PeftConfigMixin.from_pretrained.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code>) &#x2014;
The directory or the Hub repository id where the configuration is saved.`,name:"pretrained_model_name_or_path"},{anchor:"peft.config.PeftConfigMixin.from_pretrained.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to the child class initialization.`,name:"kwargs"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L230"}}),U=new T({props:{name:"save_pretrained",anchor:"peft.config.PeftConfigMixin.save_pretrained",parameters:[{name:"save_directory",val:": str"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"peft.config.PeftConfigMixin.save_pretrained.save_directory",description:`<strong>save_directory</strong> (<code>str</code>) &#x2014;
The directory where the configuration will be saved.`,name:"save_directory"},{anchor:"peft.config.PeftConfigMixin.save_pretrained.kwargs",description:`<strong>kwargs</strong> (additional keyword arguments, <em>optional</em>) &#x2014;
Additional keyword arguments passed along to the <a href="https://huggingface.co/docs/transformers/v4.57.1/en/main_classes/model#transformers.utils.PushToHubMixin.push_to_hub" rel="nofollow">push_to_hub</a>
method.`,name:"kwargs"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L132"}}),F=new T({props:{name:"to_dict",anchor:"peft.config.PeftConfigMixin.to_dict",parameters:[],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L126"}}),S=new ke({props:{title:"PeftConfig",local:"peft.PeftConfig",headingTag:"h2"}}),A=new T({props:{name:"class peft.PeftConfig",anchor:"peft.PeftConfig",parameters:[{name:"task_type",val:": Optional[Union[str, TaskType]] = None"},{name:"peft_type",val:": Optional[Union[str, PeftType]] = None"},{name:"auto_mapping",val:": Optional[dict] = None"},{name:"peft_version",val:": Optional[str] = None"},{name:"base_model_name_or_path",val:": Optional[str] = None"},{name:"revision",val:": Optional[str] = None"},{name:"inference_mode",val:": bool = False"}],parametersDescription:[{anchor:"peft.PeftConfig.peft_type",description:"<strong>peft_type</strong> (Union[<code>~peft.utils.config.PeftType</code>, <code>str</code>]) &#x2014; The type of Peft method to use.",name:"peft_type"},{anchor:"peft.PeftConfig.task_type",description:"<strong>task_type</strong> (Union[<code>~peft.utils.config.TaskType</code>, <code>str</code>]) &#x2014; The type of task to perform.",name:"task_type"},{anchor:"peft.PeftConfig.inference_mode",description:"<strong>inference_mode</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014; Whether to use the Peft model in inference mode.",name:"inference_mode"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L351"}}),R=new ke({props:{title:"PromptLearningConfig",local:"peft.PromptLearningConfig",headingTag:"h2"}}),q=new T({props:{name:"class peft.PromptLearningConfig",anchor:"peft.PromptLearningConfig",parameters:[{name:"task_type",val:": Optional[Union[str, TaskType]] = None"},{name:"peft_type",val:": Optional[Union[str, PeftType]] = None"},{name:"auto_mapping",val:": Optional[dict] = None"},{name:"peft_version",val:": Optional[str] = None"},{name:"base_model_name_or_path",val:": Optional[str] = None"},{name:"revision",val:": Optional[str] = None"},{name:"inference_mode",val:": bool = False"},{name:"num_virtual_tokens",val:": int = None"},{name:"token_dim",val:": int = None"},{name:"num_transformer_submodules",val:": Optional[int] = None"},{name:"num_attention_heads",val:": Optional[int] = None"},{name:"num_layers",val:": Optional[int] = None"},{name:"modules_to_save",val:": Optional[list[str]] = None"}],parametersDescription:[{anchor:"peft.PromptLearningConfig.num_virtual_tokens",description:"<strong>num_virtual_tokens</strong> (<code>int</code>) &#x2014; The number of virtual tokens to use.",name:"num_virtual_tokens"},{anchor:"peft.PromptLearningConfig.token_dim",description:"<strong>token_dim</strong> (<code>int</code>) &#x2014; The hidden embedding dimension of the base transformer model.",name:"token_dim"},{anchor:"peft.PromptLearningConfig.num_transformer_submodules",description:"<strong>num_transformer_submodules</strong> (<code>int</code>) &#x2014; The number of transformer submodules in the base transformer model.",name:"num_transformer_submodules"},{anchor:"peft.PromptLearningConfig.num_attention_heads",description:"<strong>num_attention_heads</strong> (<code>int</code>) &#x2014; The number of attention heads in the base transformer model.",name:"num_attention_heads"},{anchor:"peft.PromptLearningConfig.num_layers",description:"<strong>num_layers</strong> (<code>int</code>) &#x2014; The number of layers in the base transformer model.",name:"num_layers"}],source:"https://github.com/huggingface/peft/blob/v0.18.0.rc0/src/peft/config.py#L371"}}),G=new lt({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/config.md"}}),{c(){x=i("meta"),se=o(),ae=i("p"),fe=o(),m(N.$$.fragment),pe=o(),m(O.$$.fragment),le=o(),E=i("p"),E.innerHTML=Ge,me=o(),m(D.$$.fragment),de=o(),f=i("div"),m(H.$$.fragment),we=o(),K=i("p"),K.innerHTML=Ke,Me=o(),b=i("div"),m(j.$$.fragment),Le=o(),W=i("p"),W.textContent=We,Ne=o(),B=i("p"),B.textContent=Be,Oe=o(),k=i("div"),m(I.$$.fragment),Ee=o(),J=i("p"),J.textContent=Je,De=o(),y=i("div"),m(V.$$.fragment),He=o(),Q=i("p"),Q.textContent=Qe,je=o(),X=i("p"),X.innerHTML=Xe,Ie=o(),w=i("div"),m(z.$$.fragment),Ve=o(),Y=i("p"),Y.textContent=Ye,ze=o(),M=i("div"),m(U.$$.fragment),Ue=o(),Z=i("p"),Z.textContent=Ze,Fe=o(),L=i("div"),m(F.$$.fragment),Se=o(),ee=i("p"),ee.textContent=et,ce=o(),m(S.$$.fragment),ge=o(),P=i("div"),m(A.$$.fragment),Ae=o(),te=i("p"),te.innerHTML=tt,ue=o(),m(R.$$.fragment),he=o(),C=i("div"),m(q.$$.fragment),Re=o(),ne=i("p"),ne.innerHTML=nt,_e=o(),m(G.$$.fragment),ve=o(),ie=i("p"),this.h()},l(e){const a=ft("svelte-u9bgzb",document.head);x=s(a,"META",{name:!0,content:!0}),a.forEach(n),se=r(e),ae=s(e,"P",{}),v(ae).forEach(n),fe=r(e),d(N.$$.fragment,e),pe=r(e),d(O.$$.fragment,e),le=r(e),E=s(e,"P",{"data-svelte-h":!0}),_(E)!=="svelte-o4p9nt"&&(E.innerHTML=Ge),me=r(e),d(D.$$.fragment,e),de=r(e),f=s(e,"DIV",{class:!0});var l=v(f);d(H.$$.fragment,l),we=r(l),K=s(l,"P",{"data-svelte-h":!0}),_(K)!=="svelte-1xtilh"&&(K.innerHTML=Ke),Me=r(l),b=s(l,"DIV",{class:!0});var oe=v(b);d(j.$$.fragment,oe),Le=r(oe),W=s(oe,"P",{"data-svelte-h":!0}),_(W)!=="svelte-152jn6x"&&(W.textContent=We),Ne=r(oe),B=s(oe,"P",{"data-svelte-h":!0}),_(B)!=="svelte-l7fpaa"&&(B.textContent=Be),oe.forEach(n),Oe=r(l),k=s(l,"DIV",{class:!0});var be=v(k);d(I.$$.fragment,be),Ee=r(be),J=s(be,"P",{"data-svelte-h":!0}),_(J)!=="svelte-zcd40r"&&(J.textContent=Je),be.forEach(n),De=r(l),y=s(l,"DIV",{class:!0});var re=v(y);d(V.$$.fragment,re),He=r(re),Q=s(re,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-29oatc"&&(Q.textContent=Qe),je=r(re),X=s(re,"P",{"data-svelte-h":!0}),_(X)!=="svelte-lain5s"&&(X.innerHTML=Xe),re.forEach(n),Ie=r(l),w=s(l,"DIV",{class:!0});var ye=v(w);d(z.$$.fragment,ye),Ve=r(ye),Y=s(ye,"P",{"data-svelte-h":!0}),_(Y)!=="svelte-z7yz95"&&(Y.textContent=Ye),ye.forEach(n),ze=r(l),M=s(l,"DIV",{class:!0});var xe=v(M);d(U.$$.fragment,xe),Ue=r(xe),Z=s(xe,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-fhg9sv"&&(Z.textContent=Ze),xe.forEach(n),Fe=r(l),L=s(l,"DIV",{class:!0});var Pe=v(L);d(F.$$.fragment,Pe),Se=r(Pe),ee=s(Pe,"P",{"data-svelte-h":!0}),_(ee)!=="svelte-1rharm3"&&(ee.textContent=et),Pe.forEach(n),l.forEach(n),ce=r(e),d(S.$$.fragment,e),ge=r(e),P=s(e,"DIV",{class:!0});var Ce=v(P);d(A.$$.fragment,Ce),Ae=r(Ce),te=s(Ce,"P",{"data-svelte-h":!0}),_(te)!=="svelte-1lcwv6k"&&(te.innerHTML=tt),Ce.forEach(n),ue=r(e),d(R.$$.fragment,e),he=r(e),C=s(e,"DIV",{class:!0});var Te=v(C);d(q.$$.fragment,Te),Re=r(Te),ne=s(Te,"P",{"data-svelte-h":!0}),_(ne)!=="svelte-1huj8u3"&&(ne.innerHTML=nt),Te.forEach(n),_e=r(e),d(G.$$.fragment,e),ve=r(e),ie=s(e,"P",{}),v(ie).forEach(n),this.h()},h(){$(x,"name","hf:doc:metadata"),$(x,"content",dt),$(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(k,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),$(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,a){t(document.head,x),p(e,se,a),p(e,ae,a),p(e,fe,a),c(N,e,a),p(e,pe,a),c(O,e,a),p(e,le,a),p(e,E,a),p(e,me,a),c(D,e,a),p(e,de,a),p(e,f,a),c(H,f,null),t(f,we),t(f,K),t(f,Me),t(f,b),c(j,b,null),t(b,Le),t(b,W),t(b,Ne),t(b,B),t(f,Oe),t(f,k),c(I,k,null),t(k,Ee),t(k,J),t(f,De),t(f,y),c(V,y,null),t(y,He),t(y,Q),t(y,je),t(y,X),t(f,Ie),t(f,w),c(z,w,null),t(w,Ve),t(w,Y),t(f,ze),t(f,M),c(U,M,null),t(M,Ue),t(M,Z),t(f,Fe),t(f,L),c(F,L,null),t(L,Se),t(L,ee),p(e,ce,a),c(S,e,a),p(e,ge,a),p(e,P,a),c(A,P,null),t(P,Ae),t(P,te),p(e,ue,a),c(R,e,a),p(e,he,a),p(e,C,a),c(q,C,null),t(C,Re),t(C,ne),p(e,_e,a),c(G,e,a),p(e,ve,a),p(e,ie,a),$e=!0},p:rt,i(e){$e||(g(N.$$.fragment,e),g(O.$$.fragment,e),g(D.$$.fragment,e),g(H.$$.fragment,e),g(j.$$.fragment,e),g(I.$$.fragment,e),g(V.$$.fragment,e),g(z.$$.fragment,e),g(U.$$.fragment,e),g(F.$$.fragment,e),g(S.$$.fragment,e),g(A.$$.fragment,e),g(R.$$.fragment,e),g(q.$$.fragment,e),g(G.$$.fragment,e),$e=!0)},o(e){u(N.$$.fragment,e),u(O.$$.fragment,e),u(D.$$.fragment,e),u(H.$$.fragment,e),u(j.$$.fragment,e),u(I.$$.fragment,e),u(V.$$.fragment,e),u(z.$$.fragment,e),u(U.$$.fragment,e),u(F.$$.fragment,e),u(S.$$.fragment,e),u(A.$$.fragment,e),u(R.$$.fragment,e),u(q.$$.fragment,e),u(G.$$.fragment,e),$e=!1},d(e){e&&(n(se),n(ae),n(fe),n(pe),n(le),n(E),n(me),n(de),n(f),n(ce),n(ge),n(P),n(ue),n(he),n(C),n(_e),n(ve),n(ie)),n(x),h(N,e),h(O,e),h(D,e),h(H),h(j),h(I),h(V),h(z),h(U),h(F),h(S,e),h(A),h(R,e),h(q),h(G,e)}}}const dt='{"title":"Configuration","local":"configuration","sections":[{"title":"PeftConfigMixin","local":"peft.config.PeftConfigMixin","sections":[],"depth":2},{"title":"PeftConfig","local":"peft.PeftConfig","sections":[],"depth":2},{"title":"PromptLearningConfig","local":"peft.PromptLearningConfig","sections":[],"depth":2}],"depth":1}';function ct(qe){return at(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vt extends it{constructor(x){super(),st(this,x,ct,mt,ot,{})}}export{vt as component};
