import{s as ve,n as Le,o as Ce}from"../chunks/scheduler.4cd3e004.js";import{S as xe,i as we,e as i,s as a,c as p,h as Te,a as l,d as t,b as n,f as E,g as m,j as H,k as S,l as s,m as o,n as f,t as d,o as u,p as g}from"../chunks/index.b664cb2d.js";import{D as j}from"../chunks/Docstring.9ceb4334.js";import{H as se,E as Oe}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.179b63f8.js";function ke(ue){let h,z,V,G,L,K,C,ge='<a href="https://hf.co/papers/2309.14859" rel="nofollow">LyCORIS</a> (Lora beYond Conventional methods, Other Rank adaptation Implementations for Stable diffusion) are LoRA-like matrix decomposition adapters that modify the cross-attention layer of the UNet. The <a href="loha">LoHa</a> and <a href="lokr">LoKr</a> methods inherit from the <code>Lycoris</code> classes here.',Y,x,B,y,w,ie,R,he="A base config for LyCORIS like adapters",J,T,Q,c,O,le,M,ye="A base layer for LyCORIS like adapters",ce,$,k,pe,U,_e="Merge the active adapter weights into the base weights",me,b,N,fe,A,$e="This method unmerges all merged adapter layers from the base weights.",W,P,X,_,I,de,F,be="A base tuner for LyCORIS like adapters",Z,D,ee,q,te;return L=new se({props:{title:"LyCORIS",local:"lycoris",headingTag:"h1"}}),x=new se({props:{title:"LycorisConfig",local:"peft.tuners.lycoris_utils.LycorisConfig",headingTag:"h2"}}),w=new j({props:{name:"class peft.tuners.lycoris_utils.LycorisConfig",anchor:"peft.tuners.lycoris_utils.LycorisConfig",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:"rank_pattern",val:": Optional[dict] = <factory>"},{name:"alpha_pattern",val:": Optional[dict] = <factory>"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/lycoris_utils.py#L35"}}),T=new se({props:{title:"LycorisLayer",local:"peft.tuners.lycoris_utils.LycorisLayer",headingTag:"h2"}}),O=new j({props:{name:"class peft.tuners.lycoris_utils.LycorisLayer",anchor:"peft.tuners.lycoris_utils.LycorisLayer",parameters:[{name:"base_layer",val:": nn.Module"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/lycoris_utils.py#L60"}}),k=new j({props:{name:"merge",anchor:"peft.tuners.lycoris_utils.LycorisLayer.merge",parameters:[{name:"safe_merge",val:": bool = False"},{name:"adapter_names",val:": Optional[list[str]] = None"}],parametersDescription:[{anchor:"peft.tuners.lycoris_utils.LycorisLayer.merge.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"},{anchor:"peft.tuners.lycoris_utils.LycorisLayer.merge.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"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/lycoris_utils.py#L114"}}),N=new j({props:{name:"unmerge",anchor:"peft.tuners.lycoris_utils.LycorisLayer.unmerge",parameters:[],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/lycoris_utils.py#L168"}}),P=new se({props:{title:"LycorisTuner",local:"peft.tuners.lycoris_utils.LycorisTuner",headingTag:"h2"}}),I=new j({props:{name:"class peft.tuners.lycoris_utils.LycorisTuner",anchor:"peft.tuners.lycoris_utils.LycorisTuner",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.lycoris_utils.LycorisTuner.model",description:"<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014; The model to be adapted.",name:"model"},{anchor:"peft.tuners.lycoris_utils.LycorisTuner.config",description:'<strong>config</strong> (<a href="/docs/peft/main/en/package_reference/lora#peft.LoraConfig">LoraConfig</a>) &#x2014; The configuration of the Lora model.',name:"config"},{anchor:"peft.tuners.lycoris_utils.LycorisTuner.adapter_name",description:"<strong>adapter_name</strong> (<code>str</code>) &#x2014; The name of the adapter, defaults to <code>&quot;default&quot;</code>.",name:"adapter_name"},{anchor:"peft.tuners.lycoris_utils.LycorisTuner.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"}],source:"https://github.com/huggingface/peft/blob/main/src/peft/tuners/lycoris_utils.py#L194"}}),D=new Oe({props:{source:"https://github.com/huggingface/peft/blob/main/docs/source/package_reference/adapter_utils.md"}}),{c(){h=i("meta"),z=a(),V=i("p"),G=a(),p(L.$$.fragment),K=a(),C=i("p"),C.innerHTML=ge,Y=a(),p(x.$$.fragment),B=a(),y=i("div"),p(w.$$.fragment),ie=a(),R=i("p"),R.textContent=he,J=a(),p(T.$$.fragment),Q=a(),c=i("div"),p(O.$$.fragment),le=a(),M=i("p"),M.textContent=ye,ce=a(),$=i("div"),p(k.$$.fragment),pe=a(),U=i("p"),U.textContent=_e,me=a(),b=i("div"),p(N.$$.fragment),fe=a(),A=i("p"),A.textContent=$e,W=a(),p(P.$$.fragment),X=a(),_=i("div"),p(I.$$.fragment),de=a(),F=i("p"),F.textContent=be,Z=a(),p(D.$$.fragment),ee=a(),q=i("p"),this.h()},l(e){const r=Te("svelte-u9bgzb",document.head);h=l(r,"META",{name:!0,content:!0}),r.forEach(t),z=n(e),V=l(e,"P",{}),E(V).forEach(t),G=n(e),m(L.$$.fragment,e),K=n(e),C=l(e,"P",{"data-svelte-h":!0}),H(C)!=="svelte-u1n5we"&&(C.innerHTML=ge),Y=n(e),m(x.$$.fragment,e),B=n(e),y=l(e,"DIV",{class:!0});var re=E(y);m(w.$$.fragment,re),ie=n(re),R=l(re,"P",{"data-svelte-h":!0}),H(R)!=="svelte-lekccd"&&(R.textContent=he),re.forEach(t),J=n(e),m(T.$$.fragment,e),Q=n(e),c=l(e,"DIV",{class:!0});var v=E(c);m(O.$$.fragment,v),le=n(v),M=l(v,"P",{"data-svelte-h":!0}),H(M)!=="svelte-n4c8qe"&&(M.textContent=ye),ce=n(v),$=l(v,"DIV",{class:!0});var ae=E($);m(k.$$.fragment,ae),pe=n(ae),U=l(ae,"P",{"data-svelte-h":!0}),H(U)!=="svelte-12t0sju"&&(U.textContent=_e),ae.forEach(t),me=n(v),b=l(v,"DIV",{class:!0});var ne=E(b);m(N.$$.fragment,ne),fe=n(ne),A=l(ne,"P",{"data-svelte-h":!0}),H(A)!=="svelte-ukua1i"&&(A.textContent=$e),ne.forEach(t),v.forEach(t),W=n(e),m(P.$$.fragment,e),X=n(e),_=l(e,"DIV",{class:!0});var oe=E(_);m(I.$$.fragment,oe),de=n(oe),F=l(oe,"P",{"data-svelte-h":!0}),H(F)!=="svelte-uzavf9"&&(F.textContent=be),oe.forEach(t),Z=n(e),m(D.$$.fragment,e),ee=n(e),q=l(e,"P",{}),E(q).forEach(t),this.h()},h(){S(h,"name","hf:doc:metadata"),S(h,"content",Ne),S(y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(b,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),S(_,"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,r){s(document.head,h),o(e,z,r),o(e,V,r),o(e,G,r),f(L,e,r),o(e,K,r),o(e,C,r),o(e,Y,r),f(x,e,r),o(e,B,r),o(e,y,r),f(w,y,null),s(y,ie),s(y,R),o(e,J,r),f(T,e,r),o(e,Q,r),o(e,c,r),f(O,c,null),s(c,le),s(c,M),s(c,ce),s(c,$),f(k,$,null),s($,pe),s($,U),s(c,me),s(c,b),f(N,b,null),s(b,fe),s(b,A),o(e,W,r),f(P,e,r),o(e,X,r),o(e,_,r),f(I,_,null),s(_,de),s(_,F),o(e,Z,r),f(D,e,r),o(e,ee,r),o(e,q,r),te=!0},p:Le,i(e){te||(d(L.$$.fragment,e),d(x.$$.fragment,e),d(w.$$.fragment,e),d(T.$$.fragment,e),d(O.$$.fragment,e),d(k.$$.fragment,e),d(N.$$.fragment,e),d(P.$$.fragment,e),d(I.$$.fragment,e),d(D.$$.fragment,e),te=!0)},o(e){u(L.$$.fragment,e),u(x.$$.fragment,e),u(w.$$.fragment,e),u(T.$$.fragment,e),u(O.$$.fragment,e),u(k.$$.fragment,e),u(N.$$.fragment,e),u(P.$$.fragment,e),u(I.$$.fragment,e),u(D.$$.fragment,e),te=!1},d(e){e&&(t(z),t(V),t(G),t(K),t(C),t(Y),t(B),t(y),t(J),t(Q),t(c),t(W),t(X),t(_),t(Z),t(ee),t(q)),t(h),g(L,e),g(x,e),g(w),g(T,e),g(O),g(k),g(N),g(P,e),g(I),g(D,e)}}}const Ne='{"title":"LyCORIS","local":"lycoris","sections":[{"title":"LycorisConfig","local":"peft.tuners.lycoris_utils.LycorisConfig","sections":[],"depth":2},{"title":"LycorisLayer","local":"peft.tuners.lycoris_utils.LycorisLayer","sections":[],"depth":2},{"title":"LycorisTuner","local":"peft.tuners.lycoris_utils.LycorisTuner","sections":[],"depth":2}],"depth":1}';function Pe(ue){return Ce(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Re extends xe{constructor(h){super(),we(this,h,Pe,ke,ve,{})}}export{Re as component};
