Buckets:

hf-doc-build/doc / diffusers /v0.13.0 /en /_app /pages /using-diffusers /reproducibility.mdx-hf-doc-builder.js
rtrm's picture
download
raw
25.7 kB
import{S as An,i as Nn,s as Ln,e as r,k as d,w as b,t as l,M as Sn,c as a,d as t,m as u,a as i,x as _,h as p,b as c,G as n,g as o,y as P,q as $,o as j,B as k,v as On}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mn}from"../../chunks/Tip-hf-doc-builder.js";import{D as Hn}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ct}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ft}from"../../chunks/IconCopyLink-hf-doc-builder.js";function Wn(ne){let f,w,m,h,D,v,W,x;return{c(){f=r("p"),w=l("It might be a bit unintuitive at first to pass "),m=r("code"),h=l("generator"),D=l(` objects to the pipelines instead of
just integer values representing the seed, but this is the recommended design when dealing with
probabilistic models in PyTorch as generators are `),v=r("em"),W=l("random states"),x=l(` that are advanced and can thus be
passed to multiple pipelines in a sequence.`)},l(I){f=a(I,"P",{});var g=i(f);w=p(g,"It might be a bit unintuitive at first to pass "),m=a(g,"CODE",{});var y=i(m);h=p(y,"generator"),y.forEach(t),D=p(g,` objects to the pipelines instead of
just integer values representing the seed, but this is the recommended design when dealing with
probabilistic models in PyTorch as generators are `),v=a(g,"EM",{});var se=i(v);W=p(se,"random states"),se.forEach(t),x=p(g,` that are advanced and can thus be
passed to multiple pipelines in a sequence.`),g.forEach(t)},m(I,g){o(I,f,g),n(f,w),n(f,m),n(m,h),n(f,D),n(f,v),n(v,W),n(f,x)},d(I){I&&t(f)}}}function Fn(ne){let f,w;return{c(){f=r("p"),w=l(`As a consequence, we recommend always passing a CPU generator if Reproducibility is important.
The loss of performance is often neglectable, but one can be sure to generate much more similar
values than if the pipeline would have been run on CPU.`)},l(m){f=a(m,"P",{});var h=i(f);w=p(h,`As a consequence, we recommend always passing a CPU generator if Reproducibility is important.
The loss of performance is often neglectable, but one can be sure to generate much more similar
values than if the pipeline would have been run on CPU.`),h.forEach(t)},m(m,h){o(m,f,h),n(f,w)},d(m){m&&t(f)}}}function Bn(ne){let f,w,m,h,D,v,W,x,I,g,y,se,F,mt,ht,Ge,re,vt,Re,ae,ie,_e,gt,wt,Me,oe,yt,Ae,T,M,Pe,B,bt,$e,_t,Ne,le,Pt,Le,A,$t,pe,jt,kt,Se,z,Oe,E,Et,J,je,Ut,Dt,K,xt,It,He,Q,We,de,Tt,Fe,ue,qt,Be,N,ze,ce,Ct,Je,fe,Gt,Ke,V,Qe,me,Rt,Ve,U,Mt,he,ke,At,Nt,Ee,Lt,St,Xe,X,Ye,ve,Ot,Ze,L,et,S,Ht,ge,Wt,Ft,tt,q,O,Ue,Y,Bt,De,zt,nt,C,H,xe,Z,Jt,Ie,Kt,st,G,ee,Qt,R,Vt,Te,Xt,Yt,qe,Zt,en,rt;return v=new ft({}),B=new ft({}),z=new ct({props:{code:`from diffusers import DDIMPipeline
import numpy as np
model_id = "google/ddpm-cifar10-32"
# load model and scheduler
ddim = DDIMPipeline.from_pretrained(model_id)
# run pipeline for just two steps and return numpy tensor
image = ddim(num_inference_steps=2, output_type="np").images
print(np.abs(image).sum())`,highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMPipeline
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
model_id = <span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>
<span class="hljs-comment"># load model and scheduler</span>
ddim = DDIMPipeline.from_pretrained(model_id)
<span class="hljs-comment"># run pipeline for just two steps and return numpy tensor</span>
image = ddim(num_inference_steps=<span class="hljs-number">2</span>, output_type=<span class="hljs-string">&quot;np&quot;</span>).images
<span class="hljs-built_in">print</span>(np.<span class="hljs-built_in">abs</span>(image).<span class="hljs-built_in">sum</span>())`}}),Q=new ct({props:{code:`import torch
from diffusers import DDIMPipeline
import numpy as np
model_id = "google/ddpm-cifar10-32"
# load model and scheduler
ddim = DDIMPipeline.from_pretrained(model_id)
# create a generator for reproducibility
generator = torch.Generator(device="cpu").manual_seed(0)
# run pipeline for just two steps and return numpy tensor
image = ddim(num_inference_steps=2, output_type="np", generator=generator).images
print(np.abs(image).sum())`,highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMPipeline
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
model_id = <span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>
<span class="hljs-comment"># load model and scheduler</span>
ddim = DDIMPipeline.from_pretrained(model_id)
<span class="hljs-comment"># create a generator for reproducibility</span>
generator = torch.Generator(device=<span class="hljs-string">&quot;cpu&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-comment"># run pipeline for just two steps and return numpy tensor</span>
image = ddim(num_inference_steps=<span class="hljs-number">2</span>, output_type=<span class="hljs-string">&quot;np&quot;</span>, generator=generator).images
<span class="hljs-built_in">print</span>(np.<span class="hljs-built_in">abs</span>(image).<span class="hljs-built_in">sum</span>())`}}),N=new Mn({props:{$$slots:{default:[Wn]},$$scope:{ctx:ne}}}),V=new ct({props:{code:`import torch
from diffusers import DDIMPipeline
import numpy as np
model_id = "google/ddpm-cifar10-32"
# load model and scheduler
ddim = DDIMPipeline.from_pretrained(model_id)
ddim.to("cuda")
# create a generator for reproducibility
generator = torch.Generator(device="cuda").manual_seed(0)
# run pipeline for just two steps and return numpy tensor
image = ddim(num_inference_steps=2, output_type="np", generator=generator).images
print(np.abs(image).sum())`,highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMPipeline
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
model_id = <span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>
<span class="hljs-comment"># load model and scheduler</span>
ddim = DDIMPipeline.from_pretrained(model_id)
ddim.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># create a generator for reproducibility</span>
generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-comment"># run pipeline for just two steps and return numpy tensor</span>
image = ddim(num_inference_steps=<span class="hljs-number">2</span>, output_type=<span class="hljs-string">&quot;np&quot;</span>, generator=generator).images
<span class="hljs-built_in">print</span>(np.<span class="hljs-built_in">abs</span>(image).<span class="hljs-built_in">sum</span>())`}}),X=new ct({props:{code:`import torch
from diffusers import DDIMPipeline
import numpy as np
model_id = "google/ddpm-cifar10-32"
# load model and scheduler
ddim = DDIMPipeline.from_pretrained(model_id)
ddim.to("cuda")
# create a generator for reproducibility
generator = torch.manual_seed(0)
# run pipeline for just two steps and return numpy tensor
image = ddim(num_inference_steps=2, output_type="np", generator=generator).images
print(np.abs(image).sum())`,highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDIMPipeline
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
model_id = <span class="hljs-string">&quot;google/ddpm-cifar10-32&quot;</span>
<span class="hljs-comment"># load model and scheduler</span>
ddim = DDIMPipeline.from_pretrained(model_id)
ddim.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-comment"># create a generator for reproducibility</span>
generator = torch.manual_seed(<span class="hljs-number">0</span>)
<span class="hljs-comment"># run pipeline for just two steps and return numpy tensor</span>
image = ddim(num_inference_steps=<span class="hljs-number">2</span>, output_type=<span class="hljs-string">&quot;np&quot;</span>, generator=generator).images
<span class="hljs-built_in">print</span>(np.<span class="hljs-built_in">abs</span>(image).<span class="hljs-built_in">sum</span>())`}}),L=new Mn({props:{$$slots:{default:[Fn]},$$scope:{ctx:ne}}}),Y=new ft({}),Z=new ft({}),ee=new Hn({props:{name:"diffusers.utils.randn_tensor",anchor:"diffusers.utils.randn_tensor",parameters:[{name:"shape",val:": typing.Union[typing.Tuple, typing.List]"},{name:"generator",val:": typing.Union[typing.List[ForwardRef('torch.Generator')], ForwardRef('torch.Generator'), NoneType] = None"},{name:"device",val:": typing.Optional[ForwardRef('torch.device')] = None"},{name:"dtype",val:": typing.Optional[ForwardRef('torch.dtype')] = None"},{name:"layout",val:": typing.Optional[ForwardRef('torch.layout')] = None"}],source:"https://github.com/huggingface/diffusers/blob/v0.13.0/src/diffusers/utils/torch_utils.py#L29"}}),{c(){f=r("meta"),w=d(),m=r("h1"),h=r("a"),D=r("span"),b(v.$$.fragment),W=d(),x=r("span"),I=l("Reproducibility"),g=d(),y=r("p"),se=l(`Before reading about reproducibility for Diffusers, it is strongly recommended to take a look at
`),F=r("a"),mt=l("PyTorch\u2019s statement about reproducibility"),ht=l("."),Ge=d(),re=r("p"),vt=l("PyTorch states that"),Re=d(),ae=r("blockquote"),ie=r("p"),_e=r("em"),gt=l("completely reproducible results are not guaranteed across PyTorch releases, individual commits, or different platforms."),wt=l(`
While one can never expect the same results across platforms, one can expect results to be reproducible
across releases, platforms, etc\u2026 within a certain tolerance. However, this tolerance strongly varies
depending on the diffusion pipeline and checkpoint.`),Me=d(),oe=r("p"),yt=l("In the following, we show how to best control sources of randomness for diffusion models."),Ae=d(),T=r("h2"),M=r("a"),Pe=r("span"),b(B.$$.fragment),bt=d(),$e=r("span"),_t=l("Inference"),Ne=d(),le=r("p"),Pt=l(`During inference, diffusion pipelines heavily rely on random sampling operations, such as the creating the
gaussian noise tensors to be denoised and adding noise to the scheduling step.`),Le=d(),A=r("p"),$t=l("Let\u2019s have a look at an example. We run the "),pe=r("a"),jt=l("DDIM pipeline"),kt=l(`
for just two inference steps and return a numpy tensor to look into the numerical values of the output.`),Se=d(),b(z.$$.fragment),Oe=d(),E=r("p"),Et=l(`Running the above prints a value of 1464.2076, but running it again prints a different
value of 1495.1768. What is going on here? Every time the pipeline is run, gaussian noise
is created and step-wise denoised. To create the gaussian noise with `),J=r("a"),je=r("code"),Ut=l("torch.randn"),Dt=l(`, a different random seed is taken every time, thus leading to a different result.
This is a desired property of diffusion pipelines, as it means that the pipeline can create a different random image every time it is run. In many cases, one would like to generate the exact same image of a certain
run, for which case an instance of a `),K=r("a"),xt=l("PyTorch generator"),It=l(" has to be passed:"),He=d(),b(Q.$$.fragment),We=d(),de=r("p"),Tt=l(`Running the above always prints a value of 1491.1711 - also upon running it again because we
define the generator object to be passed to all random functions of the pipeline.`),Fe=d(),ue=r("p"),qt=l("If you run this code snippet on your specific hardware and version, you should get a similar, if not the same, result."),Be=d(),b(N.$$.fragment),ze=d(),ce=r("p"),Ct=l(`Great! Now, we know how to write reproducible pipelines, but it gets a bit trickier since the above example only runs on the CPU. How do we also achieve reproducibility on GPU?
In short, one should not expect full reproducibility across different hardware when running pipelines on GPU
as matrix multiplications are less deterministic on GPU than on CPU and diffusion pipelines tend to require
a lot of matrix multiplications. Let\u2019s see what we can do to keep the randomness within limits across
different GPU hardware.`),Je=d(),fe=r("p"),Gt=l(`To achieve maximum speed performance, it is recommended to create the generator directly on GPU when running
the pipeline on GPU:`),Ke=d(),b(V.$$.fragment),Qe=d(),me=r("p"),Rt=l(`Running the above now prints a value of 1389.8634 - even though we\u2019re using the exact same seed!
This is unfortunate as it means we cannot reproduce the results we achieved on GPU, also on CPU.
Nevertheless, it should be expected since the GPU uses a different random number generator than the CPU.`),Ve=d(),U=r("p"),Mt=l("To circumvent this problem, we created a "),he=r("a"),ke=r("code"),At=l("randn_tensor"),Nt=l(` function, which can create random noise
on the CPU and then move the tensor to GPU if necessary. The function is used everywhere inside the pipelines allowing the user to `),Ee=r("strong"),Lt=l("always"),St=l(" pass a CPU generator even if the pipeline is run on GPU:"),Xe=d(),b(X.$$.fragment),Ye=d(),ve=r("p"),Ot=l(`Running the above now prints a value of 1491.1713, much closer to the value of 1491.1711 when
the pipeline is fully run on the CPU.`),Ze=d(),b(L.$$.fragment),et=d(),S=r("p"),Ht=l("Finally, we noticed that more complex pipelines, such as "),ge=r("a"),Wt=l("UnCLIPPipeline"),Ft=l(` are often extremely
susceptible to precision error propagation and thus one cannot expect even similar results across
different GPU hardware or PyTorch versions. In such cases, one has to make sure to run
exactly the same hardware and PyTorch version for full Reproducibility.`),tt=d(),q=r("h2"),O=r("a"),Ue=r("span"),b(Y.$$.fragment),Bt=d(),De=r("span"),zt=l("Randomness utilities"),nt=d(),C=r("h3"),H=r("a"),xe=r("span"),b(Z.$$.fragment),Jt=d(),Ie=r("span"),Kt=l("randn_tensor"),st=d(),G=r("div"),b(ee.$$.fragment),Qt=d(),R=r("p"),Vt=l("This is a helper function that allows to create random tensors on the desired "),Te=r("code"),Xt=l("device"),Yt=l(" with the desired "),qe=r("code"),Zt=l("dtype"),en=l(`. When
passing a list of generators one can seed each batched size individually. If CPU generators are passed the tensor
will always be created on CPU.`),this.h()},l(e){const s=Sn('[data-svelte="svelte-1phssyn"]',document.head);f=a(s,"META",{name:!0,content:!0}),s.forEach(t),w=u(e),m=a(e,"H1",{class:!0});var te=i(m);h=a(te,"A",{id:!0,class:!0,href:!0});var Ce=i(h);D=a(Ce,"SPAN",{});var nn=i(D);_(v.$$.fragment,nn),nn.forEach(t),Ce.forEach(t),W=u(te),x=a(te,"SPAN",{});var sn=i(x);I=p(sn,"Reproducibility"),sn.forEach(t),te.forEach(t),g=u(e),y=a(e,"P",{});var at=i(y);se=p(at,`Before reading about reproducibility for Diffusers, it is strongly recommended to take a look at
`),F=a(at,"A",{href:!0,rel:!0});var rn=i(F);mt=p(rn,"PyTorch\u2019s statement about reproducibility"),rn.forEach(t),ht=p(at,"."),at.forEach(t),Ge=u(e),re=a(e,"P",{});var an=i(re);vt=p(an,"PyTorch states that"),an.forEach(t),Re=u(e),ae=a(e,"BLOCKQUOTE",{});var on=i(ae);ie=a(on,"P",{});var tn=i(ie);_e=a(tn,"EM",{});var ln=i(_e);gt=p(ln,"completely reproducible results are not guaranteed across PyTorch releases, individual commits, or different platforms."),ln.forEach(t),wt=p(tn,`
While one can never expect the same results across platforms, one can expect results to be reproducible
across releases, platforms, etc\u2026 within a certain tolerance. However, this tolerance strongly varies
depending on the diffusion pipeline and checkpoint.`),tn.forEach(t),on.forEach(t),Me=u(e),oe=a(e,"P",{});var pn=i(oe);yt=p(pn,"In the following, we show how to best control sources of randomness for diffusion models."),pn.forEach(t),Ae=u(e),T=a(e,"H2",{class:!0});var it=i(T);M=a(it,"A",{id:!0,class:!0,href:!0});var dn=i(M);Pe=a(dn,"SPAN",{});var un=i(Pe);_(B.$$.fragment,un),un.forEach(t),dn.forEach(t),bt=u(it),$e=a(it,"SPAN",{});var cn=i($e);_t=p(cn,"Inference"),cn.forEach(t),it.forEach(t),Ne=u(e),le=a(e,"P",{});var fn=i(le);Pt=p(fn,`During inference, diffusion pipelines heavily rely on random sampling operations, such as the creating the
gaussian noise tensors to be denoised and adding noise to the scheduling step.`),fn.forEach(t),Le=u(e),A=a(e,"P",{});var ot=i(A);$t=p(ot,"Let\u2019s have a look at an example. We run the "),pe=a(ot,"A",{href:!0});var mn=i(pe);jt=p(mn,"DDIM pipeline"),mn.forEach(t),kt=p(ot,`
for just two inference steps and return a numpy tensor to look into the numerical values of the output.`),ot.forEach(t),Se=u(e),_(z.$$.fragment,e),Oe=u(e),E=a(e,"P",{});var we=i(E);Et=p(we,`Running the above prints a value of 1464.2076, but running it again prints a different
value of 1495.1768. What is going on here? Every time the pipeline is run, gaussian noise
is created and step-wise denoised. To create the gaussian noise with `),J=a(we,"A",{href:!0,rel:!0});var hn=i(J);je=a(hn,"CODE",{});var vn=i(je);Ut=p(vn,"torch.randn"),vn.forEach(t),hn.forEach(t),Dt=p(we,`, a different random seed is taken every time, thus leading to a different result.
This is a desired property of diffusion pipelines, as it means that the pipeline can create a different random image every time it is run. In many cases, one would like to generate the exact same image of a certain
run, for which case an instance of a `),K=a(we,"A",{href:!0,rel:!0});var gn=i(K);xt=p(gn,"PyTorch generator"),gn.forEach(t),It=p(we," has to be passed:"),we.forEach(t),He=u(e),_(Q.$$.fragment,e),We=u(e),de=a(e,"P",{});var wn=i(de);Tt=p(wn,`Running the above always prints a value of 1491.1711 - also upon running it again because we
define the generator object to be passed to all random functions of the pipeline.`),wn.forEach(t),Fe=u(e),ue=a(e,"P",{});var yn=i(ue);qt=p(yn,"If you run this code snippet on your specific hardware and version, you should get a similar, if not the same, result."),yn.forEach(t),Be=u(e),_(N.$$.fragment,e),ze=u(e),ce=a(e,"P",{});var bn=i(ce);Ct=p(bn,`Great! Now, we know how to write reproducible pipelines, but it gets a bit trickier since the above example only runs on the CPU. How do we also achieve reproducibility on GPU?
In short, one should not expect full reproducibility across different hardware when running pipelines on GPU
as matrix multiplications are less deterministic on GPU than on CPU and diffusion pipelines tend to require
a lot of matrix multiplications. Let\u2019s see what we can do to keep the randomness within limits across
different GPU hardware.`),bn.forEach(t),Je=u(e),fe=a(e,"P",{});var _n=i(fe);Gt=p(_n,`To achieve maximum speed performance, it is recommended to create the generator directly on GPU when running
the pipeline on GPU:`),_n.forEach(t),Ke=u(e),_(V.$$.fragment,e),Qe=u(e),me=a(e,"P",{});var Pn=i(me);Rt=p(Pn,`Running the above now prints a value of 1389.8634 - even though we\u2019re using the exact same seed!
This is unfortunate as it means we cannot reproduce the results we achieved on GPU, also on CPU.
Nevertheless, it should be expected since the GPU uses a different random number generator than the CPU.`),Pn.forEach(t),Ve=u(e),U=a(e,"P",{});var ye=i(U);Mt=p(ye,"To circumvent this problem, we created a "),he=a(ye,"A",{href:!0});var $n=i(he);ke=a($n,"CODE",{});var jn=i(ke);At=p(jn,"randn_tensor"),jn.forEach(t),$n.forEach(t),Nt=p(ye,` function, which can create random noise
on the CPU and then move the tensor to GPU if necessary. The function is used everywhere inside the pipelines allowing the user to `),Ee=a(ye,"STRONG",{});var kn=i(Ee);Lt=p(kn,"always"),kn.forEach(t),St=p(ye," pass a CPU generator even if the pipeline is run on GPU:"),ye.forEach(t),Xe=u(e),_(X.$$.fragment,e),Ye=u(e),ve=a(e,"P",{});var En=i(ve);Ot=p(En,`Running the above now prints a value of 1491.1713, much closer to the value of 1491.1711 when
the pipeline is fully run on the CPU.`),En.forEach(t),Ze=u(e),_(L.$$.fragment,e),et=u(e),S=a(e,"P",{});var lt=i(S);Ht=p(lt,"Finally, we noticed that more complex pipelines, such as "),ge=a(lt,"A",{href:!0});var Un=i(ge);Wt=p(Un,"UnCLIPPipeline"),Un.forEach(t),Ft=p(lt,` are often extremely
susceptible to precision error propagation and thus one cannot expect even similar results across
different GPU hardware or PyTorch versions. In such cases, one has to make sure to run
exactly the same hardware and PyTorch version for full Reproducibility.`),lt.forEach(t),tt=u(e),q=a(e,"H2",{class:!0});var pt=i(q);O=a(pt,"A",{id:!0,class:!0,href:!0});var Dn=i(O);Ue=a(Dn,"SPAN",{});var xn=i(Ue);_(Y.$$.fragment,xn),xn.forEach(t),Dn.forEach(t),Bt=u(pt),De=a(pt,"SPAN",{});var In=i(De);zt=p(In,"Randomness utilities"),In.forEach(t),pt.forEach(t),nt=u(e),C=a(e,"H3",{class:!0});var dt=i(C);H=a(dt,"A",{id:!0,class:!0,href:!0});var Tn=i(H);xe=a(Tn,"SPAN",{});var qn=i(xe);_(Z.$$.fragment,qn),qn.forEach(t),Tn.forEach(t),Jt=u(dt),Ie=a(dt,"SPAN",{});var Cn=i(Ie);Kt=p(Cn,"randn_tensor"),Cn.forEach(t),dt.forEach(t),st=u(e),G=a(e,"DIV",{class:!0});var ut=i(G);_(ee.$$.fragment,ut),Qt=u(ut),R=a(ut,"P",{});var be=i(R);Vt=p(be,"This is a helper function that allows to create random tensors on the desired "),Te=a(be,"CODE",{});var Gn=i(Te);Xt=p(Gn,"device"),Gn.forEach(t),Yt=p(be," with the desired "),qe=a(be,"CODE",{});var Rn=i(qe);Zt=p(Rn,"dtype"),Rn.forEach(t),en=p(be,`. When
passing a list of generators one can seed each batched size individually. If CPU generators are passed the tensor
will always be created on CPU.`),be.forEach(t),ut.forEach(t),this.h()},h(){c(f,"name","hf:doc:metadata"),c(f,"content",JSON.stringify(zn)),c(h,"id","reproducibility"),c(h,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(h,"href","#reproducibility"),c(m,"class","relative group"),c(F,"href","https://pytorch.org/docs/stable/notes/randomness.html"),c(F,"rel","nofollow"),c(M,"id","inference"),c(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(M,"href","#inference"),c(T,"class","relative group"),c(pe,"href","./api/pipelines/ddim.mdx"),c(J,"href","https://pytorch.org/docs/stable/generated/torch.randn.html"),c(J,"rel","nofollow"),c(K,"href","https://pytorch.org/docs/stable/generated/torch.randn.html"),c(K,"rel","nofollow"),c(he,"href","#diffusers.utils.randn_tensor"),c(ge,"href","/docs/diffusers/v0.13.0/en/api/pipelines/unclip#diffusers.UnCLIPPipeline"),c(O,"id","randomness-utilities"),c(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(O,"href","#randomness-utilities"),c(q,"class","relative group"),c(H,"id","diffusers.utils.randn_tensor"),c(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(H,"href","#diffusers.utils.randn_tensor"),c(C,"class","relative group"),c(G,"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,s){n(document.head,f),o(e,w,s),o(e,m,s),n(m,h),n(h,D),P(v,D,null),n(m,W),n(m,x),n(x,I),o(e,g,s),o(e,y,s),n(y,se),n(y,F),n(F,mt),n(y,ht),o(e,Ge,s),o(e,re,s),n(re,vt),o(e,Re,s),o(e,ae,s),n(ae,ie),n(ie,_e),n(_e,gt),n(ie,wt),o(e,Me,s),o(e,oe,s),n(oe,yt),o(e,Ae,s),o(e,T,s),n(T,M),n(M,Pe),P(B,Pe,null),n(T,bt),n(T,$e),n($e,_t),o(e,Ne,s),o(e,le,s),n(le,Pt),o(e,Le,s),o(e,A,s),n(A,$t),n(A,pe),n(pe,jt),n(A,kt),o(e,Se,s),P(z,e,s),o(e,Oe,s),o(e,E,s),n(E,Et),n(E,J),n(J,je),n(je,Ut),n(E,Dt),n(E,K),n(K,xt),n(E,It),o(e,He,s),P(Q,e,s),o(e,We,s),o(e,de,s),n(de,Tt),o(e,Fe,s),o(e,ue,s),n(ue,qt),o(e,Be,s),P(N,e,s),o(e,ze,s),o(e,ce,s),n(ce,Ct),o(e,Je,s),o(e,fe,s),n(fe,Gt),o(e,Ke,s),P(V,e,s),o(e,Qe,s),o(e,me,s),n(me,Rt),o(e,Ve,s),o(e,U,s),n(U,Mt),n(U,he),n(he,ke),n(ke,At),n(U,Nt),n(U,Ee),n(Ee,Lt),n(U,St),o(e,Xe,s),P(X,e,s),o(e,Ye,s),o(e,ve,s),n(ve,Ot),o(e,Ze,s),P(L,e,s),o(e,et,s),o(e,S,s),n(S,Ht),n(S,ge),n(ge,Wt),n(S,Ft),o(e,tt,s),o(e,q,s),n(q,O),n(O,Ue),P(Y,Ue,null),n(q,Bt),n(q,De),n(De,zt),o(e,nt,s),o(e,C,s),n(C,H),n(H,xe),P(Z,xe,null),n(C,Jt),n(C,Ie),n(Ie,Kt),o(e,st,s),o(e,G,s),P(ee,G,null),n(G,Qt),n(G,R),n(R,Vt),n(R,Te),n(Te,Xt),n(R,Yt),n(R,qe),n(qe,Zt),n(R,en),rt=!0},p(e,[s]){const te={};s&2&&(te.$$scope={dirty:s,ctx:e}),N.$set(te);const Ce={};s&2&&(Ce.$$scope={dirty:s,ctx:e}),L.$set(Ce)},i(e){rt||($(v.$$.fragment,e),$(B.$$.fragment,e),$(z.$$.fragment,e),$(Q.$$.fragment,e),$(N.$$.fragment,e),$(V.$$.fragment,e),$(X.$$.fragment,e),$(L.$$.fragment,e),$(Y.$$.fragment,e),$(Z.$$.fragment,e),$(ee.$$.fragment,e),rt=!0)},o(e){j(v.$$.fragment,e),j(B.$$.fragment,e),j(z.$$.fragment,e),j(Q.$$.fragment,e),j(N.$$.fragment,e),j(V.$$.fragment,e),j(X.$$.fragment,e),j(L.$$.fragment,e),j(Y.$$.fragment,e),j(Z.$$.fragment,e),j(ee.$$.fragment,e),rt=!1},d(e){t(f),e&&t(w),e&&t(m),k(v),e&&t(g),e&&t(y),e&&t(Ge),e&&t(re),e&&t(Re),e&&t(ae),e&&t(Me),e&&t(oe),e&&t(Ae),e&&t(T),k(B),e&&t(Ne),e&&t(le),e&&t(Le),e&&t(A),e&&t(Se),k(z,e),e&&t(Oe),e&&t(E),e&&t(He),k(Q,e),e&&t(We),e&&t(de),e&&t(Fe),e&&t(ue),e&&t(Be),k(N,e),e&&t(ze),e&&t(ce),e&&t(Je),e&&t(fe),e&&t(Ke),k(V,e),e&&t(Qe),e&&t(me),e&&t(Ve),e&&t(U),e&&t(Xe),k(X,e),e&&t(Ye),e&&t(ve),e&&t(Ze),k(L,e),e&&t(et),e&&t(S),e&&t(tt),e&&t(q),k(Y),e&&t(nt),e&&t(C),k(Z),e&&t(st),e&&t(G),k(ee)}}}const zn={local:"reproducibility",sections:[{local:"inference",title:"Inference"},{local:"randomness-utilities",sections:[{local:"diffusers.utils.randn_tensor",title:"randn_tensor"}],title:"Randomness utilities"}],title:"Reproducibility"};function Jn(ne){return On(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zn extends An{constructor(f){super();Nn(this,f,Jn,Bn,Ln,{})}}export{Zn as default,zn as metadata};

Xet Storage Details

Size:
25.7 kB
·
Xet hash:
09d0a00b6f6557b4bfe16b624373870a2a63426efa1cb54aa450f8d80b998851

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