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 l,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 g,t as c,o as u,p as h}from"../chunks/index.6dd35eb6.js";import{C as pt,H as ke,E as mt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.fed9dfe4.js";import{D as T}from"../chunks/Docstring.32e826ec.js";function lt(Re){let x,se,ae,fe,N,pe,O,me,E,Ge='<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.',le,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/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.`,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.",ge,S,ce,P,q,qe,te,tt='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>.',ue,A,he,C,R,Ae,ne,nt=`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>.`,_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/main/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/main/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/main/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/main/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/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"}}),F=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"}}),S=new ke({props:{title:"PeftConfig",local:"peft.PeftConfig",headingTag:"h2"}}),q=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"}}),A=new ke({props:{title:"PromptLearningConfig",local:"peft.PromptLearningConfig",headingTag:"h2"}}),R=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"}}),G=new mt({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(),l(N.$$.fragment),pe=o(),l(O.$$.fragment),me=o(),E=i("p"),E.innerHTML=Ge,le=o(),l(D.$$.fragment),de=o(),f=i("div"),l(H.$$.fragment),we=o(),K=i("p"),K.innerHTML=Ke,Me=o(),b=i("div"),l(j.$$.fragment),Le=o(),W=i("p"),W.textContent=We,Ne=o(),B=i("p"),B.textContent=Be,Oe=o(),k=i("div"),l(I.$$.fragment),Ee=o(),J=i("p"),J.textContent=Je,De=o(),y=i("div"),l(V.$$.fragment),He=o(),Q=i("p"),Q.textContent=Qe,je=o(),X=i("p"),X.innerHTML=Xe,Ie=o(),w=i("div"),l(z.$$.fragment),Ve=o(),Y=i("p"),Y.textContent=Ye,ze=o(),M=i("div"),l(U.$$.fragment),Ue=o(),Z=i("p"),Z.textContent=Ze,Fe=o(),L=i("div"),l(F.$$.fragment),Se=o(),ee=i("p"),ee.textContent=et,ge=o(),l(S.$$.fragment),ce=o(),P=i("div"),l(q.$$.fragment),qe=o(),te=i("p"),te.innerHTML=tt,ue=o(),l(A.$$.fragment),he=o(),C=i("div"),l(R.$$.fragment),Ae=o(),ne=i("p"),ne.innerHTML=nt,_e=o(),l(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),me=r(e),E=s(e,"P",{"data-svelte-h":!0}),_(E)!=="svelte-wpcb2j"&&(E.innerHTML=Ge),le=r(e),d(D.$$.fragment,e),de=r(e),f=s(e,"DIV",{class:!0});var m=v(f);d(H.$$.fragment,m),we=r(m),K=s(m,"P",{"data-svelte-h":!0}),_(K)!=="svelte-1mh9vl"&&(K.innerHTML=Ke),Me=r(m),b=s(m,"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(m),k=s(m,"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(m),y=s(m,"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(m),w=s(m,"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(m),M=s(m,"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(m),L=s(m,"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),m.forEach(n),ge=r(e),d(S.$$.fragment,e),ce=r(e),P=s(e,"DIV",{class:!0});var Ce=v(P);d(q.$$.fragment,Ce),qe=r(Ce),te=s(Ce,"P",{"data-svelte-h":!0}),_(te)!=="svelte-1r1kq2j"&&(te.innerHTML=tt),Ce.forEach(n),ue=r(e),d(A.$$.fragment,e),he=r(e),C=s(e,"DIV",{class:!0});var Te=v(C);d(R.$$.fragment,Te),Ae=r(Te),ne=s(Te,"P",{"data-svelte-h":!0}),_(ne)!=="svelte-1pudpqu"&&(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),g(N,e,a),p(e,pe,a),g(O,e,a),p(e,me,a),p(e,E,a),p(e,le,a),g(D,e,a),p(e,de,a),p(e,f,a),g(H,f,null),t(f,we),t(f,K),t(f,Me),t(f,b),g(j,b,null),t(b,Le),t(b,W),t(b,Ne),t(b,B),t(f,Oe),t(f,k),g(I,k,null),t(k,Ee),t(k,J),t(f,De),t(f,y),g(V,y,null),t(y,He),t(y,Q),t(y,je),t(y,X),t(f,Ie),t(f,w),g(z,w,null),t(w,Ve),t(w,Y),t(f,ze),t(f,M),g(U,M,null),t(M,Ue),t(M,Z),t(f,Fe),t(f,L),g(F,L,null),t(L,Se),t(L,ee),p(e,ge,a),g(S,e,a),p(e,ce,a),p(e,P,a),g(q,P,null),t(P,qe),t(P,te),p(e,ue,a),g(A,e,a),p(e,he,a),p(e,C,a),g(R,C,null),t(C,Ae),t(C,ne),p(e,_e,a),g(G,e,a),p(e,ve,a),p(e,ie,a),$e=!0},p:rt,i(e){$e||(c(N.$$.fragment,e),c(O.$$.fragment,e),c(D.$$.fragment,e),c(H.$$.fragment,e),c(j.$$.fragment,e),c(I.$$.fragment,e),c(V.$$.fragment,e),c(z.$$.fragment,e),c(U.$$.fragment,e),c(F.$$.fragment,e),c(S.$$.fragment,e),c(q.$$.fragment,e),c(A.$$.fragment,e),c(R.$$.fragment,e),c(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(q.$$.fragment,e),u(A.$$.fragment,e),u(R.$$.fragment,e),u(G.$$.fragment,e),$e=!1},d(e){e&&(n(se),n(ae),n(fe),n(pe),n(me),n(E),n(le),n(de),n(f),n(ge),n(ce),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(q),h(A,e),h(R),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 gt(Re){return at(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vt extends it{constructor(x){super(),st(this,x,gt,lt,ot,{})}}export{vt as component};
