import{s as tt,n as nt,o as ot}from"../chunks/scheduler.4cd3e004.js";import{S as rt,i as at,e as i,s as o,c as l,h as it,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 g,t as c,o as u,p as h}from"../chunks/index.b664cb2d.js";import{D as T}from"../chunks/Docstring.9ceb4334.js";import{H as Ce,E as st}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.179b63f8.js";function ft(qe){let P,ie,re,se,N,fe,O,Ae='<code>PeftConfigMixin</code> is the base configuration class for storing the adapter configuration of a <a href="/docs/peft/main/en/package_reference/peft_model#peft.PeftModel">PeftModel</a>, and <a href="/docs/peft/main/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.',pe,E,me,f,D,Te,G,Re=`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/main/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.`,ke,b,H,we,K,Ge="Check kwargs before initializing the config instance.",Me,W,Ke="Subclasses can override this method to add specific checks.",Le,k,j,Ne,B,We="Loads a configuration file from a json file.",Oe,y,I,Ee,J,Be="This method loads the configuration of your adapter model from a set of kwargs.",De,Q,Je=`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.`,He,w,V,je,X,Qe="This method loads the configuration of your adapter model from a directory.",Ie,M,U,Ve,Y,Xe="This method saves the configuration of your adapter model in a directory.",Ue,L,z,ze,Z,Ye="Returns the configuration for your adapter model as a dictionary.",le,F,de,x,S,Fe,ee,Ze='This is the base configuration class to store the configuration of a <a href="/docs/peft/main/en/package_reference/peft_model#peft.PeftModel">PeftModel</a>.',ge,q,ce,C,A,Se,te,et=`This is the base configuration class to store the configuration of <code>PrefixTuning</code>, <a href="/docs/peft/main/en/package_reference/p_tuning#peft.PromptEncoder">PromptEncoder</a>, or
<code>PromptTuning</code>.`,ue,R,he,ae,_e;return N=new Ce({props:{title:"Configuration",local:"configuration",headingTag:"h1"}}),E=new Ce({props:{title:"PeftConfigMixin",local:"peft.config.PeftConfigMixin",headingTag:"h2"}}),D=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/main/src/peft/config.py#L77"}}),H=new T({props:{name:"check_kwargs",anchor:"peft.config.PeftConfigMixin.check_kwargs",parameters:[{name:"**kwargs",val:""}],source:"https://github.com/huggingface/peft/blob/main/src/peft/config.py#L328"}}),j=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/main/src/peft/config.py#L266"}}),I=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/main/src/peft/config.py#L165"}}),V=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/main/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/main/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/main/src/peft/config.py#L132"}}),z=new T({props:{name:"to_dict",anchor:"peft.config.PeftConfigMixin.to_dict",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/config.py#L126"}}),F=new Ce({props:{title:"PeftConfig",local:"peft.PeftConfig",headingTag:"h2"}}),S=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/main/src/peft/config.py#L351"}}),q=new Ce({props:{title:"PromptLearningConfig",local:"peft.PromptLearningConfig",headingTag:"h2"}}),A=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/main/src/peft/config.py#L371"}}),R=new st({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/config.md"}}),{c(){P=i("meta"),ie=o(),re=i("p"),se=o(),l(N.$$.fragment),fe=o(),O=i("p"),O.innerHTML=Ae,pe=o(),l(E.$$.fragment),me=o(),f=i("div"),l(D.$$.fragment),Te=o(),G=i("p"),G.innerHTML=Re,ke=o(),b=i("div"),l(H.$$.fragment),we=o(),K=i("p"),K.textContent=Ge,Me=o(),W=i("p"),W.textContent=Ke,Le=o(),k=i("div"),l(j.$$.fragment),Ne=o(),B=i("p"),B.textContent=We,Oe=o(),y=i("div"),l(I.$$.fragment),Ee=o(),J=i("p"),J.textContent=Be,De=o(),Q=i("p"),Q.innerHTML=Je,He=o(),w=i("div"),l(V.$$.fragment),je=o(),X=i("p"),X.textContent=Qe,Ie=o(),M=i("div"),l(U.$$.fragment),Ve=o(),Y=i("p"),Y.textContent=Xe,Ue=o(),L=i("div"),l(z.$$.fragment),ze=o(),Z=i("p"),Z.textContent=Ye,le=o(),l(F.$$.fragment),de=o(),x=i("div"),l(S.$$.fragment),Fe=o(),ee=i("p"),ee.innerHTML=Ze,ge=o(),l(q.$$.fragment),ce=o(),C=i("div"),l(A.$$.fragment),Se=o(),te=i("p"),te.innerHTML=et,ue=o(),l(R.$$.fragment),he=o(),ae=i("p"),this.h()},l(e){const a=it("svelte-u9bgzb",document.head);P=s(a,"META",{name:!0,content:!0}),a.forEach(n),ie=r(e),re=s(e,"P",{}),v(re).forEach(n),se=r(e),d(N.$$.fragment,e),fe=r(e),O=s(e,"P",{"data-svelte-h":!0}),_(O)!=="svelte-wpcb2j"&&(O.innerHTML=Ae),pe=r(e),d(E.$$.fragment,e),me=r(e),f=s(e,"DIV",{class:!0});var m=v(f);d(D.$$.fragment,m),Te=r(m),G=s(m,"P",{"data-svelte-h":!0}),_(G)!=="svelte-1mh9vl"&&(G.innerHTML=Re),ke=r(m),b=s(m,"DIV",{class:!0});var ne=v(b);d(H.$$.fragment,ne),we=r(ne),K=s(ne,"P",{"data-svelte-h":!0}),_(K)!=="svelte-152jn6x"&&(K.textContent=Ge),Me=r(ne),W=s(ne,"P",{"data-svelte-h":!0}),_(W)!=="svelte-l7fpaa"&&(W.textContent=Ke),ne.forEach(n),Le=r(m),k=s(m,"DIV",{class:!0});var ve=v(k);d(j.$$.fragment,ve),Ne=r(ve),B=s(ve,"P",{"data-svelte-h":!0}),_(B)!=="svelte-zcd40r"&&(B.textContent=We),ve.forEach(n),Oe=r(m),y=s(m,"DIV",{class:!0});var oe=v(y);d(I.$$.fragment,oe),Ee=r(oe),J=s(oe,"P",{"data-svelte-h":!0}),_(J)!=="svelte-29oatc"&&(J.textContent=Be),De=r(oe),Q=s(oe,"P",{"data-svelte-h":!0}),_(Q)!=="svelte-lain5s"&&(Q.innerHTML=Je),oe.forEach(n),He=r(m),w=s(m,"DIV",{class:!0});var $e=v(w);d(V.$$.fragment,$e),je=r($e),X=s($e,"P",{"data-svelte-h":!0}),_(X)!=="svelte-z7yz95"&&(X.textContent=Qe),$e.forEach(n),Ie=r(m),M=s(m,"DIV",{class:!0});var be=v(M);d(U.$$.fragment,be),Ve=r(be),Y=s(be,"P",{"data-svelte-h":!0}),_(Y)!=="svelte-fhg9sv"&&(Y.textContent=Xe),be.forEach(n),Ue=r(m),L=s(m,"DIV",{class:!0});var ye=v(L);d(z.$$.fragment,ye),ze=r(ye),Z=s(ye,"P",{"data-svelte-h":!0}),_(Z)!=="svelte-1rharm3"&&(Z.textContent=Ye),ye.forEach(n),m.forEach(n),le=r(e),d(F.$$.fragment,e),de=r(e),x=s(e,"DIV",{class:!0});var Pe=v(x);d(S.$$.fragment,Pe),Fe=r(Pe),ee=s(Pe,"P",{"data-svelte-h":!0}),_(ee)!=="svelte-1r1kq2j"&&(ee.innerHTML=Ze),Pe.forEach(n),ge=r(e),d(q.$$.fragment,e),ce=r(e),C=s(e,"DIV",{class:!0});var xe=v(C);d(A.$$.fragment,xe),Se=r(xe),te=s(xe,"P",{"data-svelte-h":!0}),_(te)!=="svelte-1pudpqu"&&(te.innerHTML=et),xe.forEach(n),ue=r(e),d(R.$$.fragment,e),he=r(e),ae=s(e,"P",{}),v(ae).forEach(n),this.h()},h(){$(P,"name","hf:doc:metadata"),$(P,"content",pt),$(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"),$(x,"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,P),p(e,ie,a),p(e,re,a),p(e,se,a),g(N,e,a),p(e,fe,a),p(e,O,a),p(e,pe,a),g(E,e,a),p(e,me,a),p(e,f,a),g(D,f,null),t(f,Te),t(f,G),t(f,ke),t(f,b),g(H,b,null),t(b,we),t(b,K),t(b,Me),t(b,W),t(f,Le),t(f,k),g(j,k,null),t(k,Ne),t(k,B),t(f,Oe),t(f,y),g(I,y,null),t(y,Ee),t(y,J),t(y,De),t(y,Q),t(f,He),t(f,w),g(V,w,null),t(w,je),t(w,X),t(f,Ie),t(f,M),g(U,M,null),t(M,Ve),t(M,Y),t(f,Ue),t(f,L),g(z,L,null),t(L,ze),t(L,Z),p(e,le,a),g(F,e,a),p(e,de,a),p(e,x,a),g(S,x,null),t(x,Fe),t(x,ee),p(e,ge,a),g(q,e,a),p(e,ce,a),p(e,C,a),g(A,C,null),t(C,Se),t(C,te),p(e,ue,a),g(R,e,a),p(e,he,a),p(e,ae,a),_e=!0},p:nt,i(e){_e||(c(N.$$.fragment,e),c(E.$$.fragment,e),c(D.$$.fragment,e),c(H.$$.fragment,e),c(j.$$.fragment,e),c(I.$$.fragment,e),c(V.$$.fragment,e),c(U.$$.fragment,e),c(z.$$.fragment,e),c(F.$$.fragment,e),c(S.$$.fragment,e),c(q.$$.fragment,e),c(A.$$.fragment,e),c(R.$$.fragment,e),_e=!0)},o(e){u(N.$$.fragment,e),u(E.$$.fragment,e),u(D.$$.fragment,e),u(H.$$.fragment,e),u(j.$$.fragment,e),u(I.$$.fragment,e),u(V.$$.fragment,e),u(U.$$.fragment,e),u(z.$$.fragment,e),u(F.$$.fragment,e),u(S.$$.fragment,e),u(q.$$.fragment,e),u(A.$$.fragment,e),u(R.$$.fragment,e),_e=!1},d(e){e&&(n(ie),n(re),n(se),n(fe),n(O),n(pe),n(me),n(f),n(le),n(de),n(x),n(ge),n(ce),n(C),n(ue),n(he),n(ae)),n(P),h(N,e),h(E,e),h(D),h(H),h(j),h(I),h(V),h(U),h(z),h(F,e),h(S),h(q,e),h(A),h(R,e)}}}const pt='{"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 mt(qe){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ut extends rt{constructor(P){super(),at(this,P,mt,ft,tt,{})}}export{ut as component};
