Download lecture-07/assets/DiffusionLab-DyGhc6Y6.js from DeepLearning-VT/DeepLearning_2026: direct link, hf CLI and curl.
- Browser
- Download file 3.27 kB
-
https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-07/assets/DiffusionLab-DyGhc6Y6.js
- Command line
-
hf download hf://spaces/DeepLearning-VT/DeepLearning_2026/lecture-07/assets/DiffusionLab-DyGhc6Y6.js
-
curl -L -o DiffusionLab-DyGhc6Y6.js https://huggingface.co/spaces/DeepLearning-VT/DeepLearning_2026/resolve/main/lecture-07/assets/DiffusionLab-DyGhc6Y6.js
3.27 kB
| import{$ as e,S as t,St as n,V as r,_ as i,b as a,g as o,m as s,ut as c,v as l,vt as u,w as d,x as f,z as p}from"./modules/shiki-CkJq9tSf.js";import{t as m}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as h}from"./slidev/context-DnYiQGy6.js";import{C as g,D as _,E as v,O as y,b,l as x,m as S,p as C,x as w}from"./useGenerative-DDHg2gzY.js";import{t as T}from"./Plot2D-C9URVmMB.js";import{t as E}from"./PlotPoints-CeOGnq0p.js";import{t as D}from"./Slider-Bf0ITYx4.js";import{t as O}from"./PlotLine-CjM2Thxu.js";var k={class:`dl-diff__out`},A={class:`dl-diff__note`},j=m(d({__name:`DiffusionLab`,props:{reverse:{type:Boolean,default:!1},field:{type:Boolean,default:!1}},setup(d){let{$slidev:m,$nav:j,$clicksContext:M,$clicks:N,$page:P,$renderContext:F,$frontmatter:I}=h(),L=d,{alphaBar:R,steps:z}=S(),B=c(L.reverse?`reverse`:`forward`),V=c(L.field),H=c(L.reverse?z-1:0),U=w(20),W=(()=>{let e=v(31337);return U.map(()=>({x:e(),y:e()}))})(),G=o(()=>R.map(e=>U.map((t,n)=>x(t,e,W[n])))),K=o(()=>{let e=Array(z),t=g(20);e[z-1]=t;for(let n=z-1;n>0;n--)t=t.map(e=>b(e,R[n],R[n-1])),e[n-1]=t;return e}),q=o(()=>(B.value===`forward`?G.value:K.value)[H.value]),J=o(()=>R[H.value]),Y=o(()=>{if(!V.value)return[];let e=[],t=.6;for(let n=-3;n<=3;n+=1.5)for(let r=-2;r<=2;r+=1.33){let i=C({x:n,y:r},J.value),a=Math.hypot(i.x,i.y);a<1e-9||e.push({from:[n,r],to:[n+i.x/a*t,r+i.y/a*t]})}return e});function X(e){H.value=Math.min(Math.max(e,0),z-1)}return(o,c)=>{let d=O,m=E,h=T,g=D,v=_,b=y;return p(),l(b,{"max-width":`44rem`},{controls:e(()=>[t(g,{modelValue:H.value,"onUpdate:modelValue":c[0]||=e=>H.value=e,label:B.value===`forward`?`noise level t`:`sampling step t`,min:0,max:u(z)-1,step:1,precision:0},null,8,[`modelValue`,`label`,`max`]),t(v,{label:B.value===`forward`?`forward — add noise`:`reverse — remove it`,variant:`ghost`,glyph:`⇄`,onClick:c[1]||=e=>B.value=B.value===`forward`?`reverse`:`forward`},null,8,[`label`]),t(v,{label:`t = 0`,variant:`ghost`,onClick:c[2]||=e=>X(0)}),t(v,{label:`t = ${u(z)-1}`,variant:`ghost`,onClick:c[3]||=e=>X(u(z)-1)},null,8,[`label`]),t(v,{label:V.value?`hide the field`:`show the field`,variant:`ghost`,onClick:c[4]||=e=>V.value=!V.value},null,8,[`label`])]),readout:e(()=>[i(`div`,k,[i(`span`,null,[c[5]||=f(`t = `,-1),i(`b`,null,n(H.value),1),f(` of `+n(u(z)-1),1)]),i(`span`,null,[c[6]||=f(`√ᾱ`,-1),c[7]||=i(`sub`,null,`t`,-1),c[8]||=f(` = `,-1),i(`b`,null,n(Math.sqrt(J.value).toFixed(3)),1),c[9]||=f(` of the image`,-1)]),i(`span`,null,[c[10]||=f(`√(1−ᾱ`,-1),c[11]||=i(`sub`,null,`t`,-1),c[12]||=f(`) = `,-1),i(`b`,null,n(Math.sqrt(1-J.value).toFixed(3)),1),c[13]||=f(` of noise`,-1)]),i(`span`,A,n(B.value===`forward`?`every frame computed from x₀ in one step — no chain simulated`:`each frame needs the one before it — this is why sampling is slow`),1)])]),default:e(()=>[t(h,{"x-domain":[-4,4],"y-domain":[-2.8,2.8],width:470,height:252,"x-ticks":[-4,-2,0,2,4],"y-ticks":[-2,0,2]},{default:e(()=>[(p(!0),a(s,null,r(Y.value,(e,t)=>(p(),l(d,{key:`a${t}`,from:e.from,to:e.to,color:`var(--dl-muted)`,width:1.2,opacity:.55,arrow:``},null,8,[`from`,`to`]))),128)),t(m,{points:q.value,radius:4.2,color:`var(--dl-accent)`},null,8,[`points`])]),_:1})]),_:1})}}}),[[`__scopeId`,`data-v-22c227ee`]]);export{j as t}; |