Buckets:

rtrm's picture
download
raw
11.1 kB
import{s as Je,o as Ke,n as Qe}from"../chunks/scheduler.8c3d61f6.js";import{S as We,i as Xe,g as n,s as a,r as _,A as Ye,h as s,f as i,c as r,j as y,u as b,x as p,k as E,y as t,a as m,v as x,d as P,t as T,w}from"../chunks/index.589a98e8.js";import{T as Ze}from"../chunks/Tip.42aa8582.js";import{D as ne}from"../chunks/Docstring.27406313.js";import{H as Be,E as et}from"../chunks/EditOnGithub.e5a8d9cb.js";function tt(oe){let f,L='Refer to the <a href="../../tutorials/using_peft_for_inference.md">Inference with PEFT</a> tutorial for an overview of how to use PEFT in Diffusers for inference.';return{c(){f=n("p"),f.innerHTML=L},l(u){f=s(u,"P",{"data-svelte-h":!0}),p(f)!=="svelte-1yhqcl5"&&(f.innerHTML=L)},m(u,q){m(u,f,q)},p:Qe,d(u){u&&i(f)}}}function at(oe){let f,L,u,q,C,ie,A,Fe='Diffusers supports loading adapters such as <a href="../../using-diffusers/loading_adapters">LoRA</a> with the <a href="https://huggingface.co/docs/peft/index" rel="nofollow">PEFT</a> library with the <a href="/docs/diffusers/pr_7930/en/api/loaders/peft#diffusers.loaders.PeftAdapterMixin">PeftAdapterMixin</a> class. This allows modeling classes in Diffusers like <a href="/docs/diffusers/pr_7930/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a> to load an adapter.',de,M,le,H,fe,o,F,ce,S,De=`A class containing all functions for loading and using adapters weights that are supported in PEFT library. For
more details about adapters and injecting them in a transformer-based model, check out the PEFT
<a href="https://huggingface.co/docs/peft/index" rel="nofollow">documentation</a>.`,he,G,Ie="Install the latest version of PEFT, and use this mixin to:",ge,R,je="<li>Attach new adapters in the model.</li> <li>Attach multiple adapters and iteratively activate/deactivate them.</li> <li>Activate/deactivate all adapters from the model.</li> <li>Get a list of the active adapters.</li>",$e,c,D,ve,z,Ue="Gets the current list of active adapters of the model.",_e,N,Ve=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,be,h,I,xe,O,ke=`Adds a new adapter to the current model for training. If no adapter name is passed, a default name is assigned
to the adapter to follow the convention of the PEFT library.`,Pe,B,qe=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them in the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,Te,g,j,we,J,Se="Disable all adapters attached to the model and fallback to inference with the base model only.",Me,K,Ge=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,ye,$,U,Ee,Q,Re=`Enable adapters that are attached to the model. The model uses <code>self.active_adapters()</code> to retrieve the list of
adapters to enable.`,Le,W,ze=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,Ce,v,V,Ae,X,Ne="Sets a specific adapter by forcing the model to only use that adapter and disables the other adapters.",He,Y,Oe=`If you are not familiar with adapters and PEFT methods, we invite you to read more about them on the PEFT
<a href="https://huggingface.co/docs/peft" rel="nofollow">documentation</a>.`,pe,k,me,se,ue;return C=new Be({props:{title:"PEFT",local:"peft",headingTag:"h1"}}),M=new Ze({props:{$$slots:{default:[tt]},$$scope:{ctx:oe}}}),H=new Be({props:{title:"PeftAdapterMixin",local:"diffusers.loaders.PeftAdapterMixin",headingTag:"h2"}}),F=new ne({props:{name:"class diffusers.loaders.PeftAdapterMixin",anchor:"diffusers.loaders.PeftAdapterMixin",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L20"}}),D=new ne({props:{name:"active_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.active_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L168"}}),I=new ne({props:{name:"add_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter",parameters:[{name:"adapter_config",val:""},{name:"adapter_name",val:": str = 'default'"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter.adapter_config",description:`<strong>adapter_config</strong> (<code>[~peft.PeftConfig]</code>) &#x2014;
The configuration of the adapter to add; supported adapters are non-prefix tuning and adaption prompt
methods.`,name:"adapter_config"},{anchor:"diffusers.loaders.PeftAdapterMixin.add_adapter.adapter_name",description:`<strong>adapter_name</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;default&quot;</code>) &#x2014;
The name of the adapter to add. If no name is passed, a default name is assigned to the adapter.`,name:"adapter_name"}],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L36"}}),j=new ne({props:{name:"disable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.disable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L123"}}),U=new ne({props:{name:"enable_adapters",anchor:"diffusers.loaders.PeftAdapterMixin.enable_adapters",parameters:[],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L145"}}),V=new ne({props:{name:"set_adapter",anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter",parameters:[{name:"adapter_name",val:": Union"}],parametersDescription:[{anchor:"diffusers.loaders.PeftAdapterMixin.set_adapter.adapter_name",description:`<strong>adapter_name</strong> (Union[str, List[str]])) &#x2014;
The list of adapters to set or the adapter name in the case of a single adapter.`,name:"adapter_name"}],source:"https://github.com/huggingface/diffusers/blob/vr_7930/src/diffusers/loaders/peft.py#L74"}}),k=new et({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/loaders/peft.md"}}),{c(){f=n("meta"),L=a(),u=n("p"),q=a(),_(C.$$.fragment),ie=a(),A=n("p"),A.innerHTML=Fe,de=a(),_(M.$$.fragment),le=a(),_(H.$$.fragment),fe=a(),o=n("div"),_(F.$$.fragment),ce=a(),S=n("p"),S.innerHTML=De,he=a(),G=n("p"),G.textContent=Ie,ge=a(),R=n("ul"),R.innerHTML=je,$e=a(),c=n("div"),_(D.$$.fragment),ve=a(),z=n("p"),z.textContent=Ue,_e=a(),N=n("p"),N.innerHTML=Ve,be=a(),h=n("div"),_(I.$$.fragment),xe=a(),O=n("p"),O.textContent=ke,Pe=a(),B=n("p"),B.innerHTML=qe,Te=a(),g=n("div"),_(j.$$.fragment),we=a(),J=n("p"),J.textContent=Se,Me=a(),K=n("p"),K.innerHTML=Ge,ye=a(),$=n("div"),_(U.$$.fragment),Ee=a(),Q=n("p"),Q.innerHTML=Re,Le=a(),W=n("p"),W.innerHTML=ze,Ce=a(),v=n("div"),_(V.$$.fragment),Ae=a(),X=n("p"),X.textContent=Ne,He=a(),Y=n("p"),Y.innerHTML=Oe,pe=a(),_(k.$$.fragment),me=a(),se=n("p"),this.h()},l(e){const d=Ye("svelte-u9bgzb",document.head);f=s(d,"META",{name:!0,content:!0}),d.forEach(i),L=r(e),u=s(e,"P",{}),y(u).forEach(i),q=r(e),b(C.$$.fragment,e),ie=r(e),A=s(e,"P",{"data-svelte-h":!0}),p(A)!=="svelte-1b7rq8x"&&(A.innerHTML=Fe),de=r(e),b(M.$$.fragment,e),le=r(e),b(H.$$.fragment,e),fe=r(e),o=s(e,"DIV",{class:!0});var l=y(o);b(F.$$.fragment,l),ce=r(l),S=s(l,"P",{"data-svelte-h":!0}),p(S)!=="svelte-1f31nfo"&&(S.innerHTML=De),he=r(l),G=s(l,"P",{"data-svelte-h":!0}),p(G)!=="svelte-jgx411"&&(G.textContent=Ie),ge=r(l),R=s(l,"UL",{"data-svelte-h":!0}),p(R)!=="svelte-70o87y"&&(R.innerHTML=je),$e=r(l),c=s(l,"DIV",{class:!0});var Z=y(c);b(D.$$.fragment,Z),ve=r(Z),z=s(Z,"P",{"data-svelte-h":!0}),p(z)!=="svelte-1i9yvzx"&&(z.textContent=Ue),_e=r(Z),N=s(Z,"P",{"data-svelte-h":!0}),p(N)!=="svelte-pm6rj0"&&(N.innerHTML=Ve),Z.forEach(i),be=r(l),h=s(l,"DIV",{class:!0});var ee=y(h);b(I.$$.fragment,ee),xe=r(ee),O=s(ee,"P",{"data-svelte-h":!0}),p(O)!=="svelte-ayg1h"&&(O.textContent=ke),Pe=r(ee),B=s(ee,"P",{"data-svelte-h":!0}),p(B)!=="svelte-m719pe"&&(B.innerHTML=qe),ee.forEach(i),Te=r(l),g=s(l,"DIV",{class:!0});var te=y(g);b(j.$$.fragment,te),we=r(te),J=s(te,"P",{"data-svelte-h":!0}),p(J)!=="svelte-stjif2"&&(J.textContent=Se),Me=r(te),K=s(te,"P",{"data-svelte-h":!0}),p(K)!=="svelte-pm6rj0"&&(K.innerHTML=Ge),te.forEach(i),ye=r(l),$=s(l,"DIV",{class:!0});var ae=y($);b(U.$$.fragment,ae),Ee=r(ae),Q=s(ae,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-hmbjwp"&&(Q.innerHTML=Re),Le=r(ae),W=s(ae,"P",{"data-svelte-h":!0}),p(W)!=="svelte-pm6rj0"&&(W.innerHTML=ze),ae.forEach(i),Ce=r(l),v=s(l,"DIV",{class:!0});var re=y(v);b(V.$$.fragment,re),Ae=r(re),X=s(re,"P",{"data-svelte-h":!0}),p(X)!=="svelte-1kp30gn"&&(X.textContent=Ne),He=r(re),Y=s(re,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-pm6rj0"&&(Y.innerHTML=Oe),re.forEach(i),l.forEach(i),pe=r(e),b(k.$$.fragment,e),me=r(e),se=s(e,"P",{}),y(se).forEach(i),this.h()},h(){E(f,"name","hf:doc:metadata"),E(f,"content",rt),E(c,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(h,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(g,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),E(o,"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,d){t(document.head,f),m(e,L,d),m(e,u,d),m(e,q,d),x(C,e,d),m(e,ie,d),m(e,A,d),m(e,de,d),x(M,e,d),m(e,le,d),x(H,e,d),m(e,fe,d),m(e,o,d),x(F,o,null),t(o,ce),t(o,S),t(o,he),t(o,G),t(o,ge),t(o,R),t(o,$e),t(o,c),x(D,c,null),t(c,ve),t(c,z),t(c,_e),t(c,N),t(o,be),t(o,h),x(I,h,null),t(h,xe),t(h,O),t(h,Pe),t(h,B),t(o,Te),t(o,g),x(j,g,null),t(g,we),t(g,J),t(g,Me),t(g,K),t(o,ye),t(o,$),x(U,$,null),t($,Ee),t($,Q),t($,Le),t($,W),t(o,Ce),t(o,v),x(V,v,null),t(v,Ae),t(v,X),t(v,He),t(v,Y),m(e,pe,d),x(k,e,d),m(e,me,d),m(e,se,d),ue=!0},p(e,[d]){const l={};d&2&&(l.$$scope={dirty:d,ctx:e}),M.$set(l)},i(e){ue||(P(C.$$.fragment,e),P(M.$$.fragment,e),P(H.$$.fragment,e),P(F.$$.fragment,e),P(D.$$.fragment,e),P(I.$$.fragment,e),P(j.$$.fragment,e),P(U.$$.fragment,e),P(V.$$.fragment,e),P(k.$$.fragment,e),ue=!0)},o(e){T(C.$$.fragment,e),T(M.$$.fragment,e),T(H.$$.fragment,e),T(F.$$.fragment,e),T(D.$$.fragment,e),T(I.$$.fragment,e),T(j.$$.fragment,e),T(U.$$.fragment,e),T(V.$$.fragment,e),T(k.$$.fragment,e),ue=!1},d(e){e&&(i(L),i(u),i(q),i(ie),i(A),i(de),i(le),i(fe),i(o),i(pe),i(me),i(se)),i(f),w(C,e),w(M,e),w(H,e),w(F),w(D),w(I),w(j),w(U),w(V),w(k,e)}}}const rt='{"title":"PEFT","local":"peft","sections":[{"title":"PeftAdapterMixin","local":"diffusers.loaders.PeftAdapterMixin","sections":[],"depth":2}],"depth":1}';function nt(oe){return Ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ft extends We{constructor(f){super(),Xe(this,f,nt,at,Je,{})}}export{ft as component};

Xet Storage Details

Size:
11.1 kB
·
Xet hash:
7f7d3cd1c35c5758d3f6c83d04f8d3cdba1ea12c9285e26313a9ec42d21a871b

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