Release site-v1.0.5
Browse filesThis view is limited to 50 files because it contains too many changes. Β See raw diff
- index.html +1 -1
- lecture-01/slides.pdf +2 -2
- lecture-06/assets/AttentionMatrix-CVQjcu-J.js +0 -1
- lecture-06/assets/AttentionTrace-C_KtbHkD.js +0 -2
- lecture-06/assets/DeckFooter-DkGAACS-.js +0 -1
- lecture-06/assets/PollSlide-D7L0g784.js +0 -1
- lecture-06/assets/PositionalEncoding-CPViPuDW.css +0 -1
- lecture-06/assets/PositionalEncoding-q3Ic_HFH.js +0 -1
- lecture-06/assets/SlideWrapper-Cejg6ZDn.js +0 -2
- lecture-06/assets/TransformerBlock-D6V5Q80S.js +0 -3
- lecture-06/assets/TransformerGlyph-1pDKmZ2i.js +0 -1
- lecture-06/assets/TransformerGlyph-DdjNaryB.css +0 -1
- lecture-06/assets/WidgetFrame-Czwyd28V.css +0 -1
- lecture-06/assets/WidgetFrame-D2L0MlKA.js +0 -1
- lecture-06/assets/default-D0qxH3Ml.js +0 -1
- lecture-06/assets/index-Cpw8zVhj.js +0 -46
- lecture-06/assets/index-DoO9FZlh.css +0 -0
- lecture-06/assets/interactive-DBHsn3dn.js +0 -1
- lecture-06/assets/interactive-D_LX0oud.css +0 -1
- lecture-06/assets/md-1GUuAYm_.js +0 -1
- lecture-06/assets/md-5CCz_ZVw.js +0 -1
- lecture-06/assets/md-6u9b4JQU.js +0 -1
- lecture-06/assets/md-7b2m1J_B2.js +0 -12
- lecture-06/assets/md-B1Cw576Z.js +0 -1
- lecture-06/assets/md-B7GUUxxz.js +0 -8
- lecture-06/assets/md-B9ulHjpP2.js +0 -1
- lecture-06/assets/md-BAhUxKK3.js +0 -1
- lecture-06/assets/md-BCE9dyfW.js +0 -1
- lecture-06/assets/md-BD00LdYU2.js +0 -1
- lecture-06/assets/md-BDUTraAK2.js +0 -1
- lecture-06/assets/md-BEoc4J_E.js +0 -1
- lecture-06/assets/md-BFOvAsJ4.js +0 -1
- lecture-06/assets/md-BIcSKdBe2.js +0 -1
- lecture-06/assets/md-BLU60Dt22.js +0 -1
- lecture-06/assets/md-BP8VIKZW.js +0 -1
- lecture-06/assets/md-BTCxmEyp.js +0 -3
- lecture-06/assets/md-BV7tqBmU.css +0 -1
- lecture-06/assets/md-BVq0H9oi2.js +0 -1
- lecture-06/assets/md-BYSwjGyl2.js +0 -1
- lecture-06/assets/md-Ba46XhX62.js +0 -1
- lecture-06/assets/md-BdyJtiOm.js +0 -1
- lecture-06/assets/md-Be8ibFbg2.js +0 -12
- lecture-06/assets/md-Bm3b9CdW2.js +0 -1
- lecture-06/assets/md-BnhBsnM82.js +0 -1
- lecture-06/assets/md-BpsoksUK.js +0 -1
- lecture-06/assets/md-Bs7Gg5Ru.js +0 -1
- lecture-06/assets/md-BtNHnlu_.js +0 -1
- lecture-06/assets/md-BtwRUwrk.js +0 -1
- lecture-06/assets/md-C0WigTmY2.js +0 -45
- lecture-06/assets/md-C126BC2G2.js +0 -1
index.html
CHANGED
|
@@ -138,7 +138,7 @@
|
|
| 138 |
|
| 139 |
<footer>
|
| 140 |
<span>Built with <a href="https://sli.dev/">Slidev</a> Β· source on <a href="https://github.com/vlbthambawita/DeepLearning">GitHub</a></span>
|
| 141 |
-
<span>Updated 2026-10-
|
| 142 |
</footer>
|
| 143 |
</div>
|
| 144 |
</body>
|
|
|
|
| 138 |
|
| 139 |
<footer>
|
| 140 |
<span>Built with <a href="https://sli.dev/">Slidev</a> Β· source on <a href="https://github.com/vlbthambawita/DeepLearning">GitHub</a></span>
|
| 141 |
+
<span>Updated 2026-10-15</span>
|
| 142 |
</footer>
|
| 143 |
</div>
|
| 144 |
</body>
|
lecture-01/slides.pdf
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c81bdf65d905bd9f221720579e5b2f5ff546dab02ca542beb069704d82a18e8
|
| 3 |
+
size 3350033
|
lecture-06/assets/AttentionMatrix-CVQjcu-J.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{Q as e,V as t,_ as n,b as r,bt as i,g as a,lt as o,m as s,v as c,vt as l,w as u,x as d,xt as f,y as p,z as m}from"./modules/shiki-BFOesOFp.js";import{t as h}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as g}from"./slidev/context-DrkI8qiD.js";import{t as _}from"./WidgetFrame-D2L0MlKA.js";import{t as v}from"./StepButton-BcP33F-1.js";import{i as y,r as b,u as x}from"./useAttention-Blk0c2BZ.js";var S={class:`dl-amx__grid`},C=[`onMouseenter`],w={class:`dl-amx__rowhead`},T={key:0,class:`dl-amx__sum`},E=h(u({__name:`AttentionMatrix`,props:{mode:{default:`weights`},sentence:{default:`river`},causal:{type:Boolean,default:!1},maskable:{type:Boolean,default:!0},switchable:{type:Boolean,default:!1}},setup(u){let{$slidev:h,$nav:E,$clicksContext:D,$clicks:O,$page:k,$renderContext:A,$frontmatter:j}=g(),M=u,N=o(M.sentence),P=o(M.causal),F=o(null),I=a(()=>M.mode===`mask`?b:y[N.value]),L=a(()=>x(y[N.value],P.value)),R=a(()=>M.mode===`mask`?I.value.map((e,t)=>I.value.map((e,n)=>+(n<=t))):L.value.rows.map(e=>e.weights)),z=a(()=>R.value.reduce((e,t)=>e+t.filter(e=>e>0).length,0)),B=a(()=>I.value.length**2),V=a(()=>F.value===null?null:L.value.rows[F.value]);function H(e){return e.toFixed(2)}function U(e){return M.mode===`mask`?e>0?.55:0:Math.sqrt(e)*.92}return(a,o)=>{let u=v,h=_;return m(),c(h,{"max-width":`40rem`},{controls:e(()=>[M.maskable&&M.mode===`weights`?(m(),c(u,{key:0,label:P.value?`Remove the mask`:`Apply the causal mask`,variant:P.value?`ghost`:`primary`,glyph:`βΊ`,onClick:o[1]||=e=>P.value=!P.value},null,8,[`label`,`variant`])):p(`v-if`,!0),M.switchable&&M.mode===`weights`?(m(),c(u,{key:1,label:N.value===`river`?`Swap river β money`:`Swap money β river`,variant:`ghost`,glyph:`β`,onClick:o[2]||=e=>N.value=N.value===`river`?`money`:`river`},null,8,[`label`])):p(`v-if`,!0)]),readout:e(()=>[M.mode===`mask`?(m(),r(s,{key:0},[d(f(I.value.length)+` words, so `+f(B.value)+` cells β and the mask throws away `,1),n(`strong`,null,f(B.value-z.value),1),o[5]||=d(` of them. Position `,-1),o[6]||=n(`em`,null,`t`,-1),o[7]||=d(` may read positions 1β¦`,-1),o[8]||=n(`em`,null,`t`,-1),d(` and nothing later, so row 1 has one live cell and the last row has `+f(I.value.length)+`. The scores are still `,1),o[9]||=n(`em`,null,`all`,-1),o[10]||=d(` computed and then set to ββ before the softmax: masking saves no work, it only removes the answer. `,-1)],64)):V.value?(m(),r(s,{key:1},[n(`strong`,null,f(V.value.word),1),d(` spreads its attention as [`+f(V.value.weights.map(e=>H(e)).join(`, `))+`], and those add to exactly 1 β that is the softmax's doing, and it is why the output is an `,1),o[11]||=n(`em`,null,`average`,-1),o[12]||=d(` of values rather than a sum that grows with the sentence. `,-1)],64)):P.value?(m(),r(s,{key:2},[o[13]||=d(` With the mask on, row `,-1),o[14]||=n(`em`,null,`the`,-1),o[15]||=d(` is a single `,-1),o[16]||=n(`strong`,null,`1.00`,-1),o[17]||=d(`: the first token has nothing to look at but itself. Every row still sums to 1, because the softmax is taken after the blocked scores are set to ββ. `,-1)],64)):(m(),r(s,{key:3},[d(` Nine numbers, one matrix multiply. No cell depends on any other cell, so every row is computed at the same time β which is exactly what a recurrent layer could not do, and the reason this architecture won. `)],64))]),default:e(()=>[n(`div`,{class:l([`dl-amx`,`is-${M.mode}`])},[o[4]||=n(`div`,{class:`dl-amx__axes`},[n(`span`,{class:`dl-amx__axis`},`rows ask`),n(`span`,{class:`dl-amx__axis is-cols`},`columns are read`)],-1),n(`table`,S,[n(`thead`,null,[n(`tr`,null,[o[3]||=n(`th`,null,null,-1),(m(!0),r(s,null,t(I.value,(e,t)=>(m(),r(`th`,{key:`h${t}`,class:`dl-amx__colhead`},f(e),1))),128))])]),n(`tbody`,null,[(m(!0),r(s,null,t(R.value,(e,a)=>(m(),r(`tr`,{key:`r${a}`,class:l({"is-active":F.value===a}),onMouseenter:e=>F.value=a,onMouseleave:o[0]||=e=>F.value=null},[n(`th`,w,f(I.value[a]),1),(m(!0),r(s,null,t(e,(e,t)=>(m(),r(`td`,{key:`c${t}`,class:l([`dl-amx__cell`,{"is-blocked":e===0&&(P.value||M.mode===`mask`)}])},[n(`span`,{class:`dl-amx__fill`,style:i({opacity:U(e)})},null,4),n(`span`,{class:l([`dl-amx__text`,{"is-strong":e>.45}])},f(M.mode===`mask`?e>0?``:`Γ`:e===0?`Γ`:H(e)),3)],2))),128)),M.mode===`weights`?(m(),r(`td`,T,` = `+f(H(e.reduce((e,t)=>e+t,0))),1)):p(`v-if`,!0)],42,C))),128))])])],2)]),_:1})}}}),[[`__scopeId`,`data-v-6a6f8a8a`]]);export{E as t};
|
|
|
|
|
|
lecture-06/assets/AttentionTrace-C_KtbHkD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
import{Q as e,S as t,V as n,Y as r,_ as i,_t as a,b as o,bt as s,g as c,lt as l,m as u,v as d,vt as f,w as p,x as m,xt as h,y as g,z as _}from"./modules/shiki-BFOesOFp.js";import{t as v}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as y}from"./slidev/context-DrkI8qiD.js";import{t as b}from"./WidgetFrame-D2L0MlKA.js";import{t as x}from"./StepButton-BcP33F-1.js";import{t as S}from"./useConvolution-qO1u8ksh.js";import{i as C,u as w}from"./useAttention-Blk0c2BZ.js";var T={class:`dl-att`},E={class:`dl-att__query`},D=[`onClick`],ee={key:0,class:`dl-att__qvec`},te={class:`dl-att__grid`},O={class:`dl-att__given`},k={class:`dl-att__given`},A={key:0,class:`dl-att__step`},j={key:1,class:`dl-att__step`},M={key:2,class:`dl-att__step is-weights`},N={class:`dl-att__weight`},P={class:`dl-att__bar`},F={key:3,class:`dl-att__step`},I={class:`dl-att__outlabel`},L={class:`dl-att__outvec`},R={key:0,class:`dl-att__note`},z=5,B=v(p({__name:`AttentionTrace`,props:{sentence:{default:`river`},query:{default:2},switchable:{type:Boolean,default:!0},causal:{type:Boolean,default:!1}},setup(p){let{$slidev:v,$nav:B,$clicksContext:ne,$clicks:re,$page:ie,$renderContext:ae,$frontmatter:oe}=y(),V=p,H=l(V.sentence),U=l(V.query),W=l(0),G=c(()=>w(C[H.value],V.causal)),K=c(()=>G.value.words),q=c(()=>G.value.rows[Math.min(U.value,K.value.length-1)]),J=c(()=>{let e=q.value.weights,t=e.indexOf(Math.max(...e));return{index:t,word:K.value[t],weight:e[t]}}),Y=c(()=>W.value>=z);function X(){W.value=Y.value?0:W.value+1}function Z(e){U.value=e,W.value=0}function Q(){H.value=H.value===`river`?`money`:`river`}r(H,()=>{W.value=0});function $(e){return e.toFixed(2)}let se=[`press Next step β the keys and values are already here, the query is what is new`,`the query: one vector, and the only thing about this step that is new`,`score it against every key β one dot product per position, including its own`,`divide by βd_k, so the softmax does not saturate once d_k gets large`,`softmax: the scores become weights that are positive and sum to exactly 1`,`multiply each value by its weight and add them up β that is the new vector`],ce=c(()=>se[W.value]);return(r,c)=>{let l=x,p=b;return _(),d(p,{"max-width":`44rem`},{controls:e(()=>[t(l,{label:Y.value?`Start over`:`Next step`,glyph:`βΈ`,onClick:X},null,8,[`label`]),V.switchable?(_(),d(l,{key:0,label:H.value===`river`?`Swap river β money`:`Swap money β river`,variant:`ghost`,glyph:`β`,onClick:Q},null,8,[`label`])):g(`v-if`,!0)]),readout:e(()=>[W.value<z?(_(),o(u,{key:0},[m(` Line `+h(W.value)+` of `+h(z)+` β `+h(ce.value)+`. `,1)],64)):(_(),o(u,{key:1},[i(`strong`,null,h(q.value.word),1),c[15]||=m(` reads `,-1),i(`strong`,null,h(J.value.word),1),m(` with `+h($(J.value.weight))+` of its attention, and comes out as [`+h(q.value.out.map(e=>a(S)(e)).join(`, `))+`]. `,1),q.value.word===`bank`?(_(),o(`span`,R,[c[11]||=m(` Press `,-1),c[12]||=i(`em`,null,`Swap`,-1),c[13]||=m(`. The four matrices do not change and neither does the word β only its neighbour does β and `,-1),c[14]||=i(`em`,null,`bank`,-1),m(`βs output flips to [`+h([...q.value.out].reverse().map(e=>a(S)(e)).join(`, `))+`]. That is what βcontextualβ means, and it is the entire reason this mechanism exists. `,1)])):g(`v-if`,!0)],64))]),default:e(()=>[i(`div`,T,[g(` Who is asking. `),i(`div`,E,[c[0]||=i(`span`,{class:`dl-att__qlabel`},`query`,-1),(_(!0),o(u,null,n(K.value,(e,t)=>(_(),o(`button`,{key:e+t,type:`button`,class:f([`dl-att__word`,{"is-current":t===U.value}]),onClick:e=>Z(t)},h(e),11,D))),128)),W.value>=1?(_(),o(`span`,ee,` q = [`+h(q.value.q.map(e=>a(S)(e)).join(`, `))+`] `,1)):g(`v-if`,!0)]),i(`table`,te,[i(`thead`,null,[i(`tr`,null,[c[1]||=i(`th`,{class:`dl-att__rowlabel`},null,-1),(_(!0),o(u,null,n(K.value,(e,t)=>(_(),o(`th`,{key:e+t,class:f([`dl-att__col`,{"is-focus":W.value>=4&&t===J.value.index}])},h(e),3))),128))])]),i(`tbody`,null,[g(` Present from the start: these are not recomputed per query. `),i(`tr`,O,[c[2]||=i(`th`,{class:`dl-att__rowlabel`},`key`,-1),(_(!0),o(u,null,n(G.value.k,(e,t)=>(_(),o(`td`,{key:`k${t}`},`[`+h(e.map(e=>a(S)(e)).join(`, `))+`]`,1))),128))]),i(`tr`,k,[c[3]||=i(`th`,{class:`dl-att__rowlabel`},`value`,-1),(_(!0),o(u,null,n(G.value.v,(e,t)=>(_(),o(`td`,{key:`v${t}`},`[`+h(e.map(e=>a(S)(e)).join(`, `))+`]`,1))),128))]),W.value>=2?(_(),o(`tr`,A,[c[4]||=i(`th`,{class:`dl-att__rowlabel`},[i(`span`,{class:`dl-att__n`},`1`),m(` q Β· k`)],-1),(_(!0),o(u,null,n(q.value.raw,(e,t)=>(_(),o(`td`,{key:`s${t}`},h(a(S)(e)),1))),128))])):g(`v-if`,!0),W.value>=3?(_(),o(`tr`,j,[c[5]||=i(`th`,{class:`dl-att__rowlabel`},[i(`span`,{class:`dl-att__n`},`2`),m(` Γ· βd`),i(`sub`,null,`k`)],-1),(_(!0),o(u,null,n(q.value.scaled,(e,t)=>(_(),o(`td`,{key:`c${t}`},h(e===null?`ββ`:a(S)(e)),1))),128))])):g(`v-if`,!0),W.value>=4?(_(),o(`tr`,M,[c[6]||=i(`th`,{class:`dl-att__rowlabel`},[i(`span`,{class:`dl-att__n`},`3`),m(` softmax`)],-1),(_(!0),o(u,null,n(q.value.weights,(e,t)=>(_(),o(`td`,{key:`w${t}`},[i(`div`,N,h($(e)),1),i(`div`,P,[i(`span`,{style:s({width:`${e*100}%`})},null,4)])]))),128))])):g(`v-if`,!0),W.value>=5?(_(),o(`tr`,F,[c[7]||=i(`th`,{class:`dl-att__rowlabel`},[i(`span`,{class:`dl-att__n`},`4`),m(` w Β· v`)],-1),(_(!0),o(u,null,n(q.value.terms,(e,t)=>(_(),o(`td`,{key:`t${t}`},`[`+h(e.map(e=>a(S)(e)).join(`, `))+`]`,1))),128))])):g(`v-if`,!0)])]),g(` Height reserved whether or not line 5 is showing, so the widget does
|
| 2 |
-
not walk down the slide as the room clicks through it. `),i(`div`,{class:f([`dl-att__out`,{"is-empty":W.value<z}])},[W.value>=z?(_(),o(u,{key:0},[c[8]||=i(`span`,{class:`dl-att__n`},`5`,-1),c[9]||=i(`span`,{class:`dl-att__sum`},`sum`,-1),c[10]||=i(`span`,{class:`dl-att__arrow`},`β`,-1),i(`span`,I,h(q.value.word)+`β² =`,1),i(`span`,L,[(_(!0),o(u,null,n(q.value.out,(e,t)=>(_(),o(`span`,{key:t,class:`dl-att__outcell`},h(a(S)(e)),1))),128))])],64)):g(`v-if`,!0)],2)])]),_:1})}}}),[[`__scopeId`,`data-v-284316ce`]]);export{B as t};
|
|
|
|
|
|
|
|
|
lecture-06/assets/DeckFooter-DkGAACS-.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{_ as e,_t as t,b as n,g as r,w as i,xt as a,y as o,z as s}from"./modules/shiki-BFOesOFp.js";import{t as c}from"./useNav-BKmHNb0y.js";import{t as l}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as u}from"./slidev/context-DrkI8qiD.js";import"./slidev/client-CbOE_Oqt.js";var d={class:`dl-footer`},f={class:`dl-footer__left`},p={key:0,class:`dl-footer__code`},m={key:1,class:`dl-footer__sep`},h={key:2},g={key:3,class:`dl-footer__sep`},_={key:4,class:`dl-footer__title`},v={class:`dl-footer__right`},y=l(i({__name:`DeckFooter`,setup(i){let{$slidev:l}=u(),y=c(),b=r(()=>l?.themeConfigs??{}),x=r(()=>b.value.courseCode??``),S=r(()=>b.value.lecture??``),C=r(()=>b.value.lectureTitle??``);return(r,i)=>(s(),n(`footer`,d,[e(`div`,f,[x.value?(s(),n(`span`,p,a(x.value),1)):o(`v-if`,!0),S.value?(s(),n(`span`,m,`Β·`)):o(`v-if`,!0),S.value?(s(),n(`span`,h,`Lecture `+a(S.value),1)):o(`v-if`,!0),C.value?(s(),n(`span`,g,`Β·`)):o(`v-if`,!0),C.value?(s(),n(`span`,_,a(C.value),1)):o(`v-if`,!0)]),e(`div`,v,a(t(y).currentPage.value)+` / `+a(t(y).total.value),1)]))}}),[[`__scopeId`,`data-v-fe908050`]]);export{y as t};
|
|
|
|
|
|
lecture-06/assets/PollSlide-D7L0g784.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{Q as e,S as t,V as n,_ as r,b as i,m as a,w as o,xt as s,z as c}from"./modules/shiki-BFOesOFp.js";import{t as l}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as u}from"./slidev/context-DrkI8qiD.js";import{t as d}from"./slidev/VClicks-vSW8X3kW.js";var f={class:`dl-poll`},p={class:`dl-poll__question`},m=l(o({__name:`PollSlide`,props:{question:{},items:{}},setup(o){let{$slidev:l,$nav:m,$clicksContext:h,$clicks:g,$page:_,$renderContext:v,$frontmatter:y}=u(),b=o;return(o,l)=>{let u=d;return c(),i(`div`,f,[r(`div`,p,s(b.question),1),t(u,null,{default:e(()=>[(c(!0),i(a,null,n(b.items,e=>(c(),i(`div`,{key:e,class:`dl-poll__item`},[l[0]||=r(`span`,{class:`dl-poll__bullet`},`?`,-1),r(`span`,null,s(e),1)]))),128))]),_:1})])}}}),[[`__scopeId`,`data-v-743a908f`]]);export{m as t};
|
|
|
|
|
|
lecture-06/assets/PositionalEncoding-CPViPuDW.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.dl-pe[data-v-3178dbe7]{flex-direction:column;align-items:center;gap:.7rem;width:100%;display:flex}.dl-pe__cards[data-v-3178dbe7]{grid-template-columns:repeat(3,1fr);gap:.8rem;width:100%;max-width:36rem;display:grid}.dl-pe__card[data-v-3178dbe7]{border:1px solid var(--dl-border);background:var(--dl-surface);border-radius:6px;flex-direction:column;align-items:center;padding:.5rem .4rem .6rem;display:flex}.dl-pe__slot[data-v-3178dbe7]{letter-spacing:.08em;text-transform:uppercase;color:var(--dl-muted);font-size:.64rem}.dl-pe__word[data-v-3178dbe7]{color:var(--dl-heading);margin-top:.1rem;font-size:1.15rem;font-weight:700}.dl-pe__arrow[data-v-3178dbe7]{color:var(--dl-muted);font-size:.85rem;line-height:1.1}.dl-pe__vec[data-v-3178dbe7]{gap:.25rem;margin-top:.15rem;display:flex}.dl-pe__cell[data-v-3178dbe7]{text-align:center;border:1px solid var(--dl-accent);background:var(--dl-accent-soft);width:3.1rem;color:var(--dl-heading);font-variant-numeric:tabular-nums;border-radius:4px;padding:.16rem 0;font-size:.85rem;font-weight:700}.dl-pe__was[data-v-3178dbe7]{text-align:center;color:var(--dl-muted);font-variant-numeric:tabular-nums;margin-top:.3rem;font-size:.64rem;line-height:1.3}.dl-pe__verdict[data-v-3178dbe7]{border:1px solid var(--dl-border);letter-spacing:.06em;text-transform:uppercase;color:var(--dl-muted);border-radius:999px;padding:.2rem .9rem;font-size:.78rem}.dl-pe__verdict.is-same[data-v-3178dbe7]{border-color:var(--dl-accent);background:var(--dl-accent-soft);color:var(--dl-accent);font-weight:700}.dl-pe__heatwrap[data-v-3178dbe7]{width:100%;max-width:30rem}.dl-pe__heatlabel[data-v-3178dbe7]{letter-spacing:.08em;text-transform:uppercase;color:var(--dl-muted);margin-bottom:.2rem;margin-left:2rem;font-size:.66rem}.dl-pe__heat[data-v-3178dbe7]{flex-direction:column;gap:2px;display:flex}.dl-pe__heatrow[data-v-3178dbe7]{align-items:center;gap:2px;display:flex}.dl-pe__pos[data-v-3178dbe7]{text-align:right;font-variant-numeric:tabular-nums;width:1.7rem;color:var(--dl-muted);padding-right:.3rem;font-size:.66rem}.dl-pe__heatrow.is-active .dl-pe__pos[data-v-3178dbe7]{color:var(--dl-accent);font-weight:700}.dl-pe__heatcell[data-v-3178dbe7]{border-radius:2px;flex:1 1 0;height:1.15rem}.dl-pe__heatcell.is-pos[data-v-3178dbe7]{background:var(--dl-accent)}.dl-pe__heatcell.is-neg[data-v-3178dbe7]{background:var(--dl-danger)}.dl-pe__heatrow.is-active .dl-pe__heatcell[data-v-3178dbe7]{outline:1px solid var(--dl-heading)}.dl-pe__note[data-v-3178dbe7]{color:var(--dl-accent);margin-top:.15rem;display:block}
|
|
|
|
|
|
lecture-06/assets/PositionalEncoding-q3Ic_HFH.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{Q as e,V as t,_ as n,_t as r,b as i,bt as a,g as o,lt as s,m as c,v as l,vt as u,w as d,x as f,xt as p,y as m,z as h}from"./modules/shiki-BFOesOFp.js";import{t as g}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as _}from"./slidev/context-DrkI8qiD.js";import{t as v}from"./WidgetFrame-D2L0MlKA.js";import{t as y}from"./StepButton-BcP33F-1.js";import{t as b}from"./useConvolution-qO1u8ksh.js";import{i as x,u as S}from"./useAttention-Blk0c2BZ.js";var C={key:0,class:`dl-pe`},w={class:`dl-pe__cards`},T={class:`dl-pe__slot`},E={class:`dl-pe__word`},D={class:`dl-pe__vec`},O={class:`dl-pe__was`},k={class:`dl-pe dl-pe--heat`},A={class:`dl-pe__heatwrap`},j={class:`dl-pe__heat`},M=[`onMouseenter`],N={class:`dl-pe__pos`},P=[`title`],F=g(d({__name:`PositionalEncoding`,props:{mode:{default:`blind`},dModel:{default:16},positions:{default:12}},setup(d){let{$slidev:g,$nav:F,$clicksContext:I,$clicks:L,$page:R,$renderContext:z,$frontmatter:B}=_(),V=d,H=[[0,1,2],[2,0,1],[1,2,0],[2,1,0]],U=s(0),W=o(()=>H[U.value].map(e=>x.river[e])),G=o(()=>S(W.value)),K=o(()=>S(x.river));function q(e,t){let n=t.rows.find(t=>t.word===e);return n?n.out:[]}let J=o(()=>W.value.every(e=>{let t=q(e,G.value),n=q(e,K.value);return t.every((e,t)=>Math.abs(e-n[t])<1e-9)}));function Y(){U.value=(U.value+1)%H.length}let X=o(()=>Array.from({length:V.positions},(e,t)=>Array.from({length:V.dModel},(e,n)=>{let r=t/1e4**(2*Math.floor(n/2)/V.dModel);return n%2==0?Math.sin(r):Math.cos(r)}))),Z=s(null);return(o,s)=>{let d=y,g=v;return h(),l(g,{"max-width":`42rem`},{controls:e(()=>[V.mode===`blind`?(h(),l(d,{key:0,label:`Shuffle the words`,glyph:`β`,onClick:Y})):m(`v-if`,!0)]),readout:e(()=>[V.mode===`blind`?(h(),i(c,{key:0},[U.value===0?(h(),i(c,{key:0},[s[3]||=f(` The sentence in its written order. Press `,-1),s[4]||=n(`em`,null,`Shuffle`,-1),s[5]||=f(` and watch the vectors. `,-1)],64)):(h(),i(c,{key:1},[s[6]||=n(`strong`,null,`Every word's output vector is exactly what it was.`,-1),s[7]||=f(` Attention is a weighted sum over a `,-1),s[8]||=n(`em`,null,`set`,-1),s[9]||=f(`, and a sum has no order in it β so as far as this layer is concerned `,-1),s[10]||=n(`em`,null,`the river bank`,-1),s[11]||=f(` and `,-1),s[12]||=n(`em`,null,`bank river the`,-1),s[13]||=f(` are the same input. Last week's whole lecture was about order mattering. `,-1),s[14]||=n(`span`,{class:`dl-pe__note`},` Permute the input and the outputs permute with it, unchanged. That property is called permutation equivariance, and here it is a bug. `,-1)],64))],64)):Z.value===null?(h(),i(c,{key:2},[f(` One row per position, `+p(V.dModel)+` columns wide. Left-hand dimensions oscillate once every few positions; right-hand ones barely move across the whole sentence β so the same vector carries βwhich word am Iβ and βwhich end of the sentence am Iβ at once. Nothing here is learned, and nothing caps the length: position 5000 has a vector too. `,1)],64)):(h(),i(c,{key:1},[s[15]||=f(` Position `,-1),n(`strong`,null,p(Z.value),1),f(` is the fixed vector [`+p(X.value[Z.value].slice(0,4).map(e=>r(b)(e)).join(`, `))+`, β¦] β `+p(V.dModel)+` numbers, computed from sines and cosines, `,1),s[16]||=n(`strong`,null,`not learned`,-1),s[17]||=f(`. It is `,-1),s[18]||=n(`em`,null,`added`,-1),s[19]||=f(` to the word's embedding, not concatenated, so the width of the model never changes. `,-1)],64))]),default:e(()=>[V.mode===`blind`?(h(),i(`div`,C,[n(`div`,w,[(h(!0),i(c,null,t(W.value,(e,a)=>(h(),i(`div`,{key:`${e}${a}`,class:`dl-pe__card`},[n(`div`,T,`position `+p(a+1),1),n(`div`,E,p(e),1),s[1]||=n(`div`,{class:`dl-pe__arrow`},`β`,-1),n(`div`,D,[(h(!0),i(c,null,t(q(e,G.value),(e,t)=>(h(),i(`span`,{key:t,class:`dl-pe__cell`},p(r(b)(e)),1))),128))]),n(`div`,O,` in the original order: [`+p(q(e,K.value).map(e=>r(b)(e)).join(`, `))+`] `,1)]))),128))]),m(` Nothing to claim until something has actually been reordered. `),U.value>0?(h(),i(`div`,{key:0,class:u([`dl-pe__verdict`,{"is-same":J.value}])},p(J.value?`every vector identical`:`something changed`),3)):m(`v-if`,!0)])):(h(),i(c,{key:1},[m(` One fixed vector per position, added before the first block. `),n(`div`,k,[n(`div`,A,[s[2]||=n(`div`,{class:`dl-pe__heatlabel`},`dimension β`,-1),n(`div`,j,[(h(!0),i(c,null,t(X.value,(e,o)=>(h(),i(`div`,{key:o,class:u([`dl-pe__heatrow`,{"is-active":Z.value===o}]),onMouseenter:e=>Z.value=o,onMouseleave:s[0]||=e=>Z.value=null},[n(`span`,N,p(o),1),(h(!0),i(c,null,t(e,(e,t)=>(h(),i(`span`,{key:t,class:u([`dl-pe__heatcell`,e>=0?`is-pos`:`is-neg`]),style:a({opacity:.12+Math.abs(e)*.88}),title:`pos ${o}, dim ${t}: ${r(b)(e)}`},null,14,P))),128))],42,M))),128))])])])],2112))]),_:1})}}}),[[`__scopeId`,`data-v-3178dbe7`]]);export{F as t};
|
|
|
|
|
|
lecture-06/assets/SlideWrapper-Cejg6ZDn.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
import{D as e,G as t,H as n,L as r,R as i,S as a,X as o,Y as s,Z as ee,_ as c,_t as l,b as u,bt as d,f,g as p,i as m,lt as h,m as g,mt as _,st as v,v as y,vt as b,w as x,y as S,z as C}from"./modules/shiki-BFOesOFp.js";import{A as w,Q as T,X as E,Z as D,t as te,tt as O,z as k}from"./useNav-BKmHNb0y.js";import{t as A}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{N as j,p as ne}from"./modules/vue-Ymwlffw_.js";import{_ as re,d as ie,f as M,g as N,h as P,m as F,n as I,p as L,v as R}from"./slidev/context-DrkI8qiD.js";import{n as z,r as B,t as V}from"./syncState-BrWO1mSt.js";import{a as H,p as U}from"./index-Cpw8zVhj.js";import"./slidev/client-CbOE_Oqt.js";import{t as W}from"./useDrawings-BgI2o36O.js";var G=[`innerHTML`],K=x({__name:`DrawingPreview`,props:{page:{}},setup(e){let{drawingState:t}=W();return(n,r)=>l(t)[e.page]?(C(),u(`svg`,{key:0,class:`w-full h-full absolute top-0 pointer-events-none`,innerHTML:l(t)[e.page]},null,8,G)):S(`v-if`,!0)}}),q=v({}),J=[],Y=[];z(q,`$syncUp`,!0),z(q,`$syncDown`,!0),z(q,`$paused`,!1),z(q,`$onSet`,e=>J.push(e)),z(q,`$onPatch`,e=>Y.push(e)),B(),z(q,`$patch`,async()=>!1);var ae=V(q,q,!0),X=window.navigator.userAgent.match(/Chrome\/(\d+)/)?.[1];X&&Number(X);var Z=window.navigator.userAgent.match(/Chrome\/(\d+)/)?.[1];Z&&Number(Z);var oe=new class{_screenshotSession=null;getSnapshot(e,t){let n=e+(t?`-dark`:`-light`),r=ae.state[n];if(!r)return;let i=k(e);if(i&&r?.revision===i?.meta.slide.revision)return r.image}async saveSnapshot(e,t,n){return!1}async startCapturing(e){return!1}},se=[`id`],ce=[`id`],le={class:`slidev-slide-container w-full h-full relative`},ue=[`src`],Q=h(null),de=A(x({__name:`SlideContainer`,props:{width:{type:Number},meta:{default:()=>({})},isMain:{type:Boolean,default:!1},no:{type:Number,required:!1},useSnapshot:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(e){let t=e,{isPrintMode:a}=te(),l=h(null),f=ne(l),_=h(null),v=p(()=>t.width??f.width.value),y=p(()=>t.width?t.width/E.value:f.height.value),b=p(()=>w.value&&!a.value?+w.value:Math.min(v.value/T.value,y.value/D.value)),x=p(()=>({...t.contentStyle,height:`${D.value}px`,width:`${T.value}px`,"--slidev-slide-scale":b.value})),O=p(()=>t.width?{width:`${t.width}px`,height:`${t.width/E.value}px`}:{});if(t.isMain){let e=document.documentElement.style;o(()=>e.setProperty(`--slidev-slide-scale`,b.value.toString())),i(()=>e.removeProperty(`--slidev-slide-scale`))}j(re,b),j(N,_),ee(()=>{t.isMain&&(Q.value=_.value)}),r(()=>{s(()=>t.isMain&&b.value,()=>{m()})});let k=p(()=>{if(!(t.no==null||!t.useSnapshot))return oe.getSnapshot(t.no,U.value)});return(t,r)=>k.value?(C(),u(g,{key:1},[S(` Image Snapshot `),c(`div`,le,[c(`img`,{src:k.value,class:`w-full h-full object-cover`,style:d(O.value)},null,12,ue),r[0]||=c(`div`,{absolute:``,"bottom-1":``,"right-1":``,"p0.5":``,"text-cyan:75":``,"bg-cyan:10":``,rounded:``,title:`Snapshot`},[c(`div`,{class:`i-carbon-camera`})],-1)])],2112)):(C(),u(`div`,{key:0,id:e.isMain?`slide-container`:void 0,ref_key:`container`,ref:l,class:`slidev-slide-container`,style:d(O.value)},[c(`div`,{id:e.isMain?`slide-content`:void 0,ref_key:`slideElement`,ref:_,class:`slidev-slide-content`,style:d(x.value)},[n(t.$slots,`default`,{},void 0,!0)],12,ce),n(t.$slots,`controls`,{},void 0,!0)],12,se))}}),[[`__scopeId`,`data-v-0167a76e`]]),fe=Object.assign({}),pe=Object.assign({}),me=Object.assign({}),he=Object.assign({}),ge=Object.assign({}),_e=Object.assign({}),ve={course:{code:`PGR207`,year:2026,title:`Deep Learning`,instructor:`Vajira Thambawita (PhD)`,email:`vajira@simula.no`},space:`DeepLearning-VT/DeepLearning_2026`,repo:`vlbthambawita/DeepLearning`,decks:[{id:`lecture-01`,title:`Introduction to Deep Learning`,subtitle:`Course overview, what deep learning is, and where it is used`,week:1,published:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025- Lecture 01.pdf`},{id:`lecture-02`,title:`Basics of Neural Networks`,subtitle:`Artificial neurons, the perceptron, Adaline and gradient descent`,week:2,published:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025 - Lecture 02 .pdf`},{id:`lecture-03`,title:`PyTorch for Deep Learning`,subtitle:`Tensors, autograd, and a fully-connected network on MNIST`,week:3,published:!0,notebook:null,source:null},{id:`lecture-04`,title:`Deep Convolutional Neural Networks`,subtitle:`Locality and weight sharing, the convolution operation, and CNNs in PyTorch`,week:4,published:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025 - Lecture 03.pdf`},{id:`lecture-05`,title:`Recurrent Neural Networks`,subtitle:`Sequence data, the recurrent layer, LSTM and GRU, and an RNN in PyTorch`,week:6,published:!0,publicNotes:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025 - Lecture 5_6.pdf`},{id:`lecture-06`,title:`Transformers`,subtitle:`Query, key and value; the original architecture, and what modern transformers changed`,week:7,published:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025 - Lecture 5_6.pdf`},{id:`lecture-07`,title:`Generative Models and GANs`,subtitle:`Autoencoders, VAEs, the adversarial game β and how diffusion took over`,week:9,published:!0,notebook:null,source:`old_slides/2025/Teaching - Deep Leaning - 2025 - Lecture 07.pdf`}]},ye=[`href`],be=Object.assign({"../../../../../packages/slidev-theme-dl2026/slide-top.vue":A(x({__name:`slide-top`,setup(e){let{$slidev:t,$page:n,$renderContext:r}=I(),i=p(()=>r.value===`slide`&&!t.nav.isPrintMode),a=p(()=>t.themeConfigs?.lecture??``),o=p(()=>t.themeConfigs?.lectureTitle??``),s=p(()=>{let e=n.value,t=`[${a.value?`Lecture ${a.value}, slide ${e}`:`Slide ${e}`}] `,r=[`**Lecture:** ${a.value}${o.value?` β ${o.value}`:``}`,`**Slide:** ${e}`,`**Link:** ${typeof window<`u`?`${window.location.origin}${window.location.pathname}#/${e}`:``}`,``,`**What is wrong?**`,`<!-- e.g. typo, wrong equation, broken figure, unclear explanation -->`,``].join(`
|
| 2 |
-
`),i=new URLSearchParams({title:t,body:r,labels:`slides`});return`https://github.com/${ve.repo}/issues/new?${i}`});return(e,t)=>i.value?(C(),u(`a`,{key:0,class:`dl-report`,href:s.value,target:`_blank`,rel:`noopener`,title:`Report a problem with this slide on GitHub`,onClick:t[0]||=f(()=>{},[`stop`])},`Report issue`,8,ye)):S(`v-if`,!0)}}),[[`__scopeId`,`data-v-6b2267dc`]])}),xe=Object.assign({}),Se=Object.assign({}),Ce=Object.assign({}),we=Object.assign({}),Te=Object.assign({}),Ee=[Object.values(fe)[0],Object.values(pe)[0],Object.values(me)[0]].filter(Boolean),De={render:()=>Ee.map(t=>e(t))},$=[Object.values(he)[0],Object.values(ge)[0],Object.values(_e)[0]].filter(Boolean),Oe={render:()=>$.map(t=>e(t))},ke=[Object.values(be)[0],Object.values(xe)[0],Object.values(Se)[0]].filter(Boolean),Ae={render:()=>ke.map(t=>e(t))},je=[Object.values(Ce)[0],Object.values(we)[0],Object.values(Te)[0]].filter(Boolean),Me={render:()=>je.map(t=>e(t))},Ne=[`data-slidev-no`,`lang`],Pe=A(x({__name:`SlideWrapper`,props:{clicksContext:{type:Object,required:!0},renderContext:{type:String,default:`slide`},route:{type:Object,required:!0}},setup(e){let n=e,r=p(()=>n.route.meta?.slide?.frontmatter.zoom??1);j(P,n.route),j(L,n.route.meta.slide.frontmatter),j(M,h(n.route.no)),j(F,h(n.renderContext)),j(ie,_(n,`clicksContext`)),j(R,r);let i=p(()=>({"user-select":O.selectable?void 0:`none`,"--slidev-slide-zoom-scale":r.value===1?void 0:r.value}));return(r,o)=>(C(),u(`div`,{"data-slidev-no":n.route.no,class:b(l(H)(e.route,[`slide`,`presenter`].includes(n.renderContext)?``:`disable-view-transition`)),style:d(i.value),lang:n.route.meta.slide.frontmatter.lang},[a(l(Me)),(C(),y(t(n.route.component))),a(l(Ae))],14,Ne))}}),[[`__scopeId`,`data-v-a7136532`]]);export{Q as a,de as i,Oe as n,K as o,De as r,Pe as t};
|
|
|
|
|
|
|
|
|
lecture-06/assets/TransformerBlock-D6V5Q80S.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
import{Q as e,S as t,V as n,_ as r,_t as i,b as a,g as o,lt as s,m as c,v as l,vt as u,w as d,x as f,xt as p,y as m,z as h}from"./modules/shiki-BFOesOFp.js";import{t as g}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as _}from"./slidev/context-DrkI8qiD.js";import{t as v}from"./WidgetFrame-D2L0MlKA.js";import{t as ee}from"./StepButton-BcP33F-1.js";var te=[`viewBox`,`aria-label`],y=[`x1`,`y1`,`x2`,`y2`],b=[`x`,`y`],x=[`x`,`y`],S=[`d`],C={key:0},w=[`cx`,`cy`],T=[`x`,`y`],E={key:1},D=[`y`],ne=[`x`,`y`],re=[`x`,`y`],ie=[`x`,`y`,`transform`],ae=440,O=48,k=244,A=132,j=34,M=12,N=26,P=72,F=g(d({__name:`TransformerBlock`,props:{variant:{default:`post`},switchable:{type:Boolean,default:!0},start:{default:`walk`}},setup(d){let{$slidev:g,$nav:F,$clicksContext:oe,$clicks:se,$page:ce,$renderContext:le,$frontmatter:ue}=_(),I=d,L=s(I.variant),R=s(0),z=s(I.start===`whole`),B=[{kind:`box`,label:`Multi-head self-attention`,sub:`positions mix here β and only here`,note:`Every position builds a new vector as a weighted sum over every position. This is the only part of the whole architecture where information moves sideways between tokens.`,sublayer:!0},{kind:`add`,label:`add`,note:`The residual connection: the sub-layerβs output is *added* to what came in, not substituted for it. Same trick as a ResNet, and for the same reason β it gives the gradient a path with no matrix on it.`},{kind:`box`,label:`LayerNorm`,sub:`per position, across features`,note:`Re-centre and re-scale each positionβs vector using its own mean and variance. Not BatchNorm: nothing is shared across the batch or across positions, which is what makes it safe with variable-length sequences.`},{kind:`box`,label:`Feed-forward network`,sub:`each position alone β 4Γ wide`,note:`Two linear layers with a non-linearity between them, applied to every position separately with the same weights. No token sees another here. This is where two thirds of a blockβs parameters live.`,sublayer:!0},{kind:`add`,label:`add`,note:`The second residual, around the feed-forward network.`},{kind:`box`,label:`LayerNorm`,sub:`per position, across features`,note:`And normalise again. In the 2017 wiring both norms sit *after* the add β which means they sit on the residual path itself.`}],V=[{kind:`box`,label:`LayerNorm`,sub:`RMSNorm in most modern models`,note:`Modern blocks normalise *before* the sub-layer instead of after it. RMSNorm drops the mean-subtraction and the bias and keeps only the rescaling β slightly cheaper, and empirically just as good.`},{kind:`box`,label:`Multi-head self-attention`,sub:`grouped-query, rotary positions`,note:`Still scaled dot-product attention, unchanged since 2017. What changed around it: position now enters by rotating Q and K (RoPE) rather than by adding a vector at the bottom, and several query heads share one key/value head to shrink the cache.`,sublayer:!0},{kind:`add`,label:`add`,note:`The residual β and note what is *not* on it any more. Nothing stands between the input and this add but the sub-layerβs own output.`},{kind:`box`,label:`LayerNorm`,sub:`RMSNorm`,note:`Normalise before the feed-forward network, on a copy of the residual stream rather than on the stream itself.`},{kind:`box`,label:`Feed-forward network`,sub:`SwiGLU β three matrices, not two`,note:`Still position-wise, still wide. The gated variant uses three matrices instead of two, and the hidden width is trimmed (about 8/3 d rather than 4 d) to keep the parameter count level.`,sublayer:!0},{kind:`add`,label:`add`,note:`The second residual. From input to output there is now an unbroken addition-only path through every block in the stack.`}],H=o(()=>L.value===`post`?B:V),U=o(()=>L.value===`post`?[{from:-1,to:1},{from:2,to:4}]:[{from:-1,to:2},{from:2,to:5}]),W=o(()=>R.value>=H.value.length);function G(){z.value=!1,R.value=W.value?0:R.value+1}function K(){L.value=L.value===`post`?`pre`:`post`,R.value=0,z.value=I.start===`whole`}function q(e){return z.value||R.value>=e+1}let J=o(()=>R.value===0?null:H.value[R.value-1]);function Y(e){return N+(H.value.length-e)*O}let X=o(()=>Y(-1)+6),Z=N,Q=o(()=>Y(-1)+36);function $(e){return e<0?X.value:Y(e)+(H.value[e].kind===`add`?0:j/2)}return(o,s)=>{let d=ee,g=v;return h(),l(g,{"max-width":`30rem`},{controls:e(()=>[t(d,{label:W.value&&!z.value?`Start over`:R.value===0?`Walk the block`:`Next part`,glyph:`βΈ`,onClick:G},null,8,[`label`]),I.switchable?(h(),l(d,{key:0,label:L.value===`post`?`Rewire: modern (pre-LN)`:`Rewire: 2017 (post-LN)`,variant:`ghost`,glyph:`β`,onClick:K},null,8,[`label`])):m(`v-if`,!0)]),readout:e(()=>[J.value?(h(),a(c,{key:0},[r(`strong`,null,p(J.value.label),1),f(` β `+p(J.value.note),1)],64)):L.value===`post`?(h(),a(c,{key:1},[f(` The 2017 block: attention, add, normalise, feed-forward, add, normalise. Two sub-layers, each wrapped in a residual and a LayerNorm, and the shape at the top is the shape at the bottom β which is what lets you stack six of them, or ninety-six. `)],64)):(h(),a(c,{key:2},[s[1]||=f(` The same two sub-layers, with the normalisation moved `,-1),s[2]||=r(`strong`,null,`before`,-1),s[3]||=f(` each one. Now nothing sits on the residual path: from the bottom of the stack to the top there is a route made only of additions. Post-LN needs a learning-rate warmup to train deep and pre-LN largely does not, which is why essentially every model after GPT-2 is wired this way. `,-1)],64))]),default:e(()=>[(h(),a(`svg`,{class:`dl-blk`,viewBox:`0 0 ${ae} ${Q.value}`,preserveAspectRatio:`xMidYMid meet`,role:`img`,"aria-label":`One transformer block, ${L.value===`post`?`with LayerNorm after each sub-layer as in the 2017 paper`:`with normalisation before each sub-layer as in modern models`}`},[s[0]||=r(`defs`,null,[r(`marker`,{id:`dl-blk-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`5`,markerHeight:`5`,orient:`auto-start-reverse`},[r(`path`,{d:`M0,0 L8,4 L0,8 z`,fill:`currentColor`})])],-1),m(` The main path, bottom to top. `),r(`line`,{class:`dl-blk__spine`,x1:254,y1:X.value,x2:254,y2:i(Z)+10,"marker-end":`url(#dl-blk-arrow)`},null,8,y),r(`text`,{class:`dl-blk__port`,x:254,y:X.value+18,"text-anchor":`middle`},` in β (T, d) one vector per token `,8,b),r(`text`,{class:`dl-blk__port`,x:254,y:i(Z)-6,"text-anchor":`middle`},` out β (T, d), same shape, ready for the next block `,8,x),m(` Residual connections, drawn as a rail down the left. `),(h(!0),a(c,null,n(U.value,(e,t)=>(h(),a(`path`,{key:`arc${t}`,class:u([`dl-blk__residual`,{"is-lit":z.value||R.value>e.to}]),d:`M 250 ${$(e.from)}
|
| 2 |
-
H ${P} V ${$(e.to)}
|
| 3 |
-
H 238`,"marker-end":`url(#dl-blk-arrow)`},null,10,S))),128)),(h(!0),a(c,null,n(H.value,(e,t)=>(h(),a(c,{key:e.label+t},[m(` Sub-layer output joining its add. `),e.kind===`add`?(h(),a(`g`,C,[r(`circle`,{class:u([`dl-blk__add`,{"is-lit":q(t),"is-current":R.value===t+1}]),cx:254,cy:Y(t),r:M},null,10,w),r(`text`,{class:`dl-blk__plus`,x:254,y:Y(t)+5,"text-anchor":`middle`},`+`,8,T)])):(h(),a(`g`,E,[r(`rect`,{class:u([`dl-blk__box`,{"is-lit":q(t),"is-current":R.value===t+1,"is-sublayer":e.sublayer}]),x:A,y:Y(t),width:k,height:j,rx:`6`},null,10,D),r(`text`,{class:u([`dl-blk__label`,{"is-lit":q(t)}]),x:254,y:Y(t)+(e.sub?15:22),"text-anchor":`middle`},p(e.label),11,ne),e.sub?(h(),a(`text`,{key:0,class:u([`dl-blk__sub`,{"is-lit":q(t)}]),x:254,y:Y(t)+27,"text-anchor":`middle`},p(e.sub),11,re)):m(`v-if`,!0)]))],64))),128)),r(`text`,{class:`dl-blk__rail`,x:64,y:Q.value/2,"text-anchor":`middle`,transform:`rotate(-90 64 ${Q.value/2})`},` residual stream `,8,ie)],8,te))]),_:1})}}}),[[`__scopeId`,`data-v-c465f205`]]);export{F as t};
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/TransformerGlyph-1pDKmZ2i.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{H as e,V as t,_ as n,_t as r,b as i,bt as a,m as o,vt as s,w as c,y as l,z as u}from"./modules/shiki-BFOesOFp.js";import{t as d}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as f}from"./slidev/context-DrkI8qiD.js";var p=[`width`,`height`,`aria-label`],m=[`id`],h={key:0},g=[`x`],_=[`d`],v=[`d`],y=[`marker-end`],b={key:1},x=[`d`],S=[`y`],C={key:2},w=[`cx`],T=[`d`],E=[`x`],D={key:3},O=[`marker-end`],k=[`marker-end`],A={key:4},j=[`y`],M=[`y`],N=[`marker-end`],P={key:5},F=[`x`,`y`],I=[`y`],L=[`marker-end`],R={key:6},z=[`x`,`y`],B={key:0,class:`dl-tglyph__label`},V=d(c({__name:`TransformerGlyph`,props:{kind:{},size:{default:64},label:{}},setup(c){let{$slidev:d,$nav:V,$clicksContext:H,$clicks:U,$page:W,$renderContext:G,$frontmatter:K}=f(),q=c,J=[{y:18,w:1.2,accent:!1},{y:50,w:6.5,accent:!0},{y:82,w:2.4,accent:!1}],Y=[0,2,1,2],X=Array.from({length:16},(e,t)=>({r:Math.floor(t/4),c:t%4}));return(c,d)=>(u(),i(`figure`,{class:`dl-tglyph`,style:a({width:`${q.size}px`})},[(u(),i(`svg`,{viewBox:`0 0 100 100`,width:q.size,height:q.size,role:`img`,"aria-label":q.label??q.kind},[n(`defs`,null,[n(`marker`,{id:`tg-head-${q.kind}`,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`},[...d[0]||=[n(`path`,{d:`M0 0 L6 3 L0 6 z`,class:`dl-tglyph__head`},null,-1)]],8,m)]),q.kind===`cut`?(u(),i(`g`,h,[(u(),i(o,null,t(3,e=>n(`rect`,{key:e,x:4+(e-1)*34,y:`36`,width:`24`,height:`28`,rx:`4`,class:`dl-tglyph__cell`},null,8,g)),64)),(u(),i(o,null,t(2,e=>n(`path`,{key:`l${e}`,d:`M${28+(e-1)*34} 50 H${38+(e-1)*34}`,class:`dl-tglyph__line`},null,8,_)),64)),(u(),i(o,null,t(2,e=>n(`path`,{key:`x${e}`,d:`M${29+(e-1)*34} 41 L${37+(e-1)*34} 59 M${37+(e-1)*34} 41 L${29+(e-1)*34} 59`,class:`dl-tglyph__cutmark`},null,8,v)),64)),n(`path`,{d:`M16 90 V68 M50 90 V68 M84 90 V68`,class:`dl-tglyph__arrow`,"marker-end":`url(#tg-head-${q.kind})`},null,8,y)])):q.kind===`qkv`?(u(),i(`g`,b,[(u(),i(o,null,t(J,(e,t)=>n(`path`,{key:t,d:`M22 50 L74 ${e.y}`,class:s([`dl-tglyph__weight`,{"is-accent":e.accent}]),style:a({strokeWidth:e.w})},null,14,x)),64)),d[1]||=n(`circle`,{cx:`18`,cy:`50`,r:`10`,class:`dl-tglyph__dot is-accent`},null,-1),(u(),i(o,null,t(J,(e,t)=>n(`rect`,{key:`k${t}`,x:`74`,y:e.y-9,width:`20`,height:`18`,rx:`3`,class:s([`dl-tglyph__tile`,{"is-accent":e.accent}])},null,10,S)),64)),d[2]||=n(`text`,{x:`18`,y:`54.5`,class:`dl-tglyph__t is-inv`,"text-anchor":`middle`},`q`,-1)])):q.kind===`heads`?(u(),i(`g`,C,[(u(),i(o,null,t(Y,(e,t)=>n(`g`,{key:t},[n(`circle`,{cx:14+t*24,cy:`80`,r:`6`,class:s([`dl-tglyph__dot`,{"is-accent":t===0}])},null,10,w),n(`path`,{d:`M${14+t*24} 74 L${14+t*24+(e-1)*9} 30`,class:s([`dl-tglyph__weight`,{"is-accent":t===0}]),style:{strokeWidth:3}},null,10,T)])),64)),(u(),i(o,null,t(4,e=>n(`rect`,{key:`t${e}`,x:4+(e-1)*24,y:`14`,width:`20`,height:`14`,rx:`3`,class:`dl-tglyph__tile`},null,8,E)),64))])):q.kind===`block`?(u(),i(`g`,D,[d[3]||=n(`rect`,{x:`16`,y:`54`,width:`62`,height:`14`,rx:`3`,class:`dl-tglyph__tile is-accent`},null,-1),d[4]||=n(`path`,{d:`M24 61 H70`,class:`dl-tglyph__line is-thin`},null,-1),d[5]||=n(`polygon`,{points:`26,22 70,22 62,40 34,40`,class:`dl-tglyph__cell`},null,-1),n(`path`,{d:`M47 94 V70 M47 52 V42 M47 20 V6`,class:`dl-tglyph__arrow`,"marker-end":`url(#tg-head-${q.kind})`},null,8,O),n(`path`,{d:`M47 80 H90 V12 H52`,class:`dl-tglyph__resid`,"marker-end":`url(#tg-head-${q.kind})`},null,8,k)])):q.kind===`encdec`?(u(),i(`g`,A,[(u(),i(o,null,t(3,e=>n(`rect`,{key:`e${e}`,x:`8`,y:14+(e-1)*26,width:`30`,height:`20`,rx:`3`,class:`dl-tglyph__tile`},null,8,j)),64)),(u(),i(o,null,t(3,e=>n(`rect`,{key:`d${e}`,x:`62`,y:14+(e-1)*26,width:`30`,height:`20`,rx:`3`,class:`dl-tglyph__cell`},null,8,M)),64)),n(`path`,{d:`M38 24 C 50 24, 50 50, 60 50`,class:`dl-tglyph__resid`,"marker-end":`url(#tg-head-${q.kind})`},null,8,N)])):q.kind===`decoder`?(u(),i(`g`,P,[(u(!0),i(o,null,t(r(X),e=>(u(),i(`rect`,{key:`${e.r}-${e.c}`,x:30+e.c*15,y:8+e.r*15,width:`13`,height:`13`,rx:`1.5`,class:s(e.c<=e.r?`dl-tglyph__mask is-on`:`dl-tglyph__mask`)},null,10,F))),128)),(u(),i(o,null,t(2,e=>n(`rect`,{key:`s${e}`,x:`30`,y:70+(e-1)*14,width:`58`,height:`11`,rx:`2`,class:`dl-tglyph__cell`},null,8,I)),64)),n(`path`,{d:`M14 96 V12`,class:`dl-tglyph__arrow`,"marker-end":`url(#tg-head-${q.kind})`},null,8,L)])):q.kind===`code`?(u(),i(`g`,R,[(u(),i(o,null,t(3,e=>n(`rect`,{key:e,x:24+(e-1)*8,y:16+(e-1)*8,width:`50`,height:`50`,rx:`2`,class:`dl-tglyph__slab`},null,8,z)),64)),d[6]||=n(`text`,{x:`16`,y:`54`,class:`dl-tglyph__t is-sm`,"text-anchor":`middle`},`B`,-1),d[7]||=n(`text`,{x:`65`,y:`94`,class:`dl-tglyph__t is-sm`,"text-anchor":`middle`},`T`,-1),d[8]||=n(`text`,{x:`90`,y:`20`,class:`dl-tglyph__t is-sm`,"text-anchor":`middle`},`d`,-1)])):l(`v-if`,!0)],8,p)),c.$slots.default?(u(),i(`figcaption`,B,[e(c.$slots,`default`,{},void 0,!0)])):l(`v-if`,!0)],4))}}),[[`__scopeId`,`data-v-390a4c86`]]);export{V as t};
|
|
|
|
|
|
lecture-06/assets/TransformerGlyph-DdjNaryB.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.dl-tglyph[data-v-390a4c86]{flex-direction:column;align-items:center;margin:0;display:inline-flex}.dl-tglyph__tile[data-v-390a4c86],.dl-tglyph__slab[data-v-390a4c86]{fill:var(--dl-surface);stroke:var(--dl-body);stroke-width:2px}.dl-tglyph__slab[data-v-390a4c86]{fill:var(--dl-bg)}.dl-tglyph__tile.is-accent[data-v-390a4c86],.dl-tglyph__cell[data-v-390a4c86]{fill:var(--dl-accent-soft);stroke:var(--dl-accent);stroke-width:2px}.dl-tglyph__arrow[data-v-390a4c86],.dl-tglyph__line[data-v-390a4c86]{fill:none;stroke:var(--dl-body);stroke-width:2.4px}.dl-tglyph__line.is-thin[data-v-390a4c86]{stroke:var(--dl-accent);stroke-width:1.4px;stroke-dasharray:3 2}.dl-tglyph__cutmark[data-v-390a4c86]{fill:none;stroke:var(--dl-danger);stroke-width:2.6px}.dl-tglyph__weight[data-v-390a4c86]{fill:none;stroke:var(--dl-muted);stroke-linecap:round}.dl-tglyph__weight.is-accent[data-v-390a4c86]{stroke:var(--dl-accent)}.dl-tglyph__resid[data-v-390a4c86]{fill:none;stroke:var(--dl-accent);stroke-width:2.2px;stroke-dasharray:4 3}.dl-tglyph__mask[data-v-390a4c86]{fill:var(--dl-surface);stroke:var(--dl-border);stroke-width:1px}.dl-tglyph__mask.is-on[data-v-390a4c86]{fill:var(--dl-accent-soft);stroke:var(--dl-accent)}.dl-tglyph__dot[data-v-390a4c86]{fill:var(--dl-muted)}.dl-tglyph__dot.is-accent[data-v-390a4c86]{fill:var(--dl-accent)}.dl-tglyph__head[data-v-390a4c86]{fill:var(--dl-body)}.dl-tglyph__t[data-v-390a4c86]{fill:var(--dl-heading);font-size:15px;font-weight:700}.dl-tglyph__t.is-inv[data-v-390a4c86]{fill:var(--dl-bg);font-size:13px}.dl-tglyph__t.is-sm[data-v-390a4c86]{fill:var(--dl-muted);font-size:12px;font-weight:600}.dl-tglyph__label[data-v-390a4c86]{color:var(--dl-body);text-align:center;white-space:nowrap;margin-top:.2rem;font-size:.78rem;font-weight:600}
|
|
|
|
|
|
lecture-06/assets/WidgetFrame-Czwyd28V.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.dl-widget[data-v-0f64089e]{flex-direction:column;gap:.6rem;width:100%;height:100%;min-height:0;display:flex}.dl-widget.is-controls-first[data-v-0f64089e]{flex-direction:column-reverse;justify-content:flex-end}.dl-widget__stage[data-v-0f64089e]{flex:auto;justify-content:center;align-items:center;min-height:0;display:flex}.dl-widget__controls[data-v-0f64089e]{flex-wrap:wrap;flex:none;align-items:center;gap:.5rem 1.2rem;display:flex}.dl-widget__controls[data-v-0f64089e]:empty,.dl-widget__readout[data-v-0f64089e]:empty{display:none}.dl-widget__readout[data-v-0f64089e]{color:var(--dl-muted);font-variant-numeric:tabular-nums;flex:none;font-size:.82rem}
|
|
|
|
|
|
lecture-06/assets/WidgetFrame-D2L0MlKA.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{H as e,_ as t,b as n,bt as r,vt as i,w as a,z as o}from"./modules/shiki-BFOesOFp.js";import{t as s}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as c}from"./slidev/context-DrkI8qiD.js";var l={class:`dl-widget__stage`},u={class:`dl-widget__controls`},d={class:`dl-widget__readout`},f=s(a({__name:`WidgetFrame`,props:{maxWidth:{default:`100%`},controlsFirst:{type:Boolean}},setup(a){let{$slidev:s,$nav:f,$clicksContext:p,$clicks:m,$page:h,$renderContext:g,$frontmatter:_}=c(),v=a;return(a,s)=>(o(),n(`div`,{class:i([`dl-widget`,{"is-controls-first":v.controlsFirst}]),style:r({maxWidth:v.maxWidth})},[t(`div`,l,[e(a.$slots,`default`,{},void 0,!0)]),t(`div`,u,[e(a.$slots,`controls`,{},void 0,!0)]),t(`div`,d,[e(a.$slots,`readout`,{},void 0,!0)])],6))}}),[[`__scopeId`,`data-v-0f64089e`]]);export{f as t};
|
|
|
|
|
|
lecture-06/assets/default-D0qxH3Ml.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{H as e,S as t,b as n,z as r}from"./modules/shiki-BFOesOFp.js";import{t as i}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as a}from"./slidev/context-DrkI8qiD.js";import{t as o}from"./DeckFooter-DkGAACS-.js";var s={class:`slidev-layout dl-default`},c=i({__name:`default`,setup(i){let{$slidev:c,$nav:l,$clicksContext:u,$clicks:d,$page:f,$renderContext:p,$frontmatter:m}=a();return(i,a)=>{let c=o;return r(),n(`div`,s,[e(i.$slots,`default`,{},void 0,!0),t(c)])}}},[[`__scopeId`,`data-v-3f3da7ce`]]);export{c as t};
|
|
|
|
|
|
lecture-06/assets/index-Cpw8zVhj.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
| 1 |
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./modules/file-saver-BpWusTEB.js","./rolldown-runtime-hePW80VL.js","./slidev/entry-DSOswi5I.js","./modules/shiki-BFOesOFp.js","./modules/shiki-BrmBd2_v.css","./_plugin-vue_export-helper-BDNMzG2s.js","./entry-Dba4BKje.css","./slidev/overview-BDL-WvEg.js","./useNav-BKmHNb0y.js","./modules/vue-Ymwlffw_.js","./slidev/context-DrkI8qiD.js","./modules/unplugin-icons-BIrNarL0.js","./slidev/IconButton-B5keGFol.js","./slidev/NoteDisplay-ym8deWTv.js","./NoteDisplay-DCBzjb4F.css","./SlideWrapper-Cejg6ZDn.js","./syncState-BrWO1mSt.js","./slidev/client-CbOE_Oqt.js","./useDrawings-BgI2o36O.js","./SlideWrapper-DBNQYNtZ.css","./slidev/NoteEditable-B4j4c8ZZ.js","./overview-BIQ10iVu.css","./slidev/notes-8CL_wwS7.js","./slidev/Modal-CjKJrPTu.js","./slidev/TimerBar-05p5nBrA.js","./slidev/notes-edit-tOOff3rP.js","./slidev/presenter-DL_E7IJt.js","./slidev/DrawingControls-CNEr-2w_.js","./slidev/VerticalDivider-D_ScNBWw.js","./DrawingControls-Dhbx0szf.css","./slidev/shortcuts-CFipR0_i.js","./shortcuts-nRB69a7e.css","./presenter-J5ibmAMh.css","./slidev/play-CgReZXhX.js","./play-D_7yfuao.css","./slidev/404-rf-O7dKq.js","./404-bkedjYjP.css"])))=>i.map(i=>d[i]);
|
| 2 |
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{F as t,I as n,O as r,P as i,S as a,T as o,U as s,X as c,Y as l,_t as u,b as d,ft as f,g as p,gt as m,it as h,k as g,lt as _,m as v,nt as y,s as b,st as x,t as S,w as C,y as w,z as T}from"./modules/shiki-BFOesOFp.js";import{$ as E,A as ee,B as te,G as ne,H as re,Q as D,R as ie,Z as ae,c as oe,et as O,h as se,j as k,l as ce,n as le,p as A,q as j,t as ue,tt as M,w as de,z as fe}from"./useNav-BKmHNb0y.js";import{A as pe,L as me,R as he,S as ge,T as _e,V as ve,f as ye,g as be,i as xe,j as Se,o as Ce,x as we,z as Te}from"./modules/vue-Ymwlffw_.js";import{a as Ee,c as De,d as Oe,f as ke,g as Ae,i as je,m as Me,o as Ne,p as Pe,r as Fe,s as Ie,u as Le,y as Re}from"./slidev/context-DrkI8qiD.js";import{n as N,r as ze,t as Be}from"./syncState-BrWO1mSt.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})(),_(!1),_(!1);var Ve=new Set([`link`,`style`,`script`,`noscript`]),He=new Set([`title`,`titleTemplate`,`script`,`style`,`noscript`]),Ue=new Set([`base`,`meta`,`link`,`style`,`script`,`noscript`]),We=new Set([`title`,`base`,`htmlAttrs`,`bodyAttrs`,`meta`,`link`,`style`,`script`,`noscript`]),Ge=new Set([`base`,`title`,`titleTemplate`,`bodyAttrs`,`htmlAttrs`,`templateParams`]),Ke=new Set([`key`,`tagPosition`,`tagPriority`,`tagDuplicateStrategy`,`innerHTML`,`textContent`,`processTemplateParams`]),qe=new Set([`templateParams`,`htmlAttrs`,`bodyAttrs`]),Je=new Set([`theme-color`,`google-site-verification`,`author`,`og:locale:alternate`,`og:image`,`og:video`,`og:audio`,`article:author`,`article:tag`,`book:author`,`book:tag`,`twitter:image`]),Ye={critical:-8,high:-1,low:2},Xe=e=>typeof e==`number`?Number.isFinite(e):e;function Ze(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function Qe(e,t,n,r){for(let i=n;i<e.length;i+=1)try{let n=r?r.run(()=>e[i](...t)):e[i](...t);if(n&&typeof n.then==`function`)return Promise.resolve(n).then(()=>Qe(e,t,i+1,r))}catch(e){return Promise.reject(e)}}var $e=class{_hooks;constructor(){this._hooks={}}hook(e,t){return!e||typeof t!=`function`?()=>{}:(this._hooks[e]=this._hooks[e]||[],this._hooks[e].push(t),()=>{t&&=(this.removeHook(e,t),void 0)})}removeHook(e,t){let n=this._hooks[e];if(n){let r=n.indexOf(t);r!==-1&&n.splice(r,1),n.length===0&&(this._hooks[e]=void 0)}}callHook(e,...t){let n=this._hooks[e];if(!(!n||n.length===0))return Qe(n,t,0)}};function et(e){let t=new $e;for(let n in e||{})t.hook(n,e[n]);return t}function tt(e,t,n){if(e.hooks?._hooks?.[t]?.length)return e.hooks?.callHook(t,n)}var nt=/^(?:viewport|description|keywords|robots)$/,rt=[`name`,`property`,`http-equiv`];function it(e){let t=e.indexOf(`:`);if(t===-1)return!1;let n=e.slice(t+1);return Je.has(n)||n.startsWith(`og:image:`)||n.startsWith(`og:video:`)||n.startsWith(`og:audio:`)||n.startsWith(`twitter:image:`)}function at(e){let{props:t,tag:n,key:r}=e;if(Ge.has(n))return n;if(n===`link`){if(t.rel===`canonical`)return`canonical`;if(t.rel===`alternate`&&t.hreflang)return`alternate:${t.hreflang}`}if(t.charset)return`charset`;if(n===`meta`)for(let e of rt){let n=t[e];if(n!==void 0)return`meta:${n}${(typeof n!=`string`||!n.includes(`:`))&&!nt.test(n)&&r?`:key:${r}`:``}`}return r?`${n}:key:${r}`:t.id?`${n}:id:${t.id}`:n===`link`&&t.rel&&t.href?`link:${t.rel}:${t.href}`:He.has(n)&&(e.textContent||e.innerHTML)?`${n}:content:${e.textContent||e.innerHTML}`:void 0}function ot(e){let t=e._h||e._d||e.textContent||e.innerHTML;if(t)return t;let n=Object.keys(e.props).sort(),r=`${e.tag}:`,i=``;for(let t of n)r+=`${i}${t}:${String(e.props[t])}`,i=`,`;return r}function st(e,t,n){if(n===`_resolver`)return e;typeof e==`function`&&(!n||n!==`titleTemplate`&&!n.startsWith(`on`))&&(e=e());let r=t?t(n,e):e;if(Array.isArray(r)){let e;for(let n=0;n<r.length;n++){let i=st(r[n],t);e?e[n]=i:i!==r[n]&&(e=r.slice(0,n),e[n]=i)}return e||r}if(r?.constructor===Object){let e;for(let n in r){let i=Ze(n),a=i?void 0:st(r[n],t,n);if(!e&&(i||a!==r[n])){e={};for(let t in r){if(t===n)break;e[t]=r[t]}}e&&!i&&(e[n]=a)}return e||r}return r}var ct=/[\s"'<>/=\x00-\x1F\x7F]/;function lt(e,t){let n=e===`style`,r=n?new Map:new Set,i=e=>{if(e){if(n){let t=e.indexOf(`:`);t>0&&r.set(e.slice(0,t).trim(),e.slice(t+1).trim())}else e.split(` `).forEach(e=>e&&r.add(e))}};if(typeof t==`string`)(n?t.split(`;`):[t]).forEach(i);else if(Array.isArray(t))t.forEach(i);else if(t&&typeof t==`object`)for(let e in t){let a=t[e];a&&a!==`false`&&(n?r.set(e.trim(),String(a)):i(e))}return r}function ut(e,t){if(e.props=e.props||{},!t)return e;if(e.tag===`templateParams`)return e.props=t,e;let n=Ue.has(e.tag)||e.tag===`htmlAttrs`||e.tag===`bodyAttrs`;for(let r in t){if(Ze(r))continue;let i=r.startsWith(`data-`),a=n&&!Ke.has(r),o=a&&!i?r.toLowerCase():r;if(a&&(!o||ct.test(o)))continue;let s=t[r];if(s===null)e.props[o]=null;else if(r===`class`||r===`style`)e.props[r]=lt(r,s);else if(Ke.has(r)){if((r===`textContent`||r===`innerHTML`)&&typeof s==`object`){let n=t.type||`application/json`;(n.endsWith(`json`)||n===`speculationrules`||n===`importmap`)&&(e.props.type=t.type=n,e[r]=JSON.stringify(s))}else e[r]=s}else if(s!==void 0){let t=String(s),n=e.tag===`meta`&&o===`content`;e.props[o]=t===`true`||t===``?i||n?t:!0:!s&&i&&t===`false`?`false`:s}}return e}function dt(e,t){let n;return t.length&&(n=(e,n)=>{for(let r=0;r<t.length;r++)n=t[r](e,n);return n},e=n(void 0,e)),st(e,n)}function ft(e,t){let n=ut({tag:e,props:{}},typeof t==`object`&&typeof t!=`function`?t:{[e===`script`||e===`noscript`||e===`style`?`innerHTML`:`textContent`]:t});if(n.key&&Ve.has(n.tag)&&(n.props[`data-hid`]=n._h=n.key),n.tag===`script`&&typeof n.innerHTML==`object`&&(n.innerHTML=JSON.stringify(n.innerHTML),n.props.type=n.props.type||`application/json`),Array.isArray(n.props.content)){let e=[];for(let t of n.props.content)e.push({...n,props:{...n.props,content:t}});return e}return n}function pt(e,t){if(Array.isArray(t))for(let n of t)e.push(n);else e.push(t)}function mt(e,t){if(!e)return[];typeof e==`function`&&(e=e()),e=dt(e,t);let n=[];for(let t in e){let r=e[t];if(r!==void 0){if(Array.isArray(r))for(let e of r)pt(n,ft(t,e));else pt(n,ft(t,r))}}return n}var ht=/</g,gt=/<\/script/g,_t=(e,t)=>e._w===t._w?e._p-t._p:e._w-t._w,vt=()=>100;function yt(e){for(let t in e)return!1;return!0}var bt=/^tags:|:render/;function xt(e,t){let n=(t[`entries:resolve`]?.length||0)+(t[`entries:normalize`]?.length||0);if(e._h!==n){e._h=n;for(let t of e.entries.values())delete t._tags}}function St(e){for(let t=0;t<e.length;t++){let n=e[t],r={...n.props};r.class instanceof Set&&(r.class=new Set(r.class)),r.style instanceof Map&&(r.style=new Map(r.style)),e[t]={...n,props:r}}}function Ct(e,t){let n=e.tags,r=0;for(let t of e.tagMap.values())if(Array.isArray(t))for(let e of t)n[r++]=e;else n[r++]=t;n.length=r,t&&n.sort(_t)}function wt(e){let t=!1;for(let n of e.tags.sort(_t)){let r=n._d||ot(n);if(!r)continue;let i=e.tagMap.get(r);if(!i){e.tagMap.set(r,n);continue}if((n.tagDuplicateStrategy||(qe.has(n.tag)?`merge`:null)||(n.key&&n.key===i.key?`merge`:null))===`merge`){let t={...i.props};for(let e in n.props)t[e]=e===`style`?new Map([...i.props.style||new Map,...n.props[e]]):e===`class`?new Set([...i.props.class||[],...n.props[e]]):n.props[e];e.tagMap.set(r,{...n,props:t})}else n._p>>10==i._p>>10&&n.tag===`meta`&&it(r)?(e.tagMap.set(r,Object.assign([...Array.isArray(i)?i:[i],n],n)),t=!0):(n._w===i._w?n._p>i._p:n._w<i._w)&&e.tagMap.set(r,n)}return t}function Tt(e,t){let n=e.tagMap.get(`title`),r=e.tagMap.get(`titleTemplate`);if(t._title=n?.textContent,!r)return;let i=r.textContent;if(t._titleTemplate=i,!i)return;let a=typeof i==`function`?i(n?.textContent):i;typeof a==`string`&&!t.plugins.has(`template-params`)&&(a=a.replace(`%s`,n?.textContent||``)),n?a===null?e.tagMap.delete(`title`):e.tagMap.set(`title`,{...n,textContent:a}):e.tagMap.set(`titleTemplate`,{...r,tag:`title`,textContent:a})}function Et(e){let t=0;for(let n of e){let{innerHTML:r,tag:i,props:a}=n;if(!(!We.has(i)||yt(a)&&!Xe(r)&&!Xe(n.textContent))&&!(i===`meta`&&!Xe(a.content)&&!a[`http-equiv`]&&!a.charset)){if(i===`script`&&(r||n.textContent)){let e=String(a.type),t=e.endsWith(`json`)||e===`importmap`||e===`speculationrules`,i=e=>t?(typeof e==`string`?e:JSON.stringify(e)).replace(ht,`\\u003C`):typeof e==`string`?e.replace(gt,`<\\/script`):e;n={...n},r&&(n.innerHTML=i(r)),n.textContent&&(n.textContent=i(n.textContent)),n._d=at(n)}e[t++]=n}}return e.length=t,e}function Dt(e,t){let n=t?.tagWeight??e.resolvedOptions._tagWeight??vt,r={tagMap:new Map,tags:[]},i=e.hooks?._hooks||{};xt(e,i);for(let t of e.entries.values())t._pending!==void 0&&(t.input=t._pending,delete t._pending,delete t._tags,delete t._precomputedTags);let a;(i[`entries:resolve`]?.length||i[`entries:normalize`]?.length)&&(a=[...e.entries.values()],i[`entries:resolve`]?.length&&tt(e,`entries:resolve`,{entries:a,...r})),xt(e,i);for(let t of a||e.entries.values()){let a=t._tags;if(!a){if(t._precomputedTags&&n===e.resolvedOptions._tagWeight&&!i[`entries:normalize`]?.length&&!i[`entries:resolve`]?.length&&(!t.options||yt(t.options)))a=t._precomputedTags;else{if(a=mt(t.input,e.resolvedOptions.propResolvers||[]),t.options&&!yt(t.options))for(let e of a)Object.assign(e,t.options);if(i[`entries:normalize`]?.length){let n={tags:a,entry:t};tt(e,`entries:normalize`,n),a=n.tags}for(let e=0;e<a.length;e++){let r=a[e];r._w=n(r),r._p=(t._i<<10)+e,r._d=at(r),r._d||(r._h=ot(r))}t._tags=a}}r.tags.push(...a)}for(let e in i)if(i[e]?.length&&bt.test(e)){St(r.tags);break}let o=wt(r);return Tt(r,e),Ct(r,o),tt(e,`tags:beforeResolve`,r),tt(e,`tags:resolve`,r),tt(e,`tags:afterResolve`,r),Et(r.tags)}var Ot=`usehead`;function kt(){if(r()){let e=g(Ot);if(e)return e}throw Error(`useHead() was called without provide context, ensure you call it through the setup() function.`)}function At(e){return{install(t){t.config.globalProperties.$unhead=e,t.config.globalProperties.$head=e,t.provide(Ot,e)}}.install}var jt=Object.assign((e,t)=>h(t)?m(t):t,{_static:!0});function Mt(e,t={}){let n=t.head||kt();return n.ssr?n.push(e||{},t):Nt(n,e,t)}function Nt(e,r,a={}){let s=y();if(s&&!s.active)return{patch(){},dispose(){},_i:-1};let l=_(!1);if(a.onRendered&&s){let e=a.onRendered;a={...a,onRendered:t=>s.run(()=>e(t))}}let u;return c(()=>{let t=l.value?{}:st(r,jt);u?u.patch(t):u=e.push(t,a)}),o()&&(t(()=>{u.dispose()}),n(()=>{l.value=!0}),i(()=>{l.value=!1})),u}function Pt(e,t){if(typeof t==`function`&&t.key&&e.plugins.has(t.key))return;let n=typeof t==`function`?t(e):t,r=n.key||String(e.plugins.size+1);if(!e.plugins.get(r)){e.plugins.set(r,n);for(let t in n.hooks||{})e.hooks?.hook(t,n.hooks[t])}}function Ft(e,t={}){let n=!t.document,r=new Map,i={_entryCount:1,_h:0,plugins:new Map,resolvedOptions:t,ssr:n,entries:r,hooks:void 0,render:()=>e(i),use:e=>Pt(i,e),push(e,t){let a=t?._index??i._entryCount++,o=t?{...t}:{};delete o.head,delete o.onRendered,delete o._index;let s={_i:a,input:e,options:o};return r.set(a,s),{_i:a,dispose(){r.delete(a)},patch(e){n?(s.input=e,delete s._tags):s._pending=e,r.has(a)||r.set(a,s)}}}};return t.init?.forEach(e=>e&&i.push(e)),i}var It=Object.assign({}),Lt=Object.assign({}),Rt=Object.assign({}),zt=[Object.values(It)[0],Object.values(Lt)[0],Object.values(Rt)[0]].filter(Boolean),Bt=we(),Vt=be(`slidev-color-schema`,`auto`),Ht=p(()=>M.colorSchema!==`auto`),Ut=p({get(){return Ht.value?M.colorSchema===`dark`:Vt.value===`auto`?Bt.value:Vt.value===`dark`},set(e){Ht.value||(Vt.value=e===Bt.value?`auto`:e?`dark`:`light`)}}),Wt=me(Ut);Se&&l(Ut,e=>{let t=window.document.createElement(`style`);t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),window.document.head.appendChild(t);let n=document.querySelector(`html`);n.classList.toggle(`dark`,e),n.classList.toggle(`light`,!e),window.getComputedStyle(t).opacity,document.head.removeChild(t)},{immediate:!0});function Gt(){let{isPrintMode:e}=ue();ge(p(()=>e.value?`
|
| 3 |
-
@page {
|
| 4 |
-
size: ${D.value}px ${ae.value}px;
|
| 5 |
-
margin: 0px;
|
| 6 |
-
}
|
| 7 |
-
|
| 8 |
-
* {
|
| 9 |
-
transition: none !important;
|
| 10 |
-
transition-duration: 0s !important;
|
| 11 |
-
}`:``))}var Kt=Symbol.for(`yaml.alias`),qt=Symbol.for(`yaml.document`),Jt=Symbol.for(`yaml.map`),Yt=Symbol.for(`yaml.pair`),Xt=Symbol.for(`yaml.scalar`),Zt=Symbol.for(`yaml.seq`),P=Symbol.for(`yaml.node.type`),Qt=e=>!!e&&typeof e==`object`&&e[P]===Kt,$t=e=>!!e&&typeof e==`object`&&e[P]===qt,en=e=>!!e&&typeof e==`object`&&e[P]===Jt,F=e=>!!e&&typeof e==`object`&&e[P]===Yt,I=e=>!!e&&typeof e==`object`&&e[P]===Xt,tn=e=>!!e&&typeof e==`object`&&e[P]===Zt;function L(e){if(e&&typeof e==`object`)switch(e[P]){case Jt:case Zt:return!0}return!1}function R(e){if(e&&typeof e==`object`)switch(e[P]){case Kt:case Jt:case Xt:case Zt:return!0}return!1}var nn=e=>(I(e)||L(e))&&!!e.anchor,z=Symbol(`break visit`),rn=Symbol(`skip children`),an=Symbol(`remove node`);function on(e,t){let n=cn(t);$t(e)?sn(null,e.contents,n,Object.freeze([e]))===an&&(e.contents=null):sn(null,e,n,Object.freeze([]))}on.BREAK=z,on.SKIP=rn,on.REMOVE=an;function sn(e,t,n,r){let i=ln(e,t,n,r);if(R(i)||F(i))return un(e,r,i),sn(e,i,n,r);if(typeof i!=`symbol`){if(L(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=sn(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===z)return z;else i===an&&(t.items.splice(e,1),--e)}}else if(F(t)){r=Object.freeze(r.concat(t));let e=sn(`key`,t.key,n,r);if(e===z)return z;e===an&&(t.key=null);let i=sn(`value`,t.value,n,r);if(i===z)return z;i===an&&(t.value=null)}}return i}function cn(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function ln(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(en(t))return n.Map?.(e,t,r);if(tn(t))return n.Seq?.(e,t,r);if(F(t))return n.Pair?.(e,t,r);if(I(t))return n.Scalar?.(e,t,r);if(Qt(t))return n.Alias?.(e,t,r)}function un(e,t,n){let r=t[t.length-1];if(L(r))r.items[e]=n;else if(F(r))e===`key`?r.key=n:r.value=n;else if($t(r))r.contents=n;else{let e=Qt(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function dn(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function fn(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=fn(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=fn(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=fn(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=fn(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function B(e,t,n){if(Array.isArray(e))return e.map((e,t)=>B(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!nn(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var pn=class{constructor(e){Object.defineProperty(this,P,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!$t(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=B(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?fn(i,{"":o},``,o):o}},mn=class extends pn{constructor(e){super(Kt),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],on(e,{Node:(e,t)=>{(Qt(t)||nn(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(B(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=hn(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(dn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function hn(e,t,n){if(Qt(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(L(t)){let r=0;for(let i of t.items){let t=hn(e,i,n);t>r&&(r=t)}return r}if(F(t)){let r=hn(e,t.key,n),i=hn(e,t.value,n);return Math.max(r,i)}return 1}var gn=e=>!e||typeof e!=`function`&&typeof e!=`object`,V=class extends pn{constructor(e){super(Xt),this.value=e}toJSON(e,t){return t?.keep?this.value:B(this.value,e,t)}toString(){return String(this.value)}};V.BLOCK_FOLDED=`BLOCK_FOLDED`,V.BLOCK_LITERAL=`BLOCK_LITERAL`,V.PLAIN=`PLAIN`,V.QUOTE_DOUBLE=`QUOTE_DOUBLE`,V.QUOTE_SINGLE=`QUOTE_SINGLE`;var _n=`tag:yaml.org,2002:`;function vn(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function yn(e,t,n){if($t(e)&&(e=e.contents),R(e))return e;if(F(e)){let t=n.schema[Jt].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new mn(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=_n+t.slice(2));let l=vn(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new V(e);return c&&(c.node=t),t}l=e instanceof Map?o[Jt]:Symbol.iterator in Object(e)?o[Zt]:o[Jt]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new V(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function bn(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return yn(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var xn=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Sn=class extends pn{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>R(t)||F(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(xn(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(L(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,bn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(L(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&I(i)?i.value:i:L(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!F(t))return!1;let n=t.value;return n==null||e&&I(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return L(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(L(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,bn(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Cn=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function wn(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Tn=(e,t,n)=>e.endsWith(`
|
| 12 |
-
`)?wn(n,t):n.includes(`
|
| 13 |
-
`)?`
|
| 14 |
-
`+wn(n,t):(e.endsWith(` `)?``:` `)+n,En=`flow`,Dn=`block`,On=`quoted`;function kn(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=An(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
| 15 |
-
`)n===`block`&&(h=An(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
| 16 |
-
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
| 17 |
-
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function An(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
| 18 |
-
`);r=t,i=t+1,a=e[i]}return r}var jn=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Mn=e=>/^(%|---|\.\.\.)/m.test(e);function Nn(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
| 19 |
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Pn(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Mn(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
| 20 |
-
|
| 21 |
-
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
| 22 |
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:kn(o,a,On,jn(t,!1))}function Fn(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
| 23 |
-
`)||/[ \t]\n|\n[ \t]/.test(e))return Pn(e,t);let n=t.indent||(Mn(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:kn(r,n,En,jn(t,!1))}function In(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Pn;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Fn:i&&!t?Pn:n?Fn:Pn}return r(e,t)}var Ln;try{Ln=RegExp(`(^|(?<!
|
| 24 |
-
))
|
| 25 |
-
+(?!
|
| 26 |
-
|$)`,`g`)}catch{Ln=/\n+(?!\n|$)/g}function Rn({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return In(n,r);let l=r.indent||(r.forceBlockIndent||Mn(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===V.BLOCK_FOLDED?!1:t===V.BLOCK_LITERAL||!Nn(n,c,l.length);if(!n)return u?`|
|
| 27 |
-
`:`>
|
| 28 |
-
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
| 29 |
-
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
| 30 |
-
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
| 31 |
-
`&&(p=p.slice(0,-1)),p.replace(Ln,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
| 32 |
-
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
| 33 |
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=jn(r,!0);o!==`folded`&&t!==V.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=kn(`${v}${e}${p}`,l,Dn,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function zn(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
| 34 |
-
`)||u&&/[[\]{},]/.test(a))return In(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
| 35 |
-
`)?In(a,t):Rn(e,t,n,r);if(!s&&!u&&i!==V.PLAIN&&a.includes(`
|
| 36 |
-
`))return Rn(e,t,n,r);if(Mn(a)){if(c===``)return t.forceBlockIndent=!0,Rn(e,t,n,r);if(s&&c===l)return In(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return In(a,t)}return s?d:kn(d,c,En,jn(t,!1))}function Bn(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==V.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=V.QUOTE_DOUBLE);let c=e=>{switch(e){case V.BLOCK_FOLDED:case V.BLOCK_LITERAL:return i||a?In(o.value,t):Rn(o,t,n,r);case V.QUOTE_DOUBLE:return Pn(o.value,t);case V.QUOTE_SINGLE:return Fn(o.value,t);case V.PLAIN:return zn(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Vn(e,t){let n=Object.assign({blockQuote:!0,commentString:Cn,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Hn(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(I(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Un(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(I(e)||L(e))&&e.anchor;a&&dn(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Wn(e,t,n,r){if(F(e))return e.toString(t,n,r);if(Qt(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=R(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Hn(t.doc.schema.tags,a);let o=Un(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):I(a)?Bn(a,t,n,r):a.toString(t,n,r);return o?I(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Gn({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=R(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(L(e)||!R(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||L(e)||(I(e)?e.type===V.BLOCK_FOLDED||e.type===V.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Wn(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=Tn(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Tn(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Tn(g,n.indent,l(f))));let _,v,y;R(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&I(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&tn(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Wn(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
| 37 |
-
`:``,v){let e=l(v);S+=`\n${wn(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
| 38 |
-
`&&y&&(S=`
|
| 39 |
-
|
| 40 |
-
`):S+=`\n${n.indent}`}else if(!p&&L(t)){let e=x[0],r=x.indexOf(`
|
| 41 |
-
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
| 42 |
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=Tn(g,n.indent,l(y)):h&&i&&i(),g}function Kn(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var qn=`<<`,Jn={identify:e=>e===qn||typeof e==`symbol`&&e.description===qn,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new V(Symbol(qn)),{addToJSMap:Xn}),stringify:()=>qn},Yn=(e,t)=>(Jn.identify(t)||I(t)&&(!t.type||t.type===V.PLAIN)&&Jn.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Jn.tag&&e.default);function Xn(e,t,n){let r=Qn(e,n);if(tn(r))for(let n of r.items)Zn(e,t,n);else if(Array.isArray(r))for(let n of r)Zn(e,t,n);else Zn(e,t,r)}function Zn(e,t,n){let r=Qn(e,n);if(!en(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Qn(e,t){return e&&Qt(t)?t.resolve(e.doc,e):t}function $n(e,t,{key:n,value:r}){if(R(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Yn(e,n))Xn(e,t,r);else{let i=B(n,``,e);if(t instanceof Map)t.set(i,B(r,i,e));else if(t instanceof Set)t.add(i);else{let a=er(n,i,e),o=B(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function er(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(R(e)&&n?.doc){let t=Vn(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Kn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function tr(e,t,n){return new H(yn(e,void 0,n),yn(t,void 0,n))}var H=class e{constructor(e,t=null){Object.defineProperty(this,P,{value:Yt}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return R(n)&&(n=n.clone(t)),R(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return $n(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Gn(this,e,t,n):JSON.stringify(this)}};function nr(e,t,n){return(t.inFlow??e.flow?ir:rr)(e,t,n)}function rr({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(R(i))!d&&i.spaceBefore&&f.push(``),ar(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(F(i)){let e=R(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ar(n,f,e.commentBefore,d))}d=!1;let s=Wn(i,u,()=>o=null,()=>d=!0);o&&(s+=Tn(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
| 43 |
-
`}}return e?(p+=`
|
| 44 |
-
`+wn(l(e),c),s&&s()):d&&o&&o(),p}function ir({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(R(i))i.spaceBefore&&d.push(``),ar(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(F(i)){let e=R(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),ar(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=R(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Wn(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
| 45 |
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=Tn(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
| 46 |
-
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function ar({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=wn(t(r),e);n.push(i.trimStart())}}function U(e,t){let n=I(t)?t.value:t;for(let r of e)if(F(r)&&(r.key===t||r.key===n||I(r.key)&&r.key.value===n))return r}var W=class extends Sn{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Jt,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(tr(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=F(e)?e:!e||typeof e!=`object`||!(`key`in e)?new H(e,e?.value):new H(e.key,e.value);let r=U(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);I(r.value)&&gn(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=U(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=U(this.items,e)?.value;return(!t&&I(n)?n.value:n)??void 0}has(e){return!!U(this.items,e)}set(e,t){this.add(new H(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)$n(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!F(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),nr(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},or={collection:`map`,default:!0,nodeClass:W,tag:`tag:yaml.org,2002:map`,resolve(e,t){return en(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>W.from(e,t,n)},sr=class extends Sn{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Zt,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=cr(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=cr(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&I(r)?r.value:r}has(e){let t=cr(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=cr(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];I(r)&&gn(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(B(e,String(r++),t));return n}toString(e,t,n){return e?nr(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(yn(a,void 0,n))}}return i}};function cr(e){let t=I(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var lr={collection:`seq`,default:!0,nodeClass:sr,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return tn(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>sr.from(e,t,n)};function ur(e){return typeof e==`bigint`||Number.isInteger(e)}var dr=({value:e})=>JSON.stringify(e),fr=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:dr},{identify:e=>e==null,createNode:()=>new V(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:dr},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:dr},{identify:ur,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>ur(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:dr}];[or,lr].concat(fr,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function pr(e,t,n){let{replacer:r}=n,i=new sr(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(tr(o,s,n))}return i}var mr=class e extends sr{constructor(){super(),this.add=W.prototype.add.bind(this),this.delete=W.prototype.delete.bind(this),this.get=W.prototype.get.bind(this),this.has=W.prototype.has.bind(this),this.set=W.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(F(e)?(r=B(e.key,``,t),i=B(e.value,r,t)):r=B(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=pr(e,t,n),i=new this;return i.items=r.items,i}};mr.tag=`tag:yaml.org,2002:omap`;var hr=class e extends W{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=F(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new H(e.key,null):new H(e,null),U(this.items,t.key)||this.items.push(t)}get(e,t){let n=U(this.items,e);return!t&&F(n)?I(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=U(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new H(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(tr(e,null,n));return i}};hr.tag=`tag:yaml.org,2002:set`;var gr=Symbol(`break visit`),_r=Symbol(`skip children`),vr=Symbol(`remove item`);function yr(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),br(Object.freeze([]),e,t)}yr.BREAK=gr,yr.SKIP=_r,yr.REMOVE=vr,yr.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},yr.parentCollection=(e,t)=>{let n=yr.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function br(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=br(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===gr)return gr;else r===vr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function xr(e=5){let t=[];for(let n=0;n<e;n++)t.push(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`.charAt(Math.floor(Math.random()*52)));return t.join(``)}function Sr(e,t,n,r){let i=re(t+n-1,e);for(let e=0;e<t;e++){let t=r(e),a=i.includes(e+n);for(let e of t)e.classList.toggle(`slidev-code-highlighted`,a),e.classList.toggle(`slidev-code-dishonored`,!a),e.classList.toggle(`highlighted`,a),e.classList.toggle(`dishonored`,!a)}}var G=x({}),Cr=[],wr=[];N(G,`$syncUp`,!0),N(G,`$syncDown`,!0),N(G,`$paused`,!1),N(G,`$onSet`,e=>Cr.push(e)),N(G,`$onPatch`,e=>wr.push(e)),ze(),N(G,`$patch`,async()=>!1);var{init:Tr,onPatch:Er,onUpdate:Dr,patch:Or,state:kr}=Be(G,G,!1),K=x({page:0,clicks:0,timer:{status:`stopped`,slides:{},startedAt:0,pausedAt:0}}),Ar=[],jr=[];N(K,`$syncUp`,!0),N(K,`$syncDown`,!0),N(K,`$paused`,!1),N(K,`$onSet`,e=>Ar.push(e)),N(K,`$onPatch`,e=>jr.push(e)),ze(),N(K,`$patch`,async()=>!1);var{init:Mr,onPatch:Nr,onUpdate:Pr,patch:Fr,state:Ir}=Be(K,{page:1,clicks:0,clicksTotal:0,timer:{status:`stopped`,slides:{},startedAt:0,pausedAt:0}});function Lr(){let e=o().appContext.app,t=x({nav:ue(),configs:M,themeConfigs:p(()=>M.themeConfig)});e.provide(Me,_(`none`)),e.provide(Re,t),e.provide(ke,p(()=>t.nav.currentSlideNo)),e.provide(Oe,f(ne()));for(let e of zt)e();let{clicksContext:n,currentSlideNo:r,hasPrimarySlide:i,isNotesViewer:a,isPresenter:s,isPrintMode:c}=ue();Mt({title:E,htmlAttrs:M.htmlAttrs}),Gt(),Mr(`${E} - shared`),Tr(`${E} - drawings`);let u=`${location.origin}_${xr()}`,d=p(()=>s.value?`presenter`:`viewer`);function m(){(s.value?k.value.presenterSend:k.value.viewerSend)&&(a.value||c.value||!s.value&&!Le.includes(location.host.split(`:`)[0])||(Fr(`page`,+r.value),Fr(`clicks`,n.value.current),Fr(`clicksTotal`,n.value.total),Fr(`lastUpdate`,{id:u,type:d.value,time:Date.now()})))}let h=ve();h.afterEach(m),l(n,m),Nr(e=>{(s.value?k.value.presenterReceive:k.value.viewerReceive)&&(!i.value||c.value||e.lastUpdate?.type!==d.value&&(+e.page!=+r.value||+n.value.current!=+e.clicks)&&(A.value=!1,h.replace({path:te(e.page,s.value),query:{...h.currentRoute.value.query,clicks:e.clicks||0}})))})}var Rr=C({__name:`App`,setup(e){return Lr(),c(()=>{for(let[e,t]of Object.entries(O.value))document.body.style.setProperty(e,t.toString())}),(e,t)=>{let n=s(`RouterView`);return T(),d(v,null,[a(n),w(`v-if`,!0)],64)}}});function zr(e,t,n){let r=e.push,i=e;return i.ssr=!1,i.hooks=t,i.dirty=!!i.dirty,i.use=e=>Pt(i,e),i.render=()=>n(i),i.invalidate=()=>{for(let e of i.entries.values())delete e._tags;i.dirty=!0,t.callHook(`entries:updated`,i)},i.push=(n,a)=>{let o=a?.onRendered?t.hook(`dom:rendered`,a.onRendered):void 0,s=r(n,a),c=e.entries.get(s._i);return c&&(c._o=n),i.dirty=!0,t.callHook(`entries:updated`,i),{_i:s._i,patch(e){s.patch(e),i.dirty=!0,t.callHook(`entries:updated`,i)},dispose(){o?.(),e.entries.has(s._i)&&(s.dispose(),i.invalidate())}}},t.hook(`entries:updated`,()=>{i.render()}),i}var Br=/\s+/;function Vr(e={}){return t=>Wr(t,e)}function Hr(e){for(let t of e.entries.values())if(t._pending!==void 0)return!0;return!1}function Ur(e,t){let n={_d:t,_t:t.title,_e:new Map([[`htmlAttrs`,t.documentElement],[`bodyAttrs`,t.body]]),_p:{},_s:{},_l:new Map};for(let e of[...t.body.children,...t.head.children]){let t=e.tagName.toLowerCase();if(!Ue.has(t))continue;let r={innerHTML:e.innerHTML};for(let t of e.getAttributeNames())r[t]=e.getAttribute(t);let i=ut({tag:t,props:{}},r);i.key=e.getAttribute(`data-hid`)||void 0;let a=at(i)||ot(i),o=a,s=1;for(;n._e.has(o);)o=`${a}:${s++}`;n._e.set(o,e)}for(let t of e.entries.values())if(t._o!==void 0){let e=t._o;for(let t of[`bodyAttrs`,`htmlAttrs`]){let r=e[t]?.class;if(typeof r==`string`){let e=n._e.get(t);for(let i of r.split(Br))i&&(n._p[`${t}:attr:class:${i}`]=()=>e.classList.remove(i))}}}return n}function Wr(e,t={}){let n=t.document||e.resolvedOptions.document,r=e._dom,i=!!r&&r._d!==n;if(!n||r&&!i&&!e.dirty&&!Hr(e)||e._du)return!1;let a=n.defaultView;e._du=!0;let o=!1;try{let i=function(e,t,n){d._s[e]=!n&&f[e]||t,delete f[e]},s=function(e,t,n,r,a,o){let s=`${e}:event:${t}`,c=d._l.get(s);if(c&&c[0]===o&&c[1]===n&&c[2]===r){i(s,c[4]);return}c?.[4]();let l=`data-${t}`,u=(e=>r.call(a,e)),f=()=>{o.removeEventListener(n,u),a.getAttribute(l)===``&&a.removeAttribute(l),d._l.get(s)?.[3]===u&&d._l.delete(s)};o.addEventListener(n,u),d._l.set(s,[o,n,r,u,f]),a.setAttribute(l,``),i(s,f,!0)},c=function({id:e,$el:t,tag:n}){let r=n.tag.endsWith(`Attrs`);if(d._e.set(e,t),!r){let r=n.textContent;r!=null&&r!==``&&(r!==t.textContent&&(t.textContent=r),i(`${e}:text`,()=>{t.textContent===r&&(t.textContent=``)},!0));let a=n.innerHTML;a!=null&&a!==``&&(a!==t.innerHTML&&(t.innerHTML=a),i(`${e}:html`,()=>{t.innerHTML===a&&(t.innerHTML=``)},!0));let o=`${e}:el`;i(o,f[o]||(()=>{t?.remove(),d._e.delete(e)}))}for(let r in n.props){let o=n.props[r];if(r[0]===`o`&&r[1]===`n`&&typeof o==`function`){let i=r.slice(2);t?.dataset?.[`${r}fired`]&&o.call(t,new((a?.Event)||Event)(i)),s(e,r,i,o,t,n.tag===`bodyAttrs`&&a?a:t);continue}let c=`${e}:attr:${r}`;if(r===`class`&&o)for(let e of o){let n=`${c}:${e}`;i(n,f[n]||(()=>t.classList.remove(e))),t.classList.contains(e)||t.classList.add(e)}else if(r===`style`&&o)for(let[e,n]of o){let r=`${c}:${e}`;i(r,f[r]||(()=>t.style.removeProperty(e))),t.style.setProperty(e,n)}else o!==!1&&o!==null&&(t.getAttribute(r)!==o&&t.setAttribute(r,o===!0?``:String(o)),i(c,f[c]||(()=>t.removeAttribute(r))))}},l={shouldRender:!0,tags:[]};if(tt(e,`dom:beforeRender`,l),!l.shouldRender)return!1;let u=r;if(u?._d!==n){if(u){for(let e in u._s)u._s[e]();for(let e in u._p)u._p[e]();u._s=u._p={},u._e.clear(),u._l.clear()}u=void 0}u?u._p=u._s:u=Ur(e,n),u._s={};let d=u,f=d._p,p=[],m={};e.dirty=!1;let h=Dt(e,t.tagWeight?{tagWeight:t.tagWeight}:void 0),g=[],_={};for(let e of h){let t=_[e._d]||0,r=(t?`${e._d}:${t}`:e._d)||e._h,a={tag:e,id:r,shouldRender:!0};if(e.tag===`meta`&&e._d&&it(e._d)&&(_[e._d]=t+1),g.push(a),e.tag===`title`){n.title=e.textContent,i(`title:`,()=>n.title=d._t);continue}a.$el=d._e.get(r),a.$el?c(a):Ue.has(e.tag)&&p.push(a)}for(let e of p)e.$el=n.createElement(e.tag.tag),c(e),(m[e.tag.tagPosition||`head`]??=n.createDocumentFragment()).appendChild(e.$el);m.head&&n.head.appendChild(m.head),m.bodyOpen&&n.body.insertBefore(m.bodyOpen,n.body.firstChild),m.bodyClose&&n.body.appendChild(m.bodyClose);for(let e in f)f[e]();e._dom=d,o=!0,tt(e,`dom:rendered`,{renders:g})}catch(t){throw e.dirty=!0,t}finally{e._du=!1}return o&&(e.dirty||Hr(e))&&Wr(e,t),o}var Gr=e=>typeof e.tagPriority==`number`?e.tagPriority:100+(Ye[e.tagPriority]||0);function Kr(e={}){e.document=e.document||(typeof window<`u`?document:void 0);let t=e.render||Vr({document:e.document}),n=zr(Ft(t,{document:e.document,propResolvers:e.propResolvers,_tagWeight:Gr,init:[]}),et(e.hooks),t);return e.plugins?.forEach(e=>n.use(e)),e.init?.forEach(e=>e&&n.push(e)),n}function qr(e={}){let t=Vr(),n,r=0;return n=Kr({render:()=>{let e=++r;setTimeout(()=>{e===r&&t(n)},0)},...e}),n.install=At(n),n}var Jr=Object.assign({}),Yr=Object.assign({}),Xr=Object.assign({}),Zr=[Object.values(Jr)[0],Object.values(Yr)[0],Object.values(Xr)[0]].filter(Boolean);function Qr(e,t=``){let n=[`slidev-page`,t],r=e?.meta?.slide?.no;return r!=null&&n.push(`slidev-page-${r}`),n.filter(Boolean).join(` `)}async function $r(){let{saveAs:t}=await j(async()=>{let{saveAs:t}=await import(`./modules/file-saver-BpWusTEB.js`).then(t=>e(t.t(),1));return{saveAs:t}},__vite__mapDeps([0,1]),import.meta.url);t(typeof M.download==`string`?M.download:M.exportFilename?`${M.exportFilename}.pdf`:`./slidev-exported.pdf`,`${M.title}.pdf`)}function ei(e,t,n){return(e.instance?.$).provides[t]??n}var ti=/[\s,]+/;function ni(e,t){let n=t.map(e=>`${Fe}${e}`);e.classList.forEach(t=>{t.startsWith(`slidev-vclick-anim-`)&&!n.includes(t)&&e.classList.remove(t)}),n.forEach(t=>e.classList.add(t))}function ri(){return{install(e){e.directive(`click`,{name:`v-click`,mounted(e,t){let n=ai(e,t,t.value);n!=null&&(e.classList.toggle(De,!0),e.dataset.slidevClicksStart=String(n.start),Number.isFinite(n.end)&&(e.dataset.slidevClicksEnd=String(n.end)),e.watchStopHandle=c(()=>{let t=n.isActive.value,r=n.isCurrent.value,i=t&&!r;n.flagHide?(e.classList.toggle(Ee,t),e.classList.toggle(Ne,t)):e.classList.toggle(Ee,!t),ni(e,n.flagAnimations.value),e.classList.toggle(je,r),e.classList.toggle(Ie,i)}))},unmounted:oi}),e.directive(`after`,{name:`v-after`,mounted(e,t){let n=ai(e,t,`+0`);n!=null&&(e.classList.toggle(De,!0),e.watchStopHandle=c(()=>{let t=n.isActive.value,r=n.isCurrent.value,i=t&&!r;n.flagHide?(e.classList.toggle(Ee,t),e.classList.toggle(Ne,t)):e.classList.toggle(Ee,!t),ni(e,n.flagAnimations.value),e.classList.toggle(je,r),e.classList.toggle(Ie,i)}))},unmounted:oi}),e.directive(`click-hide`,{name:`v-click-hide`,mounted(e,t){let n=ai(e,t,t.value,!0);n!=null&&(e.classList.toggle(De,!0),e.watchStopHandle=c(()=>{let t=n.isActive.value,r=n.isCurrent.value,i=t&&!r;e.classList.toggle(Ee,t),e.classList.toggle(Ne,t),ni(e,n.flagAnimations.value),e.classList.toggle(je,r),e.classList.toggle(Ie,i)}))},unmounted:oi})}}}var ii=new Map;function ai(e,t,n,r=!1){let i=ei(t,Oe)?.value,a=ei(t,Pe);if(!e||!i)return null;let o=r||t.modifiers.hide!==!1&&t.modifiers.hide!=null,s=Object.keys({...t.modifiers}).filter(e=>e!==`hide`),c=p(()=>{if(s.length>0)return s;let e=a?.clickAnimation||M.clickAnimation;return e?e.split(ti).filter(Boolean):[]}),l=i.calculate(n);if(!l)return null;i.register(e,l);let u=p(()=>o?!l.isActive.value:l.isActive.value),d=p(()=>u.value?`shown`:Number.isFinite(l.end)?i.current<l.start?`before`:`after`:o?`after`:`before`),f={...l,isShown:u,visibilityState:d,flagHide:o,flagAnimations:c};return ii.set(e,f),f}function oi(e,t){e.classList.toggle(De,!1),(ei(t,Oe)?.value)?.unregister(e),e.watchStopHandle?.()}function si(e=g(Ae,_())){let t=ye(e),n=l([de,se,ce,oe,ee,ie.width,ie.height],()=>{setTimeout(t.update,300)},{flush:`post`,immediate:!0});return{...t,stop:n}}function ci(e){return{info:_(fe(e)?.meta.slide??null),update:async()=>{}}}var li={};function ui(e){function t(e){return li[e]??=ci(e)}return{info:p({get(){return t(u(e)).info.value},set(n){t(u(e)).info.value=n}}),update:async(n,r)=>{let i=t(r??u(e)),a=await i.update(n);return a&&(i.info.value=a),a}}}function di(e){return()=>{}}function fi(e,t,n,r=!1){function i(t){return e?ei(e,t):pe(t)}let a=i(Me),o=i(`$$slidev-fontmatter`)??{},s=i(ke),c=p(()=>di(s.value)),u=i(`$$slidev-slide-scale`)??_(1),d=i(`$$slidev-slide-zoom`)??_(1),{left:f,top:m,stop:h}=si(i(`$$slidev-slide-element`)??_()),{isPrintMode:g}=ue(),v=[`slide`,`presenter`].includes(a.value)&&!g.value,y=e?`directive`:`prop`,b=xr(),x;if(Array.isArray(t)?x=t:typeof t==`string`&&t.includes(`,`)?x=t.split(`,`).map(Number):t!=null&&(y=`frontmatter`,b=`${t}`,t=o?.dragPos?.[b],x=t?.split(`,`).map(Number)),y!==`frontmatter`&&!n)throw Error("[Slidev] Can not identify the source position of the v-drag element, please provide an explicit `id` prop.");let S=[h],C=!r&&t!=null&&!Number.isFinite(x?.[3]);x??=[NaN,NaN,0];let w=_(x[2]),T=_(x[0]+x[2]/2),E=_(r?0:x[4]??0),ee=p(()=>E.value*Math.PI/180),te=p(()=>Math.sin(ee.value)),ne=p(()=>Math.cos(ee.value)),re=_(),D=_({left:0,top:0,width:0,height:0}),ie=_(0);function ae(){if(!re.value)return;let e=re.value.getBoundingClientRect();D.value={left:e.left/d.value,top:e.top/d.value,width:e.width/d.value,height:e.height/d.value},ie.value=(D.value.width+D.value.height)/u.value/(Math.abs(te.value)+Math.abs(ne.value))-w.value}S.push(l(w,ae,{flush:`post`}));let oe=_(x[3]??0),O=C?p({get:()=>(C?ie.value:oe.value)||0,set:e=>!C&&(oe.value=e)}):oe,se=_(C?x[1]:x[1]+x[3]/2),k=C?p({get:()=>se.value+O.value/2,set:e=>se.value=e-O.value/2}):se,ce=p(()=>Number.isFinite(T.value)?{position:`absolute`,zIndex:100,left:`${T.value-w.value/2}px`,top:`${k.value-O.value/2}px`,width:`${w.value}px`,height:C?void 0:`${O.value}px`,transformOrigin:`center center`,transform:`rotate(${E.value}deg)`}:{position:`absolute`,zIndex:100});S.push(l([T,k,w,O,E],([e,t,r,i,a])=>{let o=[e-r/2,t-i/2,r].map(Math.round).join();o+=C?y===`directive`?`,NaN`:`,_`:`,${Math.round(i)}`,Math.round(a)!==0&&(o+=`,${Math.round(a)}`),y===`directive`&&(o=`[${o}]`),c.value(b,o,y,n)}));let A={dragId:b,dataSource:y,markdownSource:n,isArrow:r,zoom:d,autoHeight:C,x0:T,y0:k,width:w,height:O,rotate:E,container:re,containerStyle:ce,watchStopHandles:S,dragging:p(()=>le.value===A),mounted(){v&&(ae(),t||setTimeout(()=>{ae(),T.value=(D.value.left+D.value.width/2-f.value)/u.value,k.value=(D.value.top-m.value)/u.value,w.value=D.value.width/u.value,O.value=D.value.height/u.value},100))},unmounted(){v&&A.stopDragging()},startDragging(){v&&(ae(),le.value=A)},stopDragging(){v&&le.value===A&&(le.value=null)}};return S.push(Ce(re,e=>{let t=document.querySelector(`#drag-control-container`);t&&e.target&&t.contains(e.target)||A.stopDragging()}),l(_e(),e=>{e||A.stopDragging()})),A}function pi(){return{install(e){e.directive(`drag`,{name:`v-drag`,created(e,t,n){let r=fi(t,t.value,n.props?.markdownSource);n.props&&(n.props={...n.props},delete n.props.markdownSource),r.container.value=e,e.draggingState=r,e.dataset.dragId=r.dragId,r.watchStopHandles.push(l(r.containerStyle,t=>{for(let[n,r]of Object.entries(t))r&&(e.style[n]=r)},{immediate:!0})),e.addEventListener(`dblclick`,r.startDragging)},mounted(e){e.draggingState.mounted()},unmounted(e){let t=e.draggingState;t.unmounted(),e.removeEventListener(`dblclick`,t.startDragging),t.watchStopHandles.forEach(e=>e())}})}}}function mi(){return Math.floor(Math.random()*2**31)}var hi=class{constructor(e){this.seed=e}next(){return this.seed?(2**31-1&(this.seed=Math.imul(48271,this.seed)))/2**31:Math.random()}};function gi(e,t,n){if(e&&e.length){let[r,i]=t,a=Math.PI/180*n,o=Math.cos(a),s=Math.sin(a);for(let t of e){let[e,n]=t;t[0]=(e-r)*o-(n-i)*s+r,t[1]=(e-r)*s+(n-i)*o+i}}}function _i(e,t,n){let r=[];e.forEach(e=>r.push(...e)),gi(r,t,n)}function vi(e,t){return e[0]===t[0]&&e[1]===t[1]}function yi(e,t,n,r=1){let i=n,a=Math.max(t,.1),o=e[0]&&e[0][0]&&typeof e[0][0]==`number`?[e]:e,s=[0,0];if(i)for(let e of o)gi(e,s,i);let c=bi(o,a,r);if(i){for(let e of o)gi(e,s,-i);_i(c,s,-i)}return c}function bi(e,t,n){let r=[];for(let t of e){let e=[...t];vi(e[0],e[e.length-1])||e.push([e[0][0],e[0][1]]),e.length>2&&r.push(e)}let i=[];t=Math.max(t,.1);let a=[];for(let e of r)for(let t=0;t<e.length-1;t++){let n=e[t],r=e[t+1];if(n[1]!==r[1]){let e=Math.min(n[1],r[1]);a.push({ymin:e,ymax:Math.max(n[1],r[1]),x:e===n[1]?n[0]:r[0],islope:(r[0]-n[0])/(r[1]-n[1])})}}if(a.sort((e,t)=>e.ymin<t.ymin?-1:e.ymin>t.ymin?1:e.x<t.x?-1:e.x>t.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!a.length)return i;let o=[],s=a[0].ymin,c=0;for(;o.length||a.length;){if(a.length){let e=-1;for(let t=0;t<a.length&&!(a[t].ymin>s);t++)e=t;a.splice(0,e+1).forEach(e=>{o.push({s,edge:e})})}if(o=o.filter(e=>!(e.edge.ymax<=s)),o.sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),(n!==1||c%t===0)&&o.length>1)for(let e=0;e<o.length;e+=2){let t=e+1;if(t>=o.length)break;let n=o[e].edge,r=o[t].edge;i.push([[Math.round(n.x),s],[Math.round(r.x),s]])}s+=n,o.forEach(e=>{e.edge.x=e.edge.x+n*e.edge.islope}),c++}return i}function xi(e,t){let n=t.hachureAngle+90,r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.round(Math.max(r,.1));let i=1;return t.roughness>=1&&(t.randomizer?.next()||Math.random())>.7&&(i=r),yi(e,r,n,i||1)}var Si=class{constructor(e){this.helper=e}fillPolygons(e,t){return this._fillPolygons(e,t)}_fillPolygons(e,t){let n=xi(e,t);return{type:`fillSketch`,ops:this.renderLines(n,t)}}renderLines(e,t){let n=[];for(let r of e)n.push(...this.helper.doubleLineOps(r[0][0],r[0][1],r[1][0],r[1][1],t));return n}};function Ci(e){let t=e[0],n=e[1];return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}var wi=class extends Si{fillPolygons(e,t){let n=t.hachureGap;n<0&&(n=t.strokeWidth*4),n=Math.max(n,.1);let r=xi(e,Object.assign({},t,{hachureGap:n})),i=Math.PI/180*t.hachureAngle,a=[],o=n*.5*Math.cos(i),s=n*.5*Math.sin(i);for(let[e,t]of r)Ci([e,t])&&a.push([[e[0]-o,e[1]+s],[...t]],[[e[0]+o,e[1]-s],[...t]]);return{type:`fillSketch`,ops:this.renderLines(a,t)}}},Ti=class extends Si{fillPolygons(e,t){let n=this._fillPolygons(e,t),r=Object.assign({},t,{hachureAngle:t.hachureAngle+90}),i=this._fillPolygons(e,r);return n.ops=n.ops.concat(i.ops),n}},Ei=class{constructor(e){this.helper=e}fillPolygons(e,t){t=Object.assign({},t,{hachureAngle:0});let n=xi(e,t);return this.dotsOnLines(n,t)}dotsOnLines(e,t){let n=[],r=t.hachureGap;r<0&&(r=t.strokeWidth*4),r=Math.max(r,.1);let i=t.fillWeight;i<0&&(i=t.strokeWidth/2);let a=r/4;for(let o of e){let e=Ci(o),s=e/r,c=Math.ceil(s)-1,l=e-c*r,u=(o[0][0]+o[1][0])/2-r/4,d=Math.min(o[0][1],o[1][1]);for(let e=0;e<c;e++){let o=d+l+e*r,s=u-a+Math.random()*2*a,c=o-a+Math.random()*2*a,f=this.helper.ellipse(s,c,i,i,t);n.push(...f.ops)}}return{type:`fillSketch`,ops:n}}},Di=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=xi(e,t);return{type:`fillSketch`,ops:this.dashedLine(n,t)}}dashedLine(e,t){let n=t.dashOffset<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashOffset,r=t.dashGap<0?t.hachureGap<0?t.strokeWidth*4:t.hachureGap:t.dashGap,i=[];return e.forEach(e=>{let a=Ci(e),o=Math.floor(a/(n+r)),s=(a+r-o*(n+r))/2,c=e[0],l=e[1];c[0]>l[0]&&(c=e[1],l=e[0]);let u=Math.atan((l[1]-c[1])/(l[0]-c[0]));for(let e=0;e<o;e++){let a=e*(n+r),o=a+n,l=[c[0]+a*Math.cos(u)+s*Math.cos(u),c[1]+a*Math.sin(u)+s*Math.sin(u)],d=[c[0]+o*Math.cos(u)+s*Math.cos(u),c[1]+o*Math.sin(u)+s*Math.sin(u)];i.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],t))}}),i}},Oi=class{constructor(e){this.helper=e}fillPolygons(e,t){let n=t.hachureGap<0?t.strokeWidth*4:t.hachureGap,r=t.zigzagOffset<0?n:t.zigzagOffset;t=Object.assign({},t,{hachureGap:n+r});let i=xi(e,t);return{type:`fillSketch`,ops:this.zigzagLines(i,r,t)}}zigzagLines(e,t,n){let r=[];return e.forEach(e=>{let i=Ci(e),a=Math.round(i/(2*t)),o=e[0],s=e[1];o[0]>s[0]&&(o=e[1],s=e[0]);let c=Math.atan((s[1]-o[1])/(s[0]-o[0]));for(let e=0;e<a;e++){let i=e*2*t,a=(e+1)*2*t,s=Math.sqrt(2*t**2),l=[o[0]+i*Math.cos(c),o[1]+i*Math.sin(c)],u=[o[0]+a*Math.cos(c),o[1]+a*Math.sin(c)],d=[l[0]+s*Math.cos(c+Math.PI/4),l[1]+s*Math.sin(c+Math.PI/4)];r.push(...this.helper.doubleLineOps(l[0],l[1],d[0],d[1],n),...this.helper.doubleLineOps(d[0],d[1],u[0],u[1],n))}}),r}},q={};function ki(e,t){let n=e.fillStyle||`hachure`;if(!q[n])switch(n){case`zigzag`:q[n]||(q[n]=new wi(t));break;case`cross-hatch`:q[n]||(q[n]=new Ti(t));break;case`dots`:q[n]||(q[n]=new Ei(t));break;case`dashed`:q[n]||(q[n]=new Di(t));break;case`zigzag-line`:q[n]||(q[n]=new Oi(t));break;default:n=`hachure`,q[n]||(q[n]=new Si(t))}return q[n]}var Ai=0,ji=1,Mi=2,Ni={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function Pi(e){let t=[];for(;e!==``;)if(e.match(/^([ \t\r\n,]+)/))e=e.substr(RegExp.$1.length);else if(e.match(/^([aAcChHlLmMqQsStTvVzZ])/))t[t.length]={type:Ai,text:RegExp.$1},e=e.substr(RegExp.$1.length);else if(e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/))t[t.length]={type:ji,text:`${parseFloat(RegExp.$1)}`},e=e.substr(RegExp.$1.length);else return[];return t[t.length]={type:Mi,text:``},t}function Fi(e,t){return e.type===t}function Ii(e){let t=[],n=Pi(e),r=`BOD`,i=0,a=n[i];for(;!Fi(a,Mi);){let o=0,s=[];if(r===`BOD`){if(a.text===`M`||a.text===`m`)i++,o=Ni[a.text],r=a.text;else return Ii(`M0,0`+e)}else Fi(a,ji)?o=Ni[r]:(i++,o=Ni[a.text],r=a.text);if(i+o<n.length){for(let e=i;e<i+o;e++){let t=n[e];if(Fi(t,ji))s[s.length]=+t.text;else throw Error(`Param not a number: `+r+`,`+t.text)}if(typeof Ni[r]==`number`){let e={key:r,data:s};t.push(e),i+=o,a=n[i],r===`M`&&(r=`L`),r===`m`&&(r=`l`)}else throw Error(`Bad segment: `+r)}else throw Error(`Path data ended short`)}return t}function Li(e){let t=0,n=0,r=0,i=0,a=[];for(let{key:o,data:s}of e)switch(o){case`M`:a.push({key:`M`,data:[...s]}),[t,n]=s,[r,i]=s;break;case`m`:t+=s[0],n+=s[1],a.push({key:`M`,data:[t,n]}),r=t,i=n;break;case`L`:a.push({key:`L`,data:[...s]}),[t,n]=s;break;case`l`:t+=s[0],n+=s[1],a.push({key:`L`,data:[t,n]});break;case`C`:a.push({key:`C`,data:[...s]}),t=s[4],n=s[5];break;case`c`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`C`,data:e}),t=e[4],n=e[5];break}case`Q`:a.push({key:`Q`,data:[...s]}),t=s[2],n=s[3];break;case`q`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`Q`,data:e}),t=e[2],n=e[3];break}case`A`:a.push({key:`A`,data:[...s]}),t=s[5],n=s[6];break;case`a`:t+=s[5],n+=s[6],a.push({key:`A`,data:[s[0],s[1],s[2],s[3],s[4],t,n]});break;case`H`:a.push({key:`H`,data:[...s]}),t=s[0];break;case`h`:t+=s[0],a.push({key:`H`,data:[t]});break;case`V`:a.push({key:`V`,data:[...s]}),n=s[0];break;case`v`:n+=s[0],a.push({key:`V`,data:[n]});break;case`S`:a.push({key:`S`,data:[...s]}),t=s[2],n=s[3];break;case`s`:{let e=s.map((e,r)=>r%2?e+n:e+t);a.push({key:`S`,data:e}),t=e[2],n=e[3];break}case`T`:a.push({key:`T`,data:[...s]}),t=s[0],n=s[1];break;case`t`:t+=s[0],n+=s[1],a.push({key:`T`,data:[t,n]});break;case`Z`:case`z`:a.push({key:`Z`,data:[]}),t=r,n=i}return a}function Ri(e){let t=[],n=``,r=0,i=0,a=0,o=0,s=0,c=0;for(let{key:l,data:u}of e){switch(l){case`M`:t.push({key:`M`,data:[...u]}),[r,i]=u,[a,o]=u;break;case`C`:t.push({key:`C`,data:[...u]}),r=u[4],i=u[5],s=u[2],c=u[3];break;case`L`:t.push({key:`L`,data:[...u]}),[r,i]=u;break;case`H`:r=u[0],t.push({key:`L`,data:[r,i]});break;case`V`:i=u[0],t.push({key:`L`,data:[r,i]});break;case`S`:{let e=0,a=0;n===`C`||n===`S`?(e=r+(r-s),a=i+(i-c)):(e=r,a=i),t.push({key:`C`,data:[e,a,...u]}),s=u[0],c=u[1],r=u[2],i=u[3];break}case`T`:{let[e,a]=u,o=0,l=0;n===`Q`||n===`T`?(o=r+(r-s),l=i+(i-c)):(o=r,l=i);let d=r+2*(o-r)/3,f=i+2*(l-i)/3,p=e+2*(o-e)/3,m=a+2*(l-a)/3;t.push({key:`C`,data:[d,f,p,m,e,a]}),s=o,c=l,r=e,i=a;break}case`Q`:{let[e,n,a,o]=u,l=r+2*(e-r)/3,d=i+2*(n-i)/3,f=a+2*(e-a)/3,p=o+2*(n-o)/3;t.push({key:`C`,data:[l,d,f,p,a,o]}),s=e,c=n,r=a,i=o;break}case`A`:{let e=Math.abs(u[0]),n=Math.abs(u[1]),a=u[2],o=u[3],s=u[4],c=u[5],l=u[6];e===0||n===0?(t.push({key:`C`,data:[r,i,c,l,c,l]}),r=c,i=l):(r!==c||i!==l)&&(Vi(r,i,c,l,e,n,a,o,s).forEach(function(e){t.push({key:`C`,data:e})}),r=c,i=l);break}case`Z`:t.push({key:`Z`,data:[]}),r=a,i=o}n=l}return t}function zi(e){return Math.PI*e/180}function Bi(e,t,n){return[e*Math.cos(n)-t*Math.sin(n),e*Math.sin(n)+t*Math.cos(n)]}function Vi(e,t,n,r,i,a,o,s,c,l){let u=zi(o),d=[],f=0,p=0,m=0,h=0;if(l)[f,p,m,h]=l;else{[e,t]=Bi(e,t,-u),[n,r]=Bi(n,r,-u);let o=(e-n)/2,l=(t-r)/2,d=o*o/(i*i)+l*l/(a*a);d>1&&(d=Math.sqrt(d),i=d*i,a=d*a);let g=s===c?-1:1,_=i*i,v=a*a,y=_*v-_*l*l-v*o*o,b=_*l*l+v*o*o,x=g*Math.sqrt(Math.abs(y/b));m=x*i*l/a+(e+n)/2,h=x*-a*o/i+(t+r)/2,f=Math.asin(parseFloat(((t-h)/a).toFixed(9))),p=Math.asin(parseFloat(((r-h)/a).toFixed(9))),e<m&&(f=Math.PI-f),n<m&&(p=Math.PI-p),f<0&&(f=Math.PI*2+f),p<0&&(p=Math.PI*2+p),c&&f>p&&(f-=Math.PI*2),!c&&p>f&&(p-=Math.PI*2)}let g=p-f;if(Math.abs(g)>Math.PI*120/180){let e=p,t=n,s=r;p=c&&p>f?f+Math.PI*120/180*1:f+Math.PI*120/180*-1,n=m+i*Math.cos(p),r=h+a*Math.sin(p),d=Vi(n,r,t,s,i,a,o,0,c,[p,e,m,h])}g=p-f;let _=Math.cos(f),v=Math.sin(f),y=Math.cos(p),b=Math.sin(p),x=Math.tan(g/4),S=4/3*i*x,C=4/3*a*x,w=[e,t],T=[e+S*v,t-C*_],E=[n+S*b,r-C*y],ee=[n,r];if(T[0]=2*w[0]-T[0],T[1]=2*w[1]-T[1],l)return[T,E,ee].concat(d);{d=[T,E,ee].concat(d);let e=[];for(let t=0;t<d.length;t+=3){let n=Bi(d[t][0],d[t][1],u),r=Bi(d[t+1][0],d[t+1][1],u),i=Bi(d[t+2][0],d[t+2][1],u);e.push([n[0],n[1],r[0],r[1],i[0],i[1]])}return e}}var Hi={randOffset:ta,randOffsetWithRange:na,ellipse:qi,doubleLineOps:ra};function J(e,t,n,r,i){return{type:`path`,ops:X(e,t,n,r,i)}}function Ui(e,t,n){let r=(e||[]).length;if(r>2){let i=[];for(let t=0;t<r-1;t++)i.push(...X(e[t][0],e[t][1],e[t+1][0],e[t+1][1],n));return t&&i.push(...X(e[r-1][0],e[r-1][1],e[0][0],e[0][1],n)),{type:`path`,ops:i}}return r===2?J(e[0][0],e[0][1],e[1][0],e[1][1],n):{type:`path`,ops:[]}}function Wi(e,t){return Ui(e,!0,t)}function Gi(e,t,n,r,i){return Wi([[e,t],[e+n,t],[e+n,t+r],[e,t+r]],i)}function Ki(e,t){if(e.length){let n=typeof e[0][0]==`number`?[e]:e,r=ca(n[0],1*(1+t.roughness*.2),t),i=t.disableMultiStroke?[]:ca(n[0],1.5*(1+t.roughness*.22),ia(t));for(let e=1;e<n.length;e++){let a=n[e];if(a.length){let e=ca(a,1*(1+t.roughness*.2),t),n=t.disableMultiStroke?[]:ca(a,1.5*(1+t.roughness*.22),ia(t));for(let t of e)t.op!==`move`&&r.push(t);for(let e of n)e.op!==`move`&&i.push(e)}}return{type:`path`,ops:r.concat(i)}}return{type:`path`,ops:[]}}function qi(e,t,n,r,i){return Yi(e,t,i,Ji(n,r,i)).opset}function Ji(e,t,n){let r=Math.sqrt(Math.PI*2*Math.sqrt(((e/2)**2+(t/2)**2)/2)),i=Math.ceil(Math.max(n.curveStepCount,n.curveStepCount/Math.sqrt(200)*r)),a=Math.PI*2/i,o=Math.abs(e/2),s=Math.abs(t/2),c=1-n.curveFitting;return o+=Y(o*c,n),s+=Y(s*c,n),{increment:a,rx:o,ry:s}}function Yi(e,t,n,r){let[i,a]=ua(r.increment,e,t,r.rx,r.ry,1,r.increment*oa(.1,oa(.4,1,n),n),n),o=la(i,null,n);if(!n.disableMultiStroke&&n.roughness!==0){let[i]=ua(r.increment,e,t,r.rx,r.ry,1.5,0,n),a=la(i,null,n);o=o.concat(a)}return{estimatedPoints:a,opset:{type:`path`,ops:o}}}function Xi(e,t,n,r,i,a,o,s,c){let l=e,u=t,d=Math.abs(n/2),f=Math.abs(r/2);d+=Y(d*.01,c),f+=Y(f*.01,c);let p=i,m=a;for(;p<0;)p+=Math.PI*2,m+=Math.PI*2;m-p>Math.PI*2&&(p=0,m=Math.PI*2);let h=Math.PI*2/c.curveStepCount,g=Math.min(h/2,(m-p)/2),_=da(g,l,u,d,f,p,m,1,c);if(!c.disableMultiStroke){let e=da(g,l,u,d,f,p,m,1.5,c);_.push(...e)}return o&&(s?_.push(...X(l,u,l+d*Math.cos(p),u+f*Math.sin(p),c),...X(l,u,l+d*Math.cos(m),u+f*Math.sin(m),c)):_.push({op:`lineTo`,data:[l,u]},{op:`lineTo`,data:[l+d*Math.cos(p),u+f*Math.sin(p)]})),{type:`path`,ops:_}}function Zi(e,t){let n=Ri(Li(Ii(e))),r=[],i=[0,0],a=[0,0];for(let{key:e,data:o}of n)switch(e){case`M`:a=[o[0],o[1]],i=[o[0],o[1]];break;case`L`:r.push(...X(a[0],a[1],o[0],o[1],t)),a=[o[0],o[1]];break;case`C`:{let[e,n,i,s,c,l]=o;r.push(...fa(e,n,i,s,c,l,a,t)),a=[c,l];break}case`Z`:r.push(...X(a[0],a[1],i[0],i[1],t)),a=[i[0],i[1]]}return{type:`path`,ops:r}}function Qi(e,t){let n=[];for(let r of e)if(r.length){let e=t.maxRandomnessOffset||0,i=r.length;if(i>2){n.push({op:`move`,data:[r[0][0]+Y(e,t),r[0][1]+Y(e,t)]});for(let a=1;a<i;a++)n.push({op:`lineTo`,data:[r[a][0]+Y(e,t),r[a][1]+Y(e,t)]})}}return{type:`fillPath`,ops:n}}function $i(e,t){return ki(t,Hi).fillPolygons(e,t)}function ea(e,t,n,r,i,a,o){let s=e,c=t,l=Math.abs(n/2),u=Math.abs(r/2);l+=Y(l*.01,o),u+=Y(u*.01,o);let d=i,f=a;for(;d<0;)d+=Math.PI*2,f+=Math.PI*2;f-d>Math.PI*2&&(d=0,f=Math.PI*2);let p=(f-d)/o.curveStepCount,m=[];for(let e=d;e<=f;e+=p)m.push([s+l*Math.cos(e),c+u*Math.sin(e)]);return m.push([s+l*Math.cos(f),c+u*Math.sin(f)]),m.push([s,c]),$i([m],o)}function ta(e,t){return Y(e,t)}function na(e,t,n){return oa(e,t,n)}function ra(e,t,n,r,i){return X(e,t,n,r,i,!0)}function ia(e){let t=Object.assign({},e);return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}function aa(e){return e.randomizer||=new hi(e.seed||0),e.randomizer.next()}function oa(e,t,n,r=1){return n.roughness*r*(aa(n)*(t-e)+e)}function Y(e,t,n=1){return oa(-e,e,t,n)}function X(e,t,n,r,i,a=!1){let o=a?i.disableMultiStrokeFill:i.disableMultiStroke,s=sa(e,t,n,r,i,!0,!1);if(o)return s;let c=sa(e,t,n,r,i,!0,!0);return s.concat(c)}function sa(e,t,n,r,i,a,o){let s=(e-n)**2+(t-r)**2,c=Math.sqrt(s),l=1;l=c<200?1:c>500?.4:-.0016668*c+1.233334;let u=i.maxRandomnessOffset||0;u*u*100>s&&(u=c/10);let d=u/2,f=.2+aa(i)*.2,p=i.bowing*i.maxRandomnessOffset*(r-t)/200,m=i.bowing*i.maxRandomnessOffset*(e-n)/200;p=Y(p,i,l),m=Y(m,i,l);let h=[],g=()=>Y(d,i,l),_=()=>Y(u,i,l),v=i.preserveVertices;return a&&(o?h.push({op:`move`,data:[e+(v?0:g()),t+(v?0:g())]}):h.push({op:`move`,data:[e+(v?0:Y(u,i,l)),t+(v?0:Y(u,i,l))]})),o?h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+g(),m+t+(r-t)*f+g(),p+e+2*(n-e)*f+g(),m+t+2*(r-t)*f+g(),n+(v?0:g()),r+(v?0:g())]}):h.push({op:`bcurveTo`,data:[p+e+(n-e)*f+_(),m+t+(r-t)*f+_(),p+e+2*(n-e)*f+_(),m+t+2*(r-t)*f+_(),n+(v?0:_()),r+(v?0:_())]}),h}function ca(e,t,n){if(!e.length)return[];let r=[];r.push([e[0][0]+Y(t,n),e[0][1]+Y(t,n)]),r.push([e[0][0]+Y(t,n),e[0][1]+Y(t,n)]);for(let i=1;i<e.length;i++)r.push([e[i][0]+Y(t,n),e[i][1]+Y(t,n)]),i===e.length-1&&r.push([e[i][0]+Y(t,n),e[i][1]+Y(t,n)]);return la(r,null,n)}function la(e,t,n){let r=e.length,i=[];if(r>3){let a=[],o=1-n.curveTightness;i.push({op:`move`,data:[e[1][0],e[1][1]]});for(let t=1;t+2<r;t++){let n=e[t];a[0]=[n[0],n[1]],a[1]=[n[0]+(o*e[t+1][0]-o*e[t-1][0])/6,n[1]+(o*e[t+1][1]-o*e[t-1][1])/6],a[2]=[e[t+1][0]+(o*e[t][0]-o*e[t+2][0])/6,e[t+1][1]+(o*e[t][1]-o*e[t+2][1])/6],a[3]=[e[t+1][0],e[t+1][1]],i.push({op:`bcurveTo`,data:[a[1][0],a[1][1],a[2][0],a[2][1],a[3][0],a[3][1]]})}if(t&&t.length===2){let e=n.maxRandomnessOffset;i.push({op:`lineTo`,data:[t[0]+Y(e,n),t[1]+Y(e,n)]})}}else r===3?(i.push({op:`move`,data:[e[1][0],e[1][1]]}),i.push({op:`bcurveTo`,data:[e[1][0],e[1][1],e[2][0],e[2][1],e[2][0],e[2][1]]})):r===2&&i.push(...sa(e[0][0],e[0][1],e[1][0],e[1][1],n,!0,!0));return i}function ua(e,t,n,r,i,a,o,s){let c=s.roughness===0,l=[],u=[];if(c){e/=4,u.push([t+r*Math.cos(-e),n+i*Math.sin(-e)]);for(let a=0;a<=Math.PI*2;a+=e){let e=[t+r*Math.cos(a),n+i*Math.sin(a)];l.push(e),u.push(e)}u.push([t+r*Math.cos(0),n+i*Math.sin(0)]),u.push([t+r*Math.cos(e),n+i*Math.sin(e)])}else{let c=Y(.5,s)-Math.PI/2;u.push([Y(a,s)+t+.9*r*Math.cos(c-e),Y(a,s)+n+.9*i*Math.sin(c-e)]);let d=Math.PI*2+c-.01;for(let o=c;o<d;o+=e){let e=[Y(a,s)+t+r*Math.cos(o),Y(a,s)+n+i*Math.sin(o)];l.push(e),u.push(e)}u.push([Y(a,s)+t+r*Math.cos(c+Math.PI*2+o*.5),Y(a,s)+n+i*Math.sin(c+Math.PI*2+o*.5)]),u.push([Y(a,s)+t+.98*r*Math.cos(c+o),Y(a,s)+n+.98*i*Math.sin(c+o)]),u.push([Y(a,s)+t+.9*r*Math.cos(c+o*.5),Y(a,s)+n+.9*i*Math.sin(c+o*.5)])}return[u,l]}function da(e,t,n,r,i,a,o,s,c){let l=a+Y(.1,c),u=[];u.push([Y(s,c)+t+.9*r*Math.cos(l-e),Y(s,c)+n+.9*i*Math.sin(l-e)]);for(let a=l;a<=o;a+=e)u.push([Y(s,c)+t+r*Math.cos(a),Y(s,c)+n+i*Math.sin(a)]);return u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),u.push([t+r*Math.cos(o),n+i*Math.sin(o)]),la(u,null,c)}function fa(e,t,n,r,i,a,o,s){let c=[],l=[s.maxRandomnessOffset||1,(s.maxRandomnessOffset||1)+.3],u=[0,0],d=s.disableMultiStroke?1:2,f=s.preserveVertices;for(let p=0;p<d;p++)p===0?c.push({op:`move`,data:[o[0],o[1]]}):c.push({op:`move`,data:[o[0]+(f?0:Y(l[0],s)),o[1]+(f?0:Y(l[0],s))]}),u=f?[i,a]:[i+Y(l[p],s),a+Y(l[p],s)],c.push({op:`bcurveTo`,data:[e+Y(l[p],s),t+Y(l[p],s),n+Y(l[p],s),r+Y(l[p],s),u[0],u[1]]});return c}function pa(e){return[...e]}function ma(e,t=0){let n=e.length;if(n<3)throw Error(`A curve must have at least three points.`);let r=[];if(n===3)r.push(pa(e[0]),pa(e[1]),pa(e[2]),pa(e[2]));else{let n=[];n.push(e[0],e[0]);for(let t=1;t<e.length;t++)n.push(e[t]),t===e.length-1&&n.push(e[t]);let i=[],a=1-t;r.push(pa(n[0]));for(let e=1;e+2<n.length;e++){let t=n[e];i[0]=[t[0],t[1]],i[1]=[t[0]+(a*n[e+1][0]-a*n[e-1][0])/6,t[1]+(a*n[e+1][1]-a*n[e-1][1])/6],i[2]=[n[e+1][0]+(a*n[e][0]-a*n[e+2][0])/6,n[e+1][1]+(a*n[e][1]-a*n[e+2][1])/6],i[3]=[n[e+1][0],n[e+1][1]],r.push(i[1],i[2],i[3])}}return r}function ha(e,t){return Math.sqrt(ga(e,t))}function ga(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function _a(e,t,n){let r=ga(t,n);if(r===0)return ga(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),ga(e,va(t,n,i))}function va(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function ya(e,t){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3],o=3*r[0]-2*n[0]-a[0];o*=o;let s=3*r[1]-2*n[1]-a[1];s*=s;let c=3*i[0]-2*a[0]-n[0];c*=c;let l=3*i[1]-2*a[1]-n[1];return l*=l,o<c&&(o=c),s<l&&(s=l),o+s}function ba(e,t,n,r){let i=r||[];if(ya(e,t)<n){let n=e[t+0];i.length?ha(i[i.length-1],n)>1&&i.push(n):i.push(n),i.push(e[t+3])}else{let r=.5,a=e[t+0],o=e[t+1],s=e[t+2],c=e[t+3],l=va(a,o,r),u=va(o,s,r),d=va(s,c,r),f=va(l,u,r),p=va(u,d,r),m=va(f,p,r);ba([a,l,f,m],0,n,i),ba([m,p,d,c],0,n,i)}return i}function xa(e,t){return Sa(e,0,e.length,t)}function Sa(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=_a(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(Sa(e,t,l+1,r,a),Sa(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Ca(e,t=.15,n){let r=[],i=(e.length-1)/3;for(let n=0;n<i;n++)ba(e,n*3,t,r);return n&&n>0?Sa(r,0,r.length,n):r}function wa(e,t,n){let r=Ri(Li(Ii(e))),i=[],a=[],o=[0,0],s=[],c=()=>{s.length>=4&&a.push(...Ca(s,t)),s=[]},l=()=>{c(),a.length&&(i.push(a),a=[])};for(let{key:e,data:t}of r)switch(e){case`M`:l(),o=[t[0],t[1]],a.push(o);break;case`L`:c(),a.push([t[0],t[1]]);break;case`C`:if(!s.length){let e=a.length?a[a.length-1]:o;s.push([e[0],e[1]])}s.push([t[0],t[1]]),s.push([t[2],t[3]]),s.push([t[4],t[5]]);break;case`Z`:c(),a.push([o[0],o[1]])}if(l(),!n)return i;let u=[];for(let e of i){let t=xa(e,n);t.length&&u.push(t)}return u}var Z=`none`,Ta=class{constructor(e){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:`#000`,strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=e||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return mi()}_o(e){return e?Object.assign({},this.defaultOptions,e):this.defaultOptions}_d(e,t,n){return{shape:e,sets:t||[],options:n||this.defaultOptions}}line(e,t,n,r,i){let a=this._o(i);return this._d(`line`,[J(e,t,n,r,a)],a)}rectangle(e,t,n,r,i){let a=this._o(i),o=[],s=Gi(e,t,n,r,a);if(a.fill){let i=[[e,t],[e+n,t],[e+n,t+r],[e,t+r]];a.fillStyle===`solid`?o.push(Qi([i],a)):o.push($i([i],a))}return a.stroke!==Z&&o.push(s),this._d(`rectangle`,o,a)}ellipse(e,t,n,r,i){let a=this._o(i),o=[],s=Ji(n,r,a),c=Yi(e,t,a,s);if(a.fill){if(a.fillStyle===`solid`){let n=Yi(e,t,a,s).opset;n.type=`fillPath`,o.push(n)}else o.push($i([c.estimatedPoints],a))}return a.stroke!==Z&&o.push(c.opset),this._d(`ellipse`,o,a)}circle(e,t,n,r){let i=this.ellipse(e,t,n,n,r);return i.shape=`circle`,i}linearPath(e,t){let n=this._o(t);return this._d(`linearPath`,[Ui(e,!1,n)],n)}arc(e,t,n,r,i,a,o=!1,s){let c=this._o(s),l=[],u=Xi(e,t,n,r,i,a,o,!0,c);if(o&&c.fill){if(c.fillStyle===`solid`){let o=Object.assign({},c);o.disableMultiStroke=!0;let s=Xi(e,t,n,r,i,a,!0,!1,o);s.type=`fillPath`,l.push(s)}else l.push(ea(e,t,n,r,i,a,c))}return c.stroke!==Z&&l.push(u),this._d(`arc`,l,c)}curve(e,t){let n=this._o(t),r=[],i=Ki(e,n);if(n.fill&&n.fill!==Z){if(n.fillStyle===`solid`){let t=Ki(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else{let t=[],i=e;if(i.length){let e=typeof i[0][0]==`number`?[i]:i;for(let r of e)r.length<3?t.push(...r):r.length===3?t.push(...Ca(ma([r[0],r[0],r[1],r[2]]),10,(1+n.roughness)/2)):t.push(...Ca(ma(r),10,(1+n.roughness)/2))}t.length&&r.push($i([t],n))}}return n.stroke!==Z&&r.push(i),this._d(`curve`,r,n)}polygon(e,t){let n=this._o(t),r=[],i=Ui(e,!0,n);return n.fill&&(n.fillStyle===`solid`?r.push(Qi([e],n)):r.push($i([e],n))),n.stroke!==Z&&r.push(i),this._d(`polygon`,r,n)}path(e,t){let n=this._o(t),r=[];if(!e)return this._d(`path`,r,n);e=(e||``).replace(/\n/g,` `).replace(/(-\s)/g,`-`).replace(`/(ss)/g`,` `);let i=n.fill&&n.fill!==`transparent`&&n.fill!==Z,a=n.stroke!==Z,o=!!(n.simplification&&n.simplification<1),s=o?4-4*(n.simplification||1):(1+n.roughness)/2,c=wa(e,1,s),l=Zi(e,n);if(i){if(n.fillStyle===`solid`){if(c.length===1){let t=Zi(e,Object.assign(Object.assign({},n),{disableMultiStroke:!0,roughness:n.roughness?n.roughness+n.fillShapeRoughnessGain:0}));r.push({type:`fillPath`,ops:this._mergedShape(t.ops)})}else r.push(Qi(c,n))}else r.push($i(c,n))}return a&&(o?c.forEach(e=>{r.push(Ui(e,!1,n))}):r.push(l)),this._d(`path`,r,n)}opsToPath(e,t){let n=``;for(let r of e.ops){let e=typeof t==`number`&&t>=0?r.data.map(e=>+e.toFixed(t)):r.data;switch(r.op){case`move`:n+=`M${e[0]} ${e[1]} `;break;case`bcurveTo`:n+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case`lineTo`:n+=`L${e[0]} ${e[1]} `}}return n.trim()}toPaths(e){let t=e.sets||[],n=e.options||this.defaultOptions,r=[];for(let e of t){let t=null;switch(e.type){case`path`:t={d:this.opsToPath(e),stroke:n.stroke,strokeWidth:n.strokeWidth,fill:Z};break;case`fillPath`:t={d:this.opsToPath(e),stroke:Z,strokeWidth:0,fill:n.fill||Z};break;case`fillSketch`:t=this.fillSketch(e,n)}t&&r.push(t)}return r}fillSketch(e,t){let n=t.fillWeight;return n<0&&(n=t.strokeWidth/2),{d:this.opsToPath(e),stroke:t.fill||Z,strokeWidth:n,fill:Z}}_mergedShape(e){return e.filter((e,t)=>t===0||e.op!==`move`)}},Ea=`http://www.w3.org/2000/svg`,Da=800,Oa=null;function ka(){return Oa||=new Ta().defaultOptions,Oa}function Aa(e,t,n){return{...ka(),maxRandomnessOffset:2,roughness:e===`highlight`?3:1.5,bowing:1,stroke:`#000`,strokeWidth:1.5,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:`hachure`,fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,disableMultiStroke:e!==`double`,disableMultiStrokeFill:!1,seed:t,...n}}function ja(e){let t=e.padding;if(t||t===0){if(typeof t==`number`)return[t,t,t,t];if(Array.isArray(t)){let e=t;if(e.length)switch(e.length){case 4:return[...e];case 1:return[e[0],e[0],e[0],e[0]];case 2:return[...e,...e];case 3:return[...e,e[1]];default:return[e[0],e[1],e[2],e[3]]}}}return[5,5,5,5]}function Ma(e,t,n,r,i,a){let o=[],s=n.strokeWidth||2,c=ja(n),l=n.animate===void 0||!!n.animate,u=n.iterations||2,d=+!!n.rtl,f=Aa(`single`,a,n);switch(n.type){case`underline`:{let e=t.y+t.h+c[2];for(let n=d;n<u+d;n++)n%2?o.push(J(t.x+t.w,e,t.x,e,f)):o.push(J(t.x,e,t.x+t.w,e,f));break}case`strike-through`:{let e=t.y+t.h/2;for(let n=d;n<u+d;n++)n%2?o.push(J(t.x+t.w,e,t.x,e,f)):o.push(J(t.x,e,t.x+t.w,e,f));break}case`box`:{let e=t.x-c[3],n=t.y-c[0],r=t.w+(c[1]+c[3]),i=t.h+(c[0]+c[2]);for(let t=0;t<u;t++)o.push(Gi(e,n,r,i,f));break}case`bracket`:{let e=Array.isArray(n.brackets)?n.brackets:n.brackets?[n.brackets]:[`right`],r=t.x-c[3]*2,i=t.x+t.w+c[1]*2,a=t.y-c[0]*2,s=t.y+t.h+c[2]*2;for(let n of e){let e;switch(n){case`bottom`:e=[[r,t.y+t.h],[r,s],[i,s],[i,t.y+t.h]];break;case`top`:e=[[r,t.y],[r,a],[i,a],[i,t.y]];break;case`left`:e=[[t.x,a],[r,a],[r,s],[t.x,s]];break;case`right`:e=[[t.x+t.w,a],[i,a],[i,s],[t.x+t.w,s]]}e&&o.push(Ui(e,!1,f))}break}case`crossed-off`:{let e=t.x,n=t.y,r=e+t.w,i=n+t.h;for(let t=d;t<u+d;t++)t%2?o.push(J(r,i,e,n,f)):o.push(J(e,n,r,i,f));for(let t=d;t<u+d;t++)t%2?o.push(J(e,i,r,n,f)):o.push(J(r,n,e,i,f));break}case`circle`:{let e=Aa(`double`,a,n),r=t.w+(c[1]+c[3]),i=t.h+(c[0]+c[2]),s=t.x-c[3]+r/2,l=t.y-c[0]+i/2,d=Math.floor(u/2),p=u-d*2;for(let t=0;t<d;t++)o.push(qi(s,l,r,i,e));for(let e=0;e<p;e++)o.push(qi(s,l,r,i,f));break}case`highlight`:{let e=Aa(`highlight`,a,n);s=t.h*.95;let r=t.y+t.h/2;for(let n=d;n<u+d;n++)n%2?o.push(J(t.x+t.w,r,t.x,r,e)):o.push(J(t.x,r,t.x+t.w,r,e));break}}if(o.length){let t=Pa(o),a=[],c=[],u=0,d=(e,t,n)=>e.setAttribute(t,n);for(let r of t){let t=document.createElementNS(Ea,`path`);if(d(t,`d`,r),d(t,`fill`,`none`),d(t,`stroke`,n.color||`currentColor`),d(t,`stroke-width`,`${s}`),n.opacity!==void 0&&d(t,`style`,`opacity:${n.opacity}`),l){let e=t.getTotalLength();a.push(e),u+=e}e.appendChild(t),c.push(t)}if(l){let e=0;for(let t=0;t<c.length;t++){let n=c[t],o=a[t],s=u?o/u*i:0,l=r+e,d=n.style;d.strokeDashoffset=`${o}`,d.strokeDasharray=`${o}`,d.animation=`rough-notation-dash ${s}ms ease-out ${l}ms forwards`,e+=s}return Na(i+r)}}return Na(0)}function Na(e){return new Promise(t=>setTimeout(t,e))}function Pa(e){let t=[];for(let n of e){let e=``;for(let r of n.ops){let n=r.data;switch(r.op){case`move`:e.trim()&&t.push(e.trim()),e=`M${n[0]} ${n[1]} `;break;case`bcurveTo`:e+=`C${n[0]} ${n[1]}, ${n[2]} ${n[3]}, ${n[4]} ${n[5]} `;break;case`lineTo`:e+=`L${n[0]} ${n[1]} `}}e.trim()&&t.push(e.trim())}return t}function Fa(){if(!window.__rno_kf_s){let e=window.__rno_kf_s=document.createElement(`style`);e.textContent=`@keyframes rough-notation-dash { to { stroke-dashoffset: 0; } }`,document.head.appendChild(e)}}var Ia=Object.defineProperty,La=(e,t,n)=>t in e?Ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>(La(e,typeof t==`symbol`?t:t+``,n),n),Ra=class{constructor(e,t){Q(this,`_state`,`unattached`),Q(this,`_config`),Q(this,`_resizing`,!1),Q(this,`_ro`),Q(this,`_seed`,mi()),Q(this,`_e`),Q(this,`_svg`),Q(this,`_lastSizes`,[]),Q(this,`_animationDelay`,0),Q(this,`_resizeListener`,()=>{this._resizing||(this._resizing=!0,setTimeout(()=>{this._resizing=!1,this._state===`showing`&&this.haveRectsChanged()&&this.show()},400))}),Q(this,`pendingRefresh`),this._e=e,this._config=JSON.parse(JSON.stringify(t)),this.attach()}getConfig(e){return this._config[e]}setConfig(e,t){this._config[e]!==t&&(this._config[e]=t,this.refresh())}get animate(){return this._config.animate}set animate(e){this._config.animate=e}get animationDuration(){return this._config.animationDuration}set animationDuration(e){this._config.animationDuration=e}get iterations(){return this._config.iterations}set iterations(e){this._config.iterations=e}get color(){return this._config.color}set color(e){this._config.color!==e&&(this._config.color=e,this.refresh())}get class(){return this._config.class}set class(e){this._config.class!==e&&(this._config.class=e,this._svg&&this._svg.setAttribute(`class`,[`rough-annotation`,this._config.class||``].filter(Boolean).join(` `)))}get strokeWidth(){return this._config.strokeWidth}set strokeWidth(e){this._config.strokeWidth!==e&&(this._config.strokeWidth=e,this.refresh())}get padding(){return this._config.padding}set padding(e){this._config.padding!==e&&(this._config.padding=e,this.refresh())}attach(){if(this._state===`unattached`&&this._e.parentElement){Fa();let e=this._svg=document.createElementNS(Ea,`svg`);e.setAttribute(`class`,[`rough-annotation`,this._config.class||``].filter(Boolean).join(` `));let t=e.style;t.position=`absolute`,t.top=`0`,t.left=`0`,t.overflow=`visible`,t.pointerEvents=`none`,t.width=`100px`,t.height=`100px`;let n=this._config.type===`highlight`;if(this._e.insertAdjacentElement(n?`beforebegin`:`afterend`,e),this._state=`not-showing`,n){let e=window.getComputedStyle(this._e).position;(!e||e===`static`)&&(this._e.style.position=`relative`)}this.attachListeners()}}detachListeners(){window.removeEventListener(`resize`,this._resizeListener),this._ro&&this._ro.unobserve(this._e)}attachListeners(){this.detachListeners(),window.addEventListener(`resize`,this._resizeListener,{passive:!0}),!this._ro&&`ResizeObserver`in window&&(this._ro=new window.ResizeObserver(e=>{for(let t of e)t.contentRect&&this._resizeListener()})),this._ro&&this._ro.observe(this._e)}haveRectsChanged(){if(this._lastSizes.length){let e=this.rects();if(e.length===this._lastSizes.length){for(let t=0;t<e.length;t++)if(!this.isSameRect(e[t],this._lastSizes[t]))return!0}else return!0}return!1}isSameRect(e,t){let n=(e,t)=>Math.round(e)===Math.round(t);return n(e.x,t.x)&&n(e.y,t.y)&&n(e.w,t.w)&&n(e.h,t.h)}isShowing(){return this._state!==`not-showing`}refresh(){this.isShowing()&&!this.pendingRefresh&&(this.pendingRefresh=Promise.resolve().then(()=>{this.isShowing()&&this.show(),delete this.pendingRefresh}))}async show(){switch(this._state){case`unattached`:break;case`showing`:this.hide(),this._svg&&await this.render(this._svg,!0);break;case`not-showing`:this.attach(),this._svg&&await this.render(this._svg,!1)}}hide(){if(this._svg)for(;this._svg.lastChild;)this._svg.removeChild(this._svg.lastChild);this._state=`not-showing`}remove(){this._svg&&this._svg.parentElement&&this._svg.parentElement.removeChild(this._svg),this._svg=void 0,this._state=`unattached`,this.detachListeners()}async render(e,t){let n=this._config;t&&(n=JSON.parse(JSON.stringify(this._config)),n.animate=!1);let r=this.rects(),i=0;r.forEach(e=>i+=e.w);let a=n.animationDuration||Da,o=0,s=[];for(let t=0;t<r.length;t++){let c=a*(r[t].w/i);s.push(Ma(e,r[t],n,o+this._animationDelay+(this._config.delay||0),c,this._seed)),o+=c}return this._lastSizes=r,this._state=`showing`,await Promise.all(s)}rects(){let e=[];if(this._svg){if(this._config.multiline){let t=this._e.getClientRects();for(let n=0;n<t.length;n++)e.push(this.svgRect(this._svg,t[n]))}else e.push(this.svgRect(this._svg,this._e.getBoundingClientRect()))}return e}svgRect(e,t){let n=e.getBoundingClientRect(),r=t;return{x:(r.x||r.left)-(n.x||n.left),y:(r.y||r.top)-(n.y||n.top),w:r.width,h:r.height}}};function za(e,t){return new Ra(e,t)}function $(e,t){return e.class=[e.class,t].filter(Boolean).join(` `),e}var Ba={box:e=>Object.assign(e,{type:`box`}),circle:e=>Object.assign(e,{type:`circle`}),underline:e=>Object.assign(e,{type:`underline`}),highlight:e=>Object.assign(e,{type:`highlight`}),"strike-through":e=>Object.assign(e,{type:`strike-through`}),"crossed-off":e=>Object.assign(e,{type:`crossed-off`}),bracket:e=>Object.assign(e,{type:`bracket`}),strike:e=>Object.assign(e,{type:`strike-through`}),cross:e=>Object.assign(e,{type:`crossed-off`}),crossed:e=>Object.assign(e,{type:`crossed-off`}),linethrough:e=>Object.assign(e,{type:`strike-through`}),"line-through":e=>Object.assign(e,{type:`strike-through`}),black:e=>$(e,`text-black`),blue:e=>$(e,`text-blue`),cyan:e=>$(e,`text-cyan`),gray:e=>$(e,`text-gray`),green:e=>$(e,`text-green`),indigo:e=>$(e,`text-indigo`),lime:e=>$(e,`text-lime`),orange:e=>$(e,`text-orange`),pink:e=>$(e,`text-pink`),purple:e=>$(e,`text-purple`),red:e=>$(e,`text-red`),teal:e=>$(e,`text-teal`),white:e=>$(e,`text-white`),yellow:e=>$(e,`text-yellow`)},Va=[[/^delay-?(\d+)?$/,(e,t,n)=>(t.delay=(e[1]?Number.parseInt(e[1]):n)||300,t)],[/^(?:op|opacity)-?(\d+)?$/,(e,t,n)=>(t.opacity=((e[1]?Number.parseInt(e[1]):n)||100)/100,t)]];function Ha(){return{install(e){e.directive(`mark`,{name:`v-mark`,mounted:(e,t)=>{let{isPrintMode:n}=ue(),r=p(()=>{let e=typeof t.value==`object`&&!Array.isArray(t.value)?{...t.value}:{at:t.value},r={at:e.at},i=Object.entries(t.modifiers).filter(([e,t])=>{if(Ba[e])return r=Ba[e](r,t),!1;for(let[n,i]of Va){let a=e.match(n);if(a)return r=i(a,r,t),!1}return!0});i.length&&console.warn(`[Slidev] Invalid modifiers for v-mark:`,i);let a={...r,...e};return a.type||=`underline`,n.value&&(a.animationDuration=1),a}),i=za(e,r.value),a=ai(e,t,r.value.at);if(!a){i.show();return}e.watchStopHandle=c(()=>{let e;r.value.class&&(i.class=r.value.class),r.value.color&&(i.color=r.value.color);let t=r.value.at;e=t===!0||t!==!1&&a.isActive.value,e!=null&&(e?i.show():i.hide())})},unmounted:e=>{e.watchStopHandle?.()}})}}}function Ua(){return{install(e){let t=xe();e.directive(`motion`,{name:`v-motion`,mounted(e,n,r,i){let a=ei(n,Oe),o=ei(n,ke),s=ei(n,Me),{currentPage:c,clicks:u,isPrintMode:d}=ue(),f=r.props={...r.props},p={...f.initial,...f.variants?.[`slidev-initial`]},m={...f.enter,...f.variants?.[`slidev-enter`]},h={...f.leave,...f.variants?.[`slidev-leave`]};delete f.initial,delete f.enter,delete f.leave;let g=`${xr()}-`,_=[];for(let e of Object.keys(f))if(e.startsWith(`click-`)){let t=e.slice(6),n=t.includes(`-`)?t.split(`-`).map(Number):+t,r=g+t;_.push({id:r,at:n,variant:{...f[e]},info:a?.value.calculate(n)}),delete f[e]}_.sort((e,t)=>(Array.isArray(e.at)?e.at[0]:e.at)-(Array.isArray(t.at)?t.at[0]:t.at)),t.created(e,n,r,i),t.mounted(e,n,r,i);let v=e.motionInstance;v.clickIds=_.map(e=>e.id),v.set(p),v.watchStopHandle=l([o,c,u].filter(Boolean),()=>{let t=ii.get(e)?.visibilityState.value??`shown`;if(!a?.value||![`slide`,`presenter`].includes(s?.value??``)){let e={...p,...m};for(let{variant:t}of _)Object.assign(e,t);v.set(e)}else if(d.value||o?.value===c.value){if(t===`shown`){let e={...p,...m};for(let{variant:t,info:n}of _)(!n||n.isActive.value)&&Object.assign(e,t);d.value?v.set(e):v.apply(e)}else v.apply(t===`before`?p:h)}else v.apply((o?.value??-1)>c.value?p:h)},{immediate:!0})},unmounted(e){e.motionInstance.watchStopHandle()}})}}}var Wa=Object.assign({}),Ga=Object.assign({}),Ka=Object.assign({}),qa=[Object.values(Wa)[0],Object.values(Ga)[0],Object.values(Ka)[0]].filter(Boolean);function Ja(){let e=[];function t(e){if(!M.remote||M.remote===e.query.password)return!0;if(M.remote&&e.query.password===void 0){let e=prompt(`Enter password`);if(M.remote===e)return!0}return e.params.no?{path:`/${e.params.no}`}:{path:``}}return e.push({name:`entry`,path:`/entry`,component:()=>j(()=>import(`./slidev/entry-DSOswi5I.js`),__vite__mapDeps([2,3,1,4,5,6]),import.meta.url),beforeEnter:t},{name:`overview`,path:`/overview`,component:()=>j(()=>import(`./slidev/overview-BDL-WvEg.js`),__vite__mapDeps([7,3,1,4,8,5,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url),beforeEnter:t},{name:`notes`,path:`/notes`,component:()=>j(()=>import(`./slidev/notes-8CL_wwS7.js`),__vite__mapDeps([22,3,1,4,8,5,9,10,12,23,13,14,24]),import.meta.url),beforeEnter:t},{name:`notes-edit`,path:`/notes-edit`,component:()=>j(()=>import(`./slidev/notes-edit-tOOff3rP.js`),__vite__mapDeps([25,3,1,4,8,5,9,10,12,23]),import.meta.url),beforeEnter:t},{name:`presenter`,path:`/presenter/:no`,component:()=>j(()=>import(`./slidev/presenter-DL_E7IJt.js`),__vite__mapDeps([26,3,1,4,8,5,9,10,18,27,12,28,29,13,14,24,15,16,17,19,20,30,31,32]),import.meta.url),beforeEnter:t},{path:`/presenter`,redirect:{path:`/presenter/1`}}),e.push({name:`play`,path:`/:no`,component:()=>j(()=>import(`./slidev/play-CgReZXhX.js`),__vite__mapDeps([33,3,1,4,8,5,9,10,18,11,23,15,16,17,19,30,12,28,31,34]),import.meta.url)},{path:``,redirect:{path:`/1`}},{path:`/:pathMatch(.*)*`,name:`NotFound`,component:()=>j(()=>import(`./slidev/404-rf-O7dKq.js`),__vite__mapDeps([35,3,1,4,8,5,9,10,36]),import.meta.url)}),qa.reduce((e,t)=>t(e),e)}async function Ya(e){function t(){document.documentElement.style.setProperty(`--vh`,`${window.innerHeight*.01}px`)}t(),window.addEventListener(`resize`,t);let n=he({history:Te(`./`),routes:Ja()});e.use(n),e.use(qr()),e.use(ri()),e.use(Ha()),e.use(pi()),e.use(Ua()),e.use(S,{container:`#twoslash-container`});let r={app:e,router:n};for(let e of Zr)await e(r)}async function Xa(){let e=b(Rr);await Ya(e),e.mount(`#app`)}Xa();export{Qr as a,Er as c,Sr as d,Ht as f,Mt as h,$r as i,Or as l,Wt as m,ci as n,Ir as o,Ut as p,si as r,kr as s,ui as t,xr as u};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/index-DoO9FZlh.css
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lecture-06/assets/interactive-DBHsn3dn.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{H as e,S as t,_ as n,b as r,bt as i,vt as a,w as o,xt as s,y as c,z as l}from"./modules/shiki-BFOesOFp.js";import{t as u}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as d}from"./slidev/context-DrkI8qiD.js";import{t as f}from"./DeckFooter-DkGAACS-.js";var p={class:`slidev-layout dl-interactive`},m={key:0,class:`dl-interactive__title`},h={class:`dl-interactive__stage`},g=u(o({__name:`interactive`,props:{heading:{},asideWidth:{},asideLeft:{type:Boolean}},setup(o){let{$slidev:u,$nav:g,$clicksContext:_,$clicks:v,$page:y,$renderContext:b,$frontmatter:x}=d(),S=o;return(o,u)=>{let d=f;return l(),r(`div`,p,[S.heading?(l(),r(`h1`,m,s(S.heading),1)):c(`v-if`,!0),n(`div`,{class:a([`dl-interactive__grid`,{"is-aside-left":S.asideLeft}])},[n(`div`,h,[e(o.$slots,`default`,{},void 0,!0)]),n(`div`,{class:`dl-interactive__aside`,style:i({flexBasis:S.asideWidth??`17rem`})},[e(o.$slots,`aside`,{},void 0,!0)],4)],2),t(d)])}}}),[[`__scopeId`,`data-v-0c449bbd`]]);export{g as t};
|
|
|
|
|
|
lecture-06/assets/interactive-D_LX0oud.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.dl-interactive[data-v-0c449bbd]{flex-direction:column;display:flex}.dl-interactive__title[data-v-0c449bbd]{margin-bottom:.7rem}.dl-interactive__grid[data-v-0c449bbd]{flex:auto;align-items:stretch;gap:1.6rem;min-height:0;display:flex}.dl-interactive__grid.is-aside-left[data-v-0c449bbd]{flex-direction:row-reverse}.dl-interactive__stage[data-v-0c449bbd]{flex:auto;justify-content:center;align-items:center;min-width:0;display:flex}.dl-interactive__aside[data-v-0c449bbd]{font-size:var(--dl-fs-secondary);flex-grow:0;flex-shrink:0;overflow-y:auto}.dl-interactive__aside[data-v-0c449bbd]:empty{display:none}
|
|
|
|
|
|
lecture-06/assets/md-1GUuAYm_.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,S as n,_ as r,_t as i,v as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./TransformerGlyph-1pDKmZ2i.js";import{t as d}from"./section-C2g2VRmZ.js";var f={class:`absolute right-18 top-1/2 -translate-y-1/2`},p={__name:`slides.md__slidev_39`,setup(p){let{$slidev:m,$nav:h,$clicksContext:g,$clicks:_,$page:v,$renderContext:y,$frontmatter:b}=c();return g.setup(),(c,p)=>{let m=u;return s(),a(d,o(e(i(l)(i(b),38))),{default:t(()=>[p[0]||=r(`h1`,null,`From one head to one block`,-1),p[1]||=r(`p`,null,`Many heads, one block.`,-1),r(`div`,f,[n(m,{kind:`block`,size:190})])]),_:1},16)}}};export{p as default};
|
|
|
|
|
|
lecture-06/assets/md-5CCz_ZVw.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,V as i,W as a,_ as o,_t as s,b as c,m as l,v as u,x as d,xt as f,yt as p,z as m}from"./modules/shiki-BFOesOFp.js";import{n as h,t as g}from"./slidev/context-DrkI8qiD.js";import{t as _}from"./default-D0qxH3Ml.js";import{t as v}from"./slidev/VClicks-vSW8X3kW.js";import{t as y}from"./slidev/KaTexBlockWrapper-BIWk6fjX.js";var b={class:`mt-1`},x={class:`grid grid-cols-2 gap-8 mt-1 dl-tight`},S={class:`mt-2 dl-secondary`},C={viewBox:`0 0 600 170`,class:`dl-diagram`,role:`img`,"aria-label":`The words the, river and bank each go up through their own copy of the same feed-forward network; there are no arrows between the columns`},w=[`x`],T=[`x`],E=[`d`],D=[`points`],O=[`x`],k=[`d`],A=[`x`],j={class:`mt-2 dl-callout`},M={__name:`slides.md__slidev_50`,setup(M){let{$slidev:N,$nav:P,$clicksContext:F,$clicks:I,$page:L,$renderContext:R,$frontmatter:z}=h();return F.setup(),(h,M)=>{let N=y,P=v,F=a(`click`);return m(),u(_,p(t(s(g)(s(z),49))),{default:n(()=>[M[5]||=o(`h1`,null,`The other half of the block`,-1),M[6]||=o(`p`,null,[d(`After attention mixes the positions, each position goes through the `),o(`strong`,null,`same small network, alone`),d(`:`)],-1),o(`div`,b,[r(N,{ranges:[]},{default:n(()=>[...M[0]||=[o(`p`,null,[o(`span`,{class:`katex-display`},[o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`},[o(`semantics`,null,[o(`mrow`,null,[o(`mi`,{mathvariant:`normal`},`FFN`),o(`mo`,null,`β‘`),o(`mo`,{stretchy:`false`},`(`),o(`mi`,{mathvariant:`bold`},`x`),o(`mo`,{stretchy:`false`},`)`),o(`mo`,null,`=`),o(`msub`,null,[o(`mi`,null,`W`),o(`mn`,null,`2`)]),o(`mtext`,null,`β`),o(`mi`,null,`Ο`),o(`mtext`,null,`ββ£`),o(`mrow`,null,[o(`mo`,{fence:`true`},`(`),o(`msub`,null,[o(`mi`,null,`W`),o(`mn`,null,`1`)]),o(`mi`,{mathvariant:`bold`},`x`),o(`mo`,null,`+`),o(`msub`,null,[o(`mi`,{mathvariant:`bold`},`b`),o(`mn`,null,`1`)]),o(`mo`,{fence:`true`},`)`)]),o(`mo`,null,`+`),o(`msub`,null,[o(`mi`,{mathvariant:`bold`},`b`),o(`mn`,null,`2`)])]),o(`annotation`,{encoding:`application/x-tex`},`\\operatorname{FFN}(\\mathbf{x}) = W_2\\,\\phi\\!\\left(W_1\\mathbf{x} + \\mathbf{b}_1\\right) + \\mathbf{b}_2`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),o(`span`,{class:`mop`},[o(`span`,{class:`mord mathrm`},`FFN`)]),o(`span`,{class:`mopen`},`(`),o(`span`,{class:`mord mathbf`},`x`),o(`span`,{class:`mclose`},`)`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),o(`span`,{class:`mrel`},`=`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3011em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},`2`)])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])]),o(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),o(`span`,{class:`mord mathnormal`},`Ο`),o(`span`,{class:`mspace`,style:{"margin-right":`-0.1667em`}}),o(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),o(`span`,{class:`minner`},[o(`span`,{class:`mopen delimcenter`,style:{top:`0em`}},`(`),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3011em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},`1`)])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])]),o(`span`,{class:`mord mathbf`},`x`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),o(`span`,{class:`mbin`},`+`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathbf`},`b`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3011em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},`1`)])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])]),o(`span`,{class:`mclose delimcenter`,style:{top:`0em`}},`)`)]),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),o(`span`,{class:`mbin`},`+`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathbf`},`b`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3011em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},`2`)])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])])])])])])],-1)]]),_:1})]),o(`div`,x,[o(`div`,null,[r(P,null,{default:n(()=>[...M[1]||=[o(`ul`,null,[o(`li`,null,`Two linear layers and a non-linearity: lecture 02βs MLP (multilayer perceptron)`),o(`li`,null,[o(`strong`,null,`Position-wise`),d(`: no token sees another`)]),o(`li`,null,[d(`Wide in the middle: `),o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[o(`semantics`,null,[o(`mrow`,null,[o(`msub`,null,[o(`mi`,null,`d`),o(`mtext`,null,`ff`)]),o(`mo`,null,`=`),o(`mn`,null,`4`),o(`mi`,null,`d`),o(`mo`,null,`=`),o(`mn`,null,`2048`)]),o(`annotation`,{encoding:`application/x-tex`},`d_{\\text{ff}} = 4d = 2048`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathnormal`},`d`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3361em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},[o(`span`,{class:`mord text mtight`},[o(`span`,{class:`mord mtight`},`ff`)])])])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])]),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),o(`span`,{class:`mrel`},`=`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),o(`span`,{class:`mord`},`4`),o(`span`,{class:`mord mathnormal`},`d`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),o(`span`,{class:`mrel`},`=`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),o(`span`,{class:`mord`},`2048`)])])])])],-1)]]),_:1}),e((m(),c(`div`,S,[...M[2]||=[o(`p`,null,[o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[o(`semantics`,null,[o(`mrow`,null,[o(`mn`,null,`2`),o(`mo`,null,`Γ`),o(`mn`,null,`512`),o(`mo`,null,`Γ`),o(`mn`,null,`2048`),o(`mo`,null,`=`),o(`mn`,null,`2`),o(`mtext`,null,`β`),o(`mn`,null,`097`),o(`mtext`,null,`β`),o(`mn`,null,`152`)]),o(`annotation`,{encoding:`application/x-tex`},`2 \\times 512 \\times 2048 = 2\\,097\\,152`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.7278em`,"vertical-align":`-0.0833em`}}),o(`span`,{class:`mord`},`2`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),o(`span`,{class:`mbin`},`Γ`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.7278em`,"vertical-align":`-0.0833em`}}),o(`span`,{class:`mord`},`512`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),o(`span`,{class:`mbin`},`Γ`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),o(`span`,{class:`mord`},`2048`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),o(`span`,{class:`mrel`},`=`),o(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),o(`span`,{class:`mord`},`2`),o(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),o(`span`,{class:`mord`},`097`),o(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),o(`span`,{class:`mord`},`152`)])])]),d(` weights, against 1.05 M for attention: `),o(`strong`,null,`two thirds of the block.`)],-1)]])),[[F]])]),o(`div`,null,[(m(),c(`svg`,C,[M[3]||=o(`defs`,null,[o(`marker`,{id:`l6s2-ffn-arrow`,markerWidth:`7`,markerHeight:`7`,refX:`6`,refY:`3.5`,orient:`auto`},[o(`path`,{class:`dl-dg-head`,d:`M0 0 L7 3.5 L0 7 z`})])],-1),(m(),c(l,null,i([`the`,`river`,`bank`],(e,t)=>o(`g`,{key:t},[o(`rect`,{class:`dl-dg-box`,x:50+t*200,y:`138`,width:`100`,height:`28`,rx:`4`},null,8,w),o(`text`,{class:`dl-dg-lab is-sm`,x:100+t*200,y:`157`,"text-anchor":`middle`},f(e),9,T),o(`path`,{class:`dl-dg-arrow`,"marker-end":`url(#l6s2-ffn-arrow)`,d:`M`+(100+t*200)+` 136 V120`},null,8,E),o(`polygon`,{class:`dl-dg-net`,points:80+t*200+`,116 `+(120+t*200)+`,116 `+(160+t*200)+`,80 `+(120+t*200)+`,44 `+(80+t*200)+`,44 `+(40+t*200)+`,80`},null,8,D),o(`text`,{class:`dl-dg-in`,x:100+t*200,y:`85`,"text-anchor":`middle`},`FFN`,8,O),o(`path`,{class:`dl-dg-arrow`,"marker-end":`url(#l6s2-ffn-arrow)`,d:`M`+(100+t*200)+` 42 V24`},null,8,k),o(`rect`,{class:`dl-dg-box is-accent`,x:60+t*200,y:`2`,width:`80`,height:`20`,rx:`4`},null,8,A)])),64))])),e((m(),c(`div`,j,[...M[4]||=[o(`p`,null,[d(`Attention decides `),o(`strong`,null,`what to gather`),d(`. This decides `),o(`strong`,null,`what to do with it`),d(`.`)],-1)]])),[[F]])])])]),_:1},16)}}};export{M as default};
|
|
|
|
|
|
lecture-06/assets/md-6u9b4JQU.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_41`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),40))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: One softmax can only point at one thing`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[a(`The word boxes spell out the sentence. The solid arc is one softmax for `),n(`em`,null,`it`),a(`. Its weights add up to 1, so most of the weight lands on one word: `),n(`em`,null,`cat`),a(`.`)]),n(`li`,null,[a(`The dashed lines are other questions `),n(`em`,null,`it`),a(` needs answered: a nearby noun, the previous word, and the clause it sits in.`)]),n(`li`,null,`One set of weights cannot point at four places at once. Spreading the weight would blur the four answers together.`),n(`li`,null,[a(`The fix is to run attention several times side by side. Each copy has its own `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`Q`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.9694em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`Q`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(`, and is called a head.`)])])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-7b2m1J_B2.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_25`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),24))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Four steps, and that is the whole mechanism`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,[a(`Read the picture left to right. Each box is one step, and the numbers under it are the row for `),n(`em`,null,`bank`),a(` after that step.`)]),n(`ol`,null,[n(`li`,null,[n(`strong`,null,`Score.`),a(` Dot the asking wordβs query with every key. For `),n(`em`,null,`bank`),a(` this gives 0, 2, 0. Only `),n(`em`,null,`river`),a(` matches.`)]),n(`li`,null,[n(`strong`,null,`Scale.`),a(` Divide each score by `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msqrt`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)])])]),n(`annotation`,{encoding:`application/x-tex`},`\\sqrt{d_k}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.04em`,"vertical-align":`-0.1828em`}}),n(`span`,{class:`mord sqrt`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.8572em`}},[n(`span`,{class:`svg-align`,style:{top:`-3em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])]),n(`span`,{style:{top:`-2.8172em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[n(`path`,{d:`M95,702
|
| 2 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 3 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 4 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 5 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 6 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 7 |
-
l0 -0
|
| 8 |
-
c5.3,-9.3,12,-14,20,-14
|
| 9 |
-
H400000v40H845.2724
|
| 10 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 11 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 12 |
-
M834 80h400000v40h-400000z`})])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.1828em`}},[n(`span`)])])])])])])]),a(`. Here `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)]),n(`mo`,null,`=`),n(`mn`,null,`2`)]),n(`annotation`,{encoding:`application/x-tex`},`d_k = 2`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`2`)])])]),a(`, so 2 becomes 1.41.`)]),n(`li`,null,[n(`strong`,null,`Softmax.`),a(` Turn the scores into weights that are positive and add up to 1: 0.16, 0.67, 0.16.`)]),n(`li`,null,[n(`strong`,null,`Mix.`),a(` Add up the values, each times its weight. The result is `),n(`em`,null,`bank`),a(`βs new vector.`)])]),n(`p`,null,`Only step 2 is new compared with last weekβs attention.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/md-B1Cw576Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,W as i,_ as a,_t as o,b as s,v as c,x as l,yt as u,z as d}from"./modules/shiki-BFOesOFp.js";import{n as f,t as p}from"./slidev/context-DrkI8qiD.js";import{t as m}from"./slidev/VClicks-vSW8X3kW.js";import{t as h}from"./interactive-DBHsn3dn.js";import{t as g}from"./PositionalEncoding-q3Ic_HFH.js";var _={class:`mt-2 dl-callout`},v={__name:`slides.md__slidev_46`,setup(v){let{$slidev:y,$nav:b,$clicksContext:x,$clicks:S,$page:C,$renderContext:w,$frontmatter:T}=f();return x.setup(),(f,v)=>{let y=g,b=m,x=i(`click`);return d(),c(h,u(t(o(p)(o(T),45))),{aside:n(t=>[v[2]||=a(`p`,null,[l(`Press `),a(`strong`,null,`Shuffle the words`),l(`, then read the vectors.`)],-1),r(b,null,{default:n(()=>[...v[0]||=[a(`ul`,null,[a(`li`,null,[l(`Every wordβs output is `),a(`strong`,null,`exactly`),l(` what it was`)]),a(`li`,null,[l(`A weighted sum is a sum over a `),a(`strong`,null,`set`),l(`. A set has no order`)]),a(`li`,null,[a(`em`,null,`the river bank`),l(` and `),a(`em`,null,`bank river the`),l(` look the same`)])],-1)]]),_:1}),e((d(),s(`div`,_,[...v[1]||=[a(`p`,null,`Last weekβs lecture was about order. We have just thrown it away.`,-1)]])),[[x]])]),default:n(()=>[r(y,{mode:`blind`})]),_:1},16)}}};export{v as default};
|
|
|
|
|
|
lecture-06/assets/md-B7GUUxxz.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
import{E as e,M as t,Q as n,S as r,V as i,_ as a,_t as o,b as s,m as c,v as l,x as u,yt as d,z as f}from"./modules/shiki-BFOesOFp.js";import{n as p,t as m}from"./slidev/context-DrkI8qiD.js";import{t as h}from"./default-D0qxH3Ml.js";import{t as g}from"./slidev/VClicks-vSW8X3kW.js";import{t as _}from"./slidev/CodeBlockWrapper-DML1LZdj.js";var v={class:`grid grid-cols-[1fr_1fr] gap-6 mt-2 items-center`},y={class:`dl-diagram`,viewBox:`0 0 420 120`,role:`img`,"aria-label":`An input of shape (B, T, 512) goes into a stack of six encoder layers and comes out with the same shape. The stack has 18 914 304 parameters.`},b=[`y`],x={class:`dl-tight`},S={__name:`slides.md__slidev_98`,setup(S){let{$slidev:C,$nav:w,$clicksContext:T,$clicks:E,$page:D,$renderContext:O,$frontmatter:k}=p();return T.setup(),(p,S)=>{let C=_,w=g;return f(),l(h,d(e(o(m)(o(k),97))),{default:n(()=>[S[12]||=a(`h1`,null,`Or use the one in the box`,-1),r(C,t({lines:!0},{title:``,ranges:[`all`,`1-3`,`5`,`7-8`,`all`]}),{default:n(()=>[...S[0]||=[a(`pre`,{class:`shiki shiki-themes vitesse-dark vitesse-light slidev-code`,style:{"--shiki-dark":`#dbd7caee`,"--shiki-light":`#393a34`,"--shiki-dark-bg":`#121212`,"--shiki-light-bg":`#ffffff`}},[a(`code`,{class:`language-python`},[a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`layer `),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},` nn`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`.`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`TransformerEncoderLayer`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`(`),a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},`d_model`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4C9A91`,"--shiki-light":`#2F798A`}},`512`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` nhead`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4C9A91`,"--shiki-light":`#2F798A`}},`8`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` dim_feedforward`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4C9A91`,"--shiki-light":`#2F798A`}},`2048`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`)]),u(`
|
| 2 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` batch_first`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4D9375`,"--shiki-light":`#1E754F`}},`True`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # (B, T, d), not (T, B, d)`)]),u(`
|
| 3 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` norm_first`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4D9375`,"--shiki-light":`#1E754F`}},`True`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`)`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # pre-LN, not the default`)]),u(`
|
| 4 |
-
`),a(`span`,{class:`line`}),u(`
|
| 5 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`encoder `),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},` nn`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`.`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`TransformerEncoder`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`(`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`layer`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` num_layers`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#4C9A91`,"--shiki-light":`#2F798A`}},`6`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`)`)]),u(`
|
| 6 |
-
`),a(`span`,{class:`line`}),u(`
|
| 7 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`out `),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},` encoder`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`(`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`src`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#BD976A`,"--shiki-light":`#B07D48`}},` src_key_padding_mask`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`pad_mask`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`)`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # (B, T, 512) β (B, T, 512)`)]),u(`
|
| 8 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#B8A965`,"--shiki-light":`#998418`}},`print`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`(`),a(`span`,{style:{"--shiki-dark":`#B8A965`,"--shiki-light":`#998418`}},`sum`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`(`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`p`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`.`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`numel`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`()`),a(`span`,{style:{"--shiki-dark":`#4D9375`,"--shiki-light":`#1E754F`}},` for`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},` p `),a(`span`,{style:{"--shiki-dark":`#4D9375`,"--shiki-light":`#1E754F`}},`in`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},` encoder`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`.`),a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`parameters`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`()))`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # 18 914 304`)])])],-1)]]),_:1},16),a(`div`,v,[a(`div`,null,[(f(),s(`svg`,y,[S[1]||=a(`defs`,null,[a(`marker`,{id:`l6s5-a4`,markerWidth:`8`,markerHeight:`8`,refX:`7`,refY:`4`,orient:`auto`},[a(`path`,{d:`M0 0 L8 4 L0 8 z`,class:`dl-dg-head`})])],-1),S[2]||=a(`rect`,{x:`2`,y:`36`,width:`96`,height:`28`,rx:`3`,class:`dl-dg-box`},null,-1),S[3]||=a(`text`,{x:`50`,y:`55`,class:`dl-dg-in`,"text-anchor":`middle`},`(B, T, 512)`,-1),S[4]||=a(`path`,{d:`M100 50 H136`,class:`dl-dg-arrow`,"marker-end":`url(#l6s5-a4)`},null,-1),(f(),s(c,null,i(6,e=>a(`rect`,{key:e,x:`142`,y:4+(e-1)*15,width:`134`,height:`12`,rx:`2`,class:`dl-dg-fill`},null,8,b)),64)),S[5]||=a(`text`,{x:`209`,y:`112`,class:`dl-dg-small`,"text-anchor":`middle`},`6 encoder layers`,-1),S[6]||=a(`path`,{d:`M280 50 H316`,class:`dl-dg-arrow`,"marker-end":`url(#l6s5-a4)`},null,-1),S[7]||=a(`rect`,{x:`320`,y:`36`,width:`96`,height:`28`,rx:`3`,class:`dl-dg-box is-accent`},null,-1),S[8]||=a(`text`,{x:`368`,y:`55`,class:`dl-dg-in`,"text-anchor":`middle`},`(B, T, 512)`,-1),S[9]||=a(`text`,{x:`368`,y:`84`,class:`dl-dg-small`,"text-anchor":`middle`},`18 914 304`,-1),S[10]||=a(`text`,{x:`368`,y:`98`,class:`dl-dg-small`,"text-anchor":`middle`},`parameters`,-1)]))]),a(`div`,x,[r(w,null,{default:n(()=>[...S[11]||=[a(`ul`,null,[a(`li`,null,[a(`code`,null,`batch_first=True`),u(`: the same trap as last weekβs `),a(`code`,null,`nn.LSTM`),u(` (long short-term memory)`)]),a(`li`,null,[a(`code`,null,`norm_first=True`),u(`: the default is the 2017 wiring, which needs warmup`)]),a(`li`,null,[u(`The count matches "What a block costs": `),a(`strong`,null,`18.9 M`)])],-1)]]),_:1})])])]),_:1},16)}}};export{S as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/md-B9ulHjpP2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,V as i,W as a,_ as o,_t as s,b as c,m as l,v as u,vt as d,x as f,xt as p,yt as m,z as h}from"./modules/shiki-BFOesOFp.js";import{n as g,t as _}from"./slidev/context-DrkI8qiD.js";import{t as v}from"./default-D0qxH3Ml.js";import{t as y}from"./slidev/VClicks-vSW8X3kW.js";var b={class:`grid grid-cols-2 gap-8 mt-2 dl-tight`},x={viewBox:`0 0 330 230`,class:`dl-diagram`,role:`img`,"aria-label":`The key-value cache grows by one column per generated token; with grouped-query attention four query heads share one key-value head`},S=[`y`],C=[`x`,`y`],w=[`x`,`y`],T=[`cx`],E=[`d`],D={class:`mt-2 dl-callout`},O={__name:`slides.md__slidev_85`,setup(O){let{$slidev:k,$nav:A,$clicksContext:j,$clicks:M,$page:N,$renderContext:P,$frontmatter:F}=g();return j.setup(),(g,O)=>{let k=y,A=a(`click`);return h(),u(v,m(t(s(_)(s(F),84))),{default:n(()=>[O[8]||=o(`h1`,null,`What generation actually costs`,-1),O[9]||=o(`p`,null,`Token 501 attends to tokens 1β500. Their keys and values were already computed for token 500.`,-1),o(`div`,b,[o(`div`,null,[(h(),c(`svg`,x,[(h(),c(l,null,i([3,4,5],(e,t)=>o(`g`,{key:`s`+e},[o(`text`,{class:`dl-dg-small`,x:`4`,y:40+t*40},`step `+p(e),9,S),(h(!0),c(l,null,i(e,n=>(h(),c(`rect`,{key:n,class:d(n===e?`dl-dg-fill`:`dl-dg-fill is-muted`),x:44+(n-1)*30,y:22+t*40,width:`26`,height:`26`,rx:`3`},null,10,C))),128)),o(`text`,{class:`dl-dg-small is-good`,x:56+e*30,y:40+t*40},`1 new query`,8,w)])),64)),O[5]||=o(`text`,{class:`dl-dg-small`,x:`44`,y:`146`},`grey: cached keys and values Β· accent: computed now`,-1),e((h(),c(`g`,null,[(h(),c(l,null,i(4,e=>o(`circle`,{key:e,class:`dl-dg-dot is-accent`,cx:40+(e-1)*34,cy:`178`,r:`7`},null,8,T)),64)),(h(),c(l,null,i(4,e=>o(`path`,{key:`l`+e,class:`dl-dg-arrow`,d:`M${40+(e-1)*34} 185 L91 205`},null,8,E)),64)),O[0]||=o(`rect`,{class:`dl-dg-fill is-muted`,x:`74`,y:`205`,width:`34`,height:`20`,rx:`3`},null,-1),O[1]||=o(`text`,{class:`dl-dg-small`,x:`91`,y:`219`,"text-anchor":`middle`},`K, V`,-1),O[2]||=o(`text`,{class:`dl-dg-small`,x:`180`,y:`182`},`4 query heads`,-1),O[3]||=o(`text`,{class:`dl-dg-small`,x:`180`,y:`198`},`share 1 key/value head`,-1),O[4]||=o(`text`,{class:`dl-dg-small is-good`,x:`180`,y:`216`},`cache Γ· 4`,-1)])),[[A]])]))]),o(`div`,null,[r(k,null,{default:n(()=>[...O[6]||=[o(`ul`,null,[o(`li`,null,[o(`strong`,null,`KV (keyβvalue) cache`),f(`: keep every layerβs keys and values`)]),o(`li`,null,[f(`Each new token computes `),o(`strong`,null,`one`),f(` query and reuses the rest`)]),o(`li`,null,[f(`Cost per new token falls from `),o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[o(`semantics`,null,[o(`mrow`,null,[o(`mi`,null,`O`),o(`mo`,{stretchy:`false`},`(`),o(`msup`,null,[o(`mi`,null,`T`),o(`mn`,null,`2`)]),o(`mo`,{stretchy:`false`},`)`)]),o(`annotation`,{encoding:`application/x-tex`},`O(T^2)`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`1.0641em`,"vertical-align":`-0.25em`}}),o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0278em`}},`O`),o(`span`,{class:`mopen`},`(`),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`T`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.8141em`}},[o(`span`,{style:{top:`-3.063em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mtight`},`2`)])])])])])])]),o(`span`,{class:`mclose`},`)`)])])]),f(` to `),o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[o(`semantics`,null,[o(`mrow`,null,[o(`mi`,null,`O`),o(`mo`,{stretchy:`false`},`(`),o(`mi`,null,`T`),o(`mo`,{stretchy:`false`},`)`)]),o(`annotation`,{encoding:`application/x-tex`},`O(T)`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0278em`}},`O`),o(`span`,{class:`mopen`},`(`),o(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`T`),o(`span`,{class:`mclose`},`)`)])])])])],-1)]]),_:1}),e((h(),c(`div`,D,[...O[7]||=[o(`p`,null,[f(`The cache is `),o(`strong`,null,`enormous`),f(`: layers Γ heads Γ tokens Γ `),o(`span`,{class:`katex`},[o(`span`,{class:`katex-mathml`},[o(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[o(`semantics`,null,[o(`mrow`,null,[o(`msub`,null,[o(`mi`,null,`d`),o(`mi`,null,`k`)])]),o(`annotation`,{encoding:`application/x-tex`},`d_k`)])])]),o(`span`,{class:`katex-html`,"aria-hidden":`true`},[o(`span`,{class:`katex-base`},[o(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),o(`span`,{class:`mord`},[o(`span`,{class:`mord mathnormal`},`d`),o(`span`,{class:`msupsub`},[o(`span`,{class:`vlist-t vlist-t2`},[o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.3361em`}},[o(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[o(`span`,{class:`pstrut`,style:{height:`2.7em`}}),o(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[o(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),o(`span`,{class:`vlist-s`},`β`)]),o(`span`,{class:`vlist-r`},[o(`span`,{class:`vlist`,style:{height:`0.15em`}},[o(`span`)])])])])])])])]),f(` Γ 2, per sequence. At long context it fills the GPU, not the weights.`)],-1)]])),[[A]])])])]),_:1},16)}}};export{O as default};
|
|
|
|
|
|
lecture-06/assets/md-BAhUxKK3.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,yt as a,z as o}from"./modules/shiki-BFOesOFp.js";import{n as s,t as c}from"./slidev/context-DrkI8qiD.js";import{t as l}from"./default-D0qxH3Ml.js";var u={__name:`slides.md__slidev_106`,setup(u){let{$slidev:d,$nav:f,$clicksContext:p,$clicks:m,$page:h,$renderContext:g,$frontmatter:_}=s();return p.setup(),(s,u)=>(o(),i(l,a(e(r(c)(r(_),105))),{default:t(()=>[...u[0]||=[n(`h1`,null,`In words: Where we got to`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`Each glyph stands for one section of the lecture.`),n(`ul`,null,[n(`li`,null,`A transformer drops the recurrence, so every position is processed at the same time.`),n(`li`,null,`Attention is a soft lookup. A query is compared with every key, and the values are mixed using those scores.`),n(`li`,null,`Several heads ask several questions at once. Position is added, because attention ignores word order.`),n(`li`,null,`A block is attention, then a small network on each position, each with a residual and a norm.`),n(`li`,null,`The original model had two stacks. Modern models keep only the masked decoder stack.`)]),n(`p`,null,`The sentence to remember: mix across positions, then think about each position alone.`)],-1)]]),_:1},16))}};export{u as default};
|
|
|
|
|
|
lecture-06/assets/md-BCE9dyfW.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_45`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),44))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Heads are free`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`The diagram follows one multi-head attention layer from bottom to top.`),n(`ul`,null,[n(`li`,null,[a(`The input has `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`=`),n(`mn`,null,`512`)]),n(`annotation`,{encoding:`application/x-tex`},`d = 512`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`512`)])])]),a(` numbers per token.`)]),n(`li`,null,[a(`The projections `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`Q`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.9694em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`Q`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` are cut into 8 heads. Each head works at width 64, because `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`512`),n(`mi`,{mathvariant:`normal`},`/`),n(`mn`,null,`8`),n(`mo`,null,`=`),n(`mn`,null,`64`)]),n(`annotation`,{encoding:`application/x-tex`},`512 / 8 = 64`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mord`},`512/8`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`64`)])])]),a(`.`)]),n(`li`,null,[a(`The 8 head outputs are placed side by side: `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`8`),n(`mo`,null,`Γ`),n(`mn`,null,`64`),n(`mo`,null,`=`),n(`mn`,null,`512`)]),n(`annotation`,{encoding:`application/x-tex`},`8 \\times 64 = 512`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7278em`,"vertical-align":`-0.0833em`}}),n(`span`,{class:`mord`},`8`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`Γ`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`64`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`512`)])])]),a(`.`)]),n(`li`,null,[n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`O`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_O`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0278em`}},`O`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` then mixes the heads back together into one 512-wide output.`)]),n(`li`,null,[a(`The layer always has four `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`Γ`),n(`mi`,null,`d`)]),n(`annotation`,{encoding:`application/x-tex`},`d \\times d`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7778em`,"vertical-align":`-0.0833em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`Γ`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathnormal`},`d`)])])]),a(` matrices, whatever the number of heads. At `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`=`),n(`mn`,null,`512`)]),n(`annotation`,{encoding:`application/x-tex`},`d = 512`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`512`)])])]),a(` that is `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`4`),n(`mo`,null,`Γ`),n(`msup`,null,[n(`mn`,null,`512`),n(`mn`,null,`2`)]),n(`mo`,null,`=`),n(`mn`,null,`1`),n(`mtext`,null,`β`),n(`mn`,null,`048`),n(`mtext`,null,`β`),n(`mn`,null,`576`)]),n(`annotation`,{encoding:`application/x-tex`},`4 \\times 512^2 = 1\\,048\\,576`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7278em`,"vertical-align":`-0.0833em`}}),n(`span`,{class:`mord`},`4`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`Γ`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8141em`}}),n(`span`,{class:`mord`},`51`),n(`span`,{class:`mord`},[n(`span`,{class:`mord`},`2`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.8141em`}},[n(`span`,{style:{top:`-3.063em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mtight`},`2`)])])])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`048`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`576`)])])]),a(` weights.`)])]),n(`p`,null,`Takeaway: more heads means narrower heads, not more weights.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BD00LdYU2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,yt as a,z as o}from"./modules/shiki-BFOesOFp.js";import{n as s,t as c}from"./slidev/context-DrkI8qiD.js";import{t as l}from"./default-D0qxH3Ml.js";var u={__name:`slides.md__slidev_78`,setup(u){let{$slidev:d,$nav:f,$clicksContext:p,$clicks:m,$page:h,$renderContext:g,$frontmatter:_}=s();return p.setup(),(s,u)=>(o(),i(l,a(e(r(c)(r(_),77))),{default:t(()=>[...u[0]||=[n(`h1`,null,`In words: Why decoder-only took over`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,`The picture shows ordinary text along the bottom: "the river bank was flooded".`),n(`li`,null,`Each arrow points from a word to the word after it. That next word is the target the model must predict.`),n(`li`,null,`So five words of text give four training examples. Nobody had to label anything.`),n(`li`,null,`Any text can be used this way, and every position in it is an example.`),n(`li`,null,`Many tasks can be written as "continue this text", so one objective covers them all.`),n(`li`,null,`Remember: decoder-only won because its training data costs nothing, not because the layer is better.`)])],-1)]]),_:1},16))}};export{u as default};
|
|
|
|
|
|
lecture-06/assets/md-BDUTraAK2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_23`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),22))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Why a key and a value are different things`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[n(`strong`,null,`Top`),a(`, a library bookβs spine: `),n(`em`,null,`river`),a(`βs key, made with `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(`, is `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`2`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[2, 0]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mclose`},`]`)])])]),a(`. It makes the book easy to find, here by the word "water".`)]),n(`li`,null,[n(`strong`,null,`Bottom:`),a(),n(`em`,null,`river`),a(`βs value, made with `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(`, is `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`2.3`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0.3`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[2.3, 0.3]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`2.3`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0.3`),n(`span`,{class:`mclose`},`]`)])])]),a(`. It is what is inside the book: what `),n(`em`,null,`river`),a(` hands over once `),n(`em`,null,`bank`),a(` has found it.`)]),n(`li`,null,`A good spine label is short and says what the book is about. That is not what you want to read. So the two jobs get two different matrices.`),n(`li`,null,[a(`Using one matrix for both (`),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)]),n(`mo`,null,`=`),n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K = W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(`) still works, but slightly worse.`)])])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BEoc4J_E.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_58`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),57))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: What a block costs`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,[a(`The bars compare the weights in one encoder block, drawn to scale at `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`=`),n(`mn`,null,`512`)]),n(`annotation`,{encoding:`application/x-tex`},`d = 512`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`512`)])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mtext`,null,`ff`)]),n(`mo`,null,`=`),n(`mn`,null,`2048`)]),n(`annotation`,{encoding:`application/x-tex`},`d_{\\text{ff}} = 2048`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mtight`},[n(`span`,{class:`mord text mtight`},[n(`span`,{class:`mord mtight`},`ff`)])])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`2048`)])])]),a(`.`)]),n(`ul`,null,[n(`li`,null,[a(`Attention has four `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`Γ`),n(`mi`,null,`d`)]),n(`annotation`,{encoding:`application/x-tex`},`d \\times d`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7778em`,"vertical-align":`-0.0833em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`Γ`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathnormal`},`d`)])])]),a(` matrices: `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`1`),n(`mtext`,null,`β`),n(`mn`,null,`048`),n(`mtext`,null,`β`),n(`mn`,null,`576`)]),n(`annotation`,{encoding:`application/x-tex`},`1\\,048\\,576`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`048`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`576`)])])]),a(` weights.`)]),n(`li`,null,[a(`The feed-forward network has two `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`d`),n(`mo`,null,`Γ`),n(`msub`,null,[n(`mi`,null,`d`),n(`mtext`,null,`ff`)])]),n(`annotation`,{encoding:`application/x-tex`},`d \\times d_{\\text{ff}}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7778em`,"vertical-align":`-0.0833em`}}),n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`Γ`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mtight`},[n(`span`,{class:`mord text mtight`},[n(`span`,{class:`mord mtight`},`ff`)])])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` matrices: `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`2`),n(`mtext`,null,`β`),n(`mn`,null,`097`),n(`mtext`,null,`β`),n(`mn`,null,`152`)]),n(`annotation`,{encoding:`application/x-tex`},`2\\,097\\,152`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`097`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`152`)])])]),a(` weights. Its bar is twice as long.`)]),n(`li`,null,[a(`The two LayerNorms have only `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`2`),n(`mtext`,null,`β`),n(`mn`,null,`048`)]),n(`annotation`,{encoding:`application/x-tex`},`2\\,048`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`048`)])])]),a(` weights.`)]),n(`li`,null,[a(`One block holds about 3.15 M weights. The sentence length `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`T`)]),n(`annotation`,{encoding:`application/x-tex`},`T`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`T`)])])]),a(` appears nowhere.`)]),n(`li`,null,`Six encoder blocks (18.9 M), six decoder blocks (25.2 M) and the shared embedding (18.9 M) give 63 M. Biases and final norms make up the rest of the paperβs 65 M.`)]),n(`p`,null,`Takeaway: two thirds of each blockβs weights sit in the feed-forward network.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BFOvAsJ4.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_17`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),16))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Three roles, one vector`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[a(`The box `),n(`strong`,null,`x`),a(` on the left is one tokenβs vector.`)]),n(`li`,null,[a(`It goes through three different learned matrices, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`Q`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.9694em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`Q`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` (the trapezoids). Each one gives a different short vector.`)]),n(`li`,null,[a(`The `),n(`strong`,null,`query`),a(),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,{mathvariant:`bold`},`q`)]),n(`annotation`,{encoding:`application/x-tex`},`\\mathbf{q}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6389em`,"vertical-align":`-0.1944em`}}),n(`span`,{class:`mord mathbf`},`q`)])])]),a(` says what this token is looking for. It is compared with every tokenβs key.`)]),n(`li`,null,[a(`The `),n(`strong`,null,`key`),a(),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,{mathvariant:`bold`},`k`)]),n(`annotation`,{encoding:`application/x-tex`},`\\mathbf{k}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6944em`}}),n(`span`,{class:`mord mathbf`},`k`)])])]),a(` says what this token advertises, so that others can find it.`)]),n(`li`,null,[a(`The `),n(`strong`,null,`value`),a(),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,{mathvariant:`bold`},`v`)]),n(`annotation`,{encoding:`application/x-tex`},`\\mathbf{v}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.4444em`}}),n(`span`,{class:`mord mathbf`,style:{"margin-right":`0.016em`}},`v`)])])]),a(` is what this token hands over when another token attends to it. Values are averaged into the output.`)]),n(`li`,null,[a(`Every token plays all three roles at once, even when it looks at itself. `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`Q`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.9694em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`Q`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` are the only new learned parameters.`)])])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BIcSKdBe2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,W as i,_ as a,_t as o,b as s,v as c,x as l,yt as u,z as d}from"./modules/shiki-BFOesOFp.js";import{n as f,t as p}from"./slidev/context-DrkI8qiD.js";import{t as m}from"./default-D0qxH3Ml.js";import{t as h}from"./slidev/VClicks-vSW8X3kW.js";import{t as g}from"./Citation-C9LcHAMd.js";var _={class:`grid grid-cols-2 gap-8 mt-2 dl-tight`},v={viewBox:`0 0 330 200`,class:`dl-diagram`,style:{"max-height":`11rem`},role:`img`,"aria-label":`RoPE: a key and a query rotated by 15 degrees per position; at positions 2 and 5, and again at 6 and 9, the angle between them is the same 45 degrees`},y={class:`mt-2 dl-callout`},b={class:`mt-2`},x={__name:`slides.md__slidev_83`,setup(x){let{$slidev:S,$nav:C,$clicksContext:w,$clicks:T,$page:E,$renderContext:D,$frontmatter:O}=f();return w.setup(),(f,x)=>{let S=h,C=g,w=i(`click`);return d(),c(m,u(t(o(p)(o(O),82))),{default:n(()=>[x[6]||=a(`h1`,null,`Position, done properly`,-1),a(`div`,_,[a(`div`,null,[(d(),s(`svg`,v,[x[1]||=a(`defs`,null,[a(`marker`,{id:`l6s4-rot`,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`},[a(`path`,{class:`dl-dg-head`,d:`M0 0 L6 3 L0 6 z`})])],-1),x[2]||=a(`g`,null,[a(`path`,{class:`dl-dg-grad`,d:`M80 130 H160`}),a(`path`,{class:`dl-dg-line is-muted`,"marker-end":`url(#l6s4-rot)`,d:`M80 130 L140.6 95`}),a(`path`,{class:`dl-dg-line`,"marker-end":`url(#l6s4-rot)`,d:`M80 130 L98.1 62.4`}),a(`path`,{class:`dl-dg-arrow`,d:`M104.2 116 A28 28 0 0 0 87.2 103`}),a(`text`,{class:`dl-dg-in`,x:`110`,y:`96`},`3ΞΈ`),a(`text`,{class:`dl-dg-small`,x:`146`,y:`96`},`k, pos 2`),a(`text`,{class:`dl-dg-small`,x:`84`,y:`54`},`q, pos 5`),a(`text`,{class:`dl-dg-small`,x:`80`,y:`160`,"text-anchor":`middle`},`positions 2 and 5`)],-1),e((d(),s(`g`,null,[...x[0]||=[a(`path`,{class:`dl-dg-grad`,d:`M245 130 H325`},null,-1),a(`path`,{class:`dl-dg-line is-muted`,"marker-end":`url(#l6s4-rot)`,d:`M245 130 L245 60`},null,-1),a(`path`,{class:`dl-dg-line`,"marker-end":`url(#l6s4-rot)`,d:`M245 130 L195.5 80.5`},null,-1),a(`path`,{class:`dl-dg-arrow`,d:`M245 102 A28 28 0 0 0 225.2 110.2`},null,-1),a(`text`,{class:`dl-dg-in`,x:`230`,y:`84`,"text-anchor":`middle`},`3ΞΈ`,-1),a(`text`,{class:`dl-dg-small`,x:`250`,y:`56`},`k, pos 6`,-1),a(`text`,{class:`dl-dg-small`,x:`160`,y:`74`},`q, pos 9`,-1),a(`text`,{class:`dl-dg-small`,x:`245`,y:`160`,"text-anchor":`middle`},`positions 6 and 9`,-1)]])),[[w]]),x[3]||=a(`text`,{class:`dl-dg-small`,x:`165`,y:`188`,"text-anchor":`middle`},`ΞΈ = 15Β° per position; the gap is 3ΞΈ = 45Β° in both`,-1)]))]),a(`div`,null,[r(S,null,{default:n(()=>[...x[4]||=[a(`ul`,null,[a(`li`,null,[l(`Added at the bottom, position has to `),a(`strong`,null,`survive every block`)]),a(`li`,null,[l(`The model needs `),a(`strong`,null,`relative`),l(` position: `),a(`em`,null,`three words before me`),l(`, not `),a(`em`,null,`word 412`)]),a(`li`,null,[a(`strong`,null,`RoPE`),l(` (rotary position embedding): `),a(`strong`,null,`rotate`),l(` each query and key by an angle set by its position`)]),a(`li`,null,[l(`The dot product then depends only on the `),a(`strong`,null,`difference`),l(` of positions`)])],-1)]]),_:1})])]),e((d(),s(`div`,y,[...x[5]||=[a(`p`,null,`Relative position comes from the geometry, inside every attention layer. Every major open model since Llama uses it.`,-1)]])),[[w]]),a(`div`,b,[r(C,{source:`Su et al., RoFormer: Enhanced Transformer with Rotary Position Embedding (2021)`,url:`https://arxiv.org/abs/2104.09864`})])]),_:1},16)}}};export{x as default};
|
|
|
|
|
|
lecture-06/assets/md-BLU60Dt22.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_76`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),75))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The architecture forked three ways`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,`The 2017 transformer has three descendants, and they all use the same block.`),n(`li`,null,`Each panel of the widget starts with a mask grid. A filled cell means "this position may look at that one".`),n(`li`,null,[n(`strong`,null,`Encoder-only`),a(` fills the whole grid. Every word sees every other word, so it reads a text well but cannot write one.`)]),n(`li`,null,[n(`strong`,null,`Decoder-only`),a(` fills only the lower triangle. Each word sees itself and the words before it, so it can generate the next word.`)]),n(`li`,null,[n(`strong`,null,`Encoderβdecoder`),a(` keeps both stacks, as in the original paper.`)]),n(`li`,null,`Remember: the families differ in the mask they train with, not in the layer.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BP8VIKZW.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,V as i,W as a,_ as o,_t as s,b as c,bt as l,g as u,lt as d,m as f,v as p,vt as m,w as h,x as g,xt as _,y as v,yt as y,z as b}from"./modules/shiki-BFOesOFp.js";import{t as x}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as S,t as C}from"./slidev/context-DrkI8qiD.js";import{t as w}from"./slidev/VClicks-vSW8X3kW.js";import{t as T}from"./interactive-DBHsn3dn.js";import{t as E}from"./WidgetFrame-D2L0MlKA.js";import{t as D}from"./StepButton-BcP33F-1.js";import{t as O}from"./useConvolution-qO1u8ksh.js";import{n as k,r as A}from"./useAttention-Blk0c2BZ.js";var j={class:`dl-mh`},M={class:`dl-mh__sentence`},N=[`onClick`],P={class:`dl-mh__rows`},F=[`onClick`],I={class:`dl-mh__headlabel`},L={class:`dl-mh__headreads`},R={class:`dl-mh__bars`},z=[`title`],B={class:`dl-mh__reads`},V={class:`dl-mh__concat`},H={class:`dl-mh__whole`},U={class:`dl-mh__whole is-out`},W=x(h({__name:`MultiHeadLab`,props:{query:{default:6},dModel:{default:512}},setup(e){let{$slidev:t,$nav:a,$clicksContext:h,$clicks:y,$page:x,$renderContext:C,$frontmatter:w}=S(),T=e,W=d(T.query),G=d(null),K=A,q=u(()=>k.map((e,t)=>({...e,index:t,weights:e.weights[W.value],top:e.weights[W.value].indexOf(Math.max(...e.weights[W.value]))}))),J=u(()=>G.value===null?q.value:[q.value[G.value]]),Y=u(()=>Math.round(T.dModel/k.length));function X(){W.value=(W.value+1)%K.length}function Z(e){return e<=W.value}return(e,t)=>{let a=D,u=E;return b(),p(u,{"max-width":`45rem`},{controls:n(()=>[r(a,{label:`Next query word`,glyph:`βΈ`,onClick:X}),G.value===null?v(`v-if`,!0):(b(),p(a,{key:0,label:`All heads`,variant:`ghost`,glyph:`β¦`,onClick:t[0]||=e=>G.value=null}))]),readout:n(()=>[W.value===6?(b(),c(f,{key:0},[t[5]||=o(`strong`,null,`it`,-1),t[6]||=g(` asks four questions at once: head 1 takes the word before it, head 2 the nearby nouns, head 3 goes back five words to `,-1),t[7]||=o(`strong`,null,`cat`,-1),t[8]||=g(` β what `,-1),t[9]||=o(`em`,null,`it`,-1),t[10]||=g(` refers to β and head 4 parks on the first token. One softmax puts its mass in one place, so one head could answer only one of those. `,-1),t[11]||=o(`span`,{class:`dl-mh__note`},[g(` Head 4 is not a drawing error: heads that sit almost entirely on the first token turn up in every trained model. Nothing after `),o(`em`,null,`it`),g(` is drawn because this is a decoder, which may not look forward β section 03. `)],-1)],64)):(b(),c(f,{key:1},[o(`strong`,null,_(s(K)[W.value]),1),t[12]||=g(` asking, four heads answering differently: `,-1),(b(!0),c(f,null,i(q.value,(e,t)=>(b(),c(f,{key:e.name},[t>0?(b(),c(f,{key:0},[g(`, `)],64)):v(`v-if`,!0),g(` `+_(e.name)+` β `,1),o(`strong`,null,_(s(K)[e.top]),1)],64))),128)),t[13]||=g(`. Each head is its own W`,-1),t[14]||=o(`sub`,null,`Q`,-1),t[15]||=g(`, W`,-1),t[16]||=o(`sub`,null,`K`,-1),t[17]||=g(`, W`,-1),t[18]||=o(`sub`,null,`V`,-1),g(` at width `+_(Y.value)+` = `+_(T.dModel)+`/`+_(s(k).length)+`, so all `+_(s(k).length)+` together cost exactly what one head of width `+_(T.dModel)+` would. `,1)],64))]),default:n(()=>[o(`div`,j,[v(` The sentence, and which word is asking. `),o(`div`,M,[t[1]||=o(`span`,{class:`dl-mh__label`},`query`,-1),(b(!0),c(f,null,i(s(K),(e,t)=>(b(),c(`button`,{key:e+t,type:`button`,class:m([`dl-mh__word`,{"is-current":t===W.value}]),onClick:e=>W.value=t},_(e),11,N))),128))]),v(` One row per head: the same question, four different answers. `),o(`div`,P,[(b(!0),c(f,null,i(J.value,e=>(b(),c(`div`,{key:e.name,class:`dl-mh__row`},[o(`button`,{type:`button`,class:m([`dl-mh__headname`,{"is-solo":G.value===e.index}]),onClick:t=>G.value=G.value===e.index?null:e.index},[o(`span`,I,_(e.name),1),o(`span`,L,_(e.reads),1)],10,F),o(`div`,R,[(b(!0),c(f,null,i(e.weights,(t,n)=>(b(),c(`div`,{key:n,class:m([`dl-mh__bar`,{"is-top":n===e.top&&Z(n),"is-dead":!Z(n)}]),title:`${s(K)[n]}: ${s(O)(t)}`},[o(`span`,{class:`dl-mh__fill`,style:l({height:`${Z(n)?t*100:0}%`})},null,4)],10,z))),128))]),o(`div`,B,[e.weights[e.top]>.4?(b(),c(f,{key:0},[t[2]||=g(`β `,-1),o(`strong`,null,_(s(K)[e.top]),1)],64)):(b(),c(f,{key:1},[g(`β spread`)],64))])]))),128))]),v(` What happens to the four outputs. `),o(`div`,V,[(b(!0),c(f,null,i(q.value,e=>(b(),c(`span`,{key:`c${e.index}`,class:`dl-mh__slice`},_(Y.value),1))),128)),t[3]||=o(`span`,{class:`dl-mh__op`},`concat β`,-1),o(`span`,H,_(T.dModel),1),t[4]||=o(`span`,{class:`dl-mh__op`},[g(`Γ W`),o(`sub`,null,`O`),g(` β`)],-1),o(`span`,U,_(T.dModel),1)])])]),_:1})}}}),[[`__scopeId`,`data-v-d4d1022e`]]),G={class:`mt-2 dl-callout`},K={__name:`slides.md__slidev_42`,setup(i){let{$slidev:l,$nav:u,$clicksContext:d,$clicks:f,$page:m,$renderContext:h,$frontmatter:_}=S();return d.setup(),(i,l)=>{let u=W,d=w,f=a(`click`);return b(),p(T,y(t(s(C)(s(_),41))),{aside:n(t=>[l[2]||=o(`p`,null,[o(`em`,null,`it`),g(` is asking. Four heads, four different answers.`)],-1),r(d,null,{default:n(()=>[...l[0]||=[o(`ul`,null,[o(`li`,null,[o(`strong`,null,`head 1`),g(` β the previous word`)]),o(`li`,null,[o(`strong`,null,`head 3`),g(` β five words back, to `),o(`em`,null,`cat`)]),o(`li`,null,[o(`strong`,null,`head 4`),g(` β parks on token 1 and does nothing`)])],-1)]]),_:1}),e((b(),c(`div`,G,[...l[1]||=[o(`p`,null,`Head 4 is not a drawing error. Nearly-dead heads are in every model anyone has looked inside.`,-1)]])),[[f]])]),default:n(()=>[r(u)]),_:1},16)}}};export{K as default};
|
|
|
|
|
|
lecture-06/assets/md-BTCxmEyp.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,W as i,_ as a,_t as o,b as s,v as c,x as l,yt as u,z as d}from"./modules/shiki-BFOesOFp.js";import{n as f,t as p}from"./slidev/context-DrkI8qiD.js";import{t as m}from"./default-D0qxH3Ml.js";import{t as h}from"./slidev/VClicks-vSW8X3kW.js";import{t as g}from"./slidev/CodeBlockWrapper-DML1LZdj.js";var _={class:`grid grid-cols-[1fr_1.05fr] gap-8 mt-1 items-start`},v={class:`dl-tight`},y={viewBox:`0 0 320 232`,class:`dl-diagram`,style:{"max-height":`16rem`},role:`img`,"aria-label":`Top: a dictionary query river matches one key exactly and returns one value. Bottom: an attention query is compared with every key, and every value is blended by how well its key matched`},b={class:`mt-2 dl-callout`},x={__name:`slides.md__slidev_14`,setup(x){let{$slidev:S,$nav:C,$clicksContext:w,$clicks:T,$page:E,$renderContext:D,$frontmatter:O}=f();return w.setup(),(f,x)=>{let S=g,C=h,w=i(`click`);return d(),c(m,u(t(o(p)(o(O),13))),{default:n(()=>[x[18]||=a(`h1`,null,`Start from a lookup`,-1),a(`div`,_,[a(`div`,v,[x[2]||=a(`p`,null,[l(`A Python dictionary finds the `),a(`strong`,null,`exact`),l(` key and hands back its value.`)],-1),r(S,{title:``,ranges:[]},{default:n(()=>[...x[0]||=[a(`pre`,{class:`shiki shiki-themes vitesse-dark vitesse-light slidev-code`,style:{"--shiki-dark":`#dbd7caee`,"--shiki-light":`#393a34`,"--shiki-dark-bg":`#121212`,"--shiki-light-bg":`#ffffff`}},[a(`code`,{class:`language-python`},[a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`store `),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`=`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},` {`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`river`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`:`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},` "`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`waterside`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`,`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},` "`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`money`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`:`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},` "`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`financial`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`}`)]),l(`
|
| 2 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`store`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`[`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`river`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`]`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # β 'waterside' one winner`)]),l(`
|
| 3 |
-
`),a(`span`,{class:`line`},[a(`span`,{style:{"--shiki-dark":`#DBD7CAEE`,"--shiki-light":`#393A34`}},`store`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`[`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#C98A7D`,"--shiki-light":`#B56959`}},`stream`),a(`span`,{style:{"--shiki-dark":`#C98A7D77`,"--shiki-light":`#B5695977`}},`"`),a(`span`,{style:{"--shiki-dark":`#666666`,"--shiki-light":`#999999`}},`]`),a(`span`,{style:{"--shiki-dark":`#758575DD`,"--shiki-light":`#A0ADA0`}},` # β KeyError nothing at all`)])])],-1)]]),_:1}),r(C,null,{default:n(()=>[...x[1]||=[a(`ul`,null,[a(`li`,null,[l(`What you bring: the `),a(`strong`,null,`query`)]),a(`li`,null,[l(`What each entry advertises: its `),a(`strong`,null,`key`)]),a(`li`,null,[l(`What you get back: its `),a(`strong`,null,`value`)])],-1)]]),_:1})]),a(`div`,null,[(d(),s(`svg`,y,[x[4]||=a(`defs`,null,[a(`marker`,{id:`l6s1-lookup`,markerWidth:`7`,markerHeight:`7`,refX:`6`,refY:`3.5`,orient:`auto`},[a(`path`,{class:`dl-dg-head`,d:`M0 0 L7 3.5 L0 7 z`})])],-1),x[5]||=a(`text`,{class:`dl-dg-small`,x:`4`,y:`14`},`dictionary`,-1),x[6]||=a(`rect`,{class:`dl-dg-box`,x:`4`,y:`34`,width:`64`,height:`26`,rx:`4`},null,-1),x[7]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`36`,y:`52`,"text-anchor":`middle`,style:{"font-style":`italic`}},`river`,-1),x[8]||=a(`path`,{class:`dl-dg-arrow`,"marker-end":`url(#l6s1-lookup)`,d:`M70 40 L110 35`},null,-1),x[9]||=a(`rect`,{class:`dl-dg-box is-accent`,x:`114`,y:`24`,width:`64`,height:`22`,rx:`3`},null,-1),x[10]||=a(`text`,{class:`dl-dg-small`,x:`146`,y:`39`,"text-anchor":`middle`},`river`,-1),x[11]||=a(`rect`,{class:`dl-dg-box`,x:`114`,y:`52`,width:`64`,height:`22`,rx:`3`},null,-1),x[12]||=a(`text`,{class:`dl-dg-small`,x:`146`,y:`67`,"text-anchor":`middle`},`money`,-1),x[13]||=a(`path`,{class:`dl-dg-arrow`,"marker-end":`url(#l6s1-lookup)`,d:`M180 35 H218`},null,-1),x[14]||=a(`rect`,{class:`dl-dg-box is-accent`,x:`222`,y:`24`,width:`90`,height:`22`,rx:`3`},null,-1),x[15]||=a(`text`,{class:`dl-dg-small`,x:`267`,y:`39`,"text-anchor":`middle`},`waterside`,-1),x[16]||=a(`text`,{class:`dl-dg-small`,x:`114`,y:`92`},`exact match: one winner`,-1),e((d(),s(`g`,null,[...x[3]||=[a(`line`,{class:`dl-dg-split`,x1:`4`,y1:`104`,x2:`316`,y2:`104`},null,-1),a(`text`,{class:`dl-dg-small is-good`,x:`4`,y:`122`},`attention`,-1),a(`path`,{class:`dl-dg-line is-muted`,d:`M40 176 L116 145`,style:{strokeWidth:1.5}},null,-1),a(`path`,{class:`dl-dg-line`,d:`M40 176 L116 173`,style:{strokeWidth:6}},null,-1),a(`path`,{class:`dl-dg-line is-muted`,d:`M40 176 L116 201`,style:{strokeWidth:2.5}},null,-1),a(`circle`,{class:`dl-dg-dot is-accent`,cx:`30`,cy:`176`,r:`12`},null,-1),a(`text`,{x:`30`,y:`181`,"text-anchor":`middle`,style:{fill:`var(--dl-bg)`,"font-size":`13px`,"font-weight":`700`}},`q`,-1),a(`rect`,{class:`dl-dg-box`,x:`116`,y:`134`,width:`50`,height:`22`,rx:`3`},null,-1),a(`rect`,{class:`dl-dg-box is-accent`,x:`116`,y:`162`,width:`50`,height:`22`,rx:`3`},null,-1),a(`rect`,{class:`dl-dg-box`,x:`116`,y:`190`,width:`50`,height:`22`,rx:`3`},null,-1),a(`text`,{class:`dl-dg-small`,x:`141`,y:`149`,"text-anchor":`middle`},`key 1`,-1),a(`text`,{class:`dl-dg-small`,x:`141`,y:`177`,"text-anchor":`middle`},`key 2`,-1),a(`text`,{class:`dl-dg-small`,x:`141`,y:`205`,"text-anchor":`middle`},`key 3`,-1),a(`rect`,{class:`dl-dg-box`,x:`176`,y:`134`,width:`54`,height:`22`,rx:`3`},null,-1),a(`rect`,{class:`dl-dg-box is-accent`,x:`176`,y:`162`,width:`54`,height:`22`,rx:`3`},null,-1),a(`rect`,{class:`dl-dg-box`,x:`176`,y:`190`,width:`54`,height:`22`,rx:`3`},null,-1),a(`text`,{class:`dl-dg-small`,x:`203`,y:`149`,"text-anchor":`middle`},`value 1`,-1),a(`text`,{class:`dl-dg-small`,x:`203`,y:`177`,"text-anchor":`middle`},`value 2`,-1),a(`text`,{class:`dl-dg-small`,x:`203`,y:`205`,"text-anchor":`middle`},`value 3`,-1),a(`path`,{class:`dl-dg-line is-muted`,d:`M230 145 L262 170`,style:{strokeWidth:1.5}},null,-1),a(`path`,{class:`dl-dg-line`,d:`M230 173 L262 173`,style:{strokeWidth:6}},null,-1),a(`path`,{class:`dl-dg-line is-muted`,d:`M230 201 L262 176`,style:{strokeWidth:2.5}},null,-1),a(`rect`,{class:`dl-dg-box is-accent`,x:`262`,y:`160`,width:`52`,height:`26`,rx:`4`},null,-1),a(`text`,{class:`dl-dg-small`,x:`288`,y:`177`,"text-anchor":`middle`},`blend`,-1),a(`text`,{class:`dl-dg-small`,x:`116`,y:`228`},`similarity: every value, weighted`,-1)]])),[[w]])]))])]),e((d(),s(`div`,b,[...x[17]||=[a(`p`,null,[l(`Attention is this lookup made `),a(`strong`,null,`soft`),l(`: it matches by `),a(`em`,null,`similarity`),l(`, and returns a blend of `),a(`strong`,null,`every`),l(` value.`)],-1)]])),[[w]])]),_:1},16)}}};export{x as default};
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/md-BV7tqBmU.css
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
.dl-syllabus[data-v-45e850fb]{width:100%}.dl-syllabus__track[data-v-45e850fb]{align-items:stretch;gap:4px;display:grid;position:relative}.dl-syllabus__block[data-v-45e850fb]{border:1px solid var(--dl-border);background:var(--dl-surface);cursor:pointer;border-radius:5px;height:2.6rem;padding:0;transition:background .15s,border-color .15s,transform .15s;position:relative}.dl-syllabus__block[data-v-45e850fb]:hover{border-color:var(--dl-accent);transform:translateY(-2px)}.dl-syllabus__block.is-selected[data-v-45e850fb]{background:var(--dl-accent);border-color:var(--dl-accent-strong)}.dl-syllabus__num[data-v-45e850fb]{color:var(--dl-muted);font-size:.8rem;font-weight:700}.dl-syllabus__block.is-selected .dl-syllabus__num[data-v-45e850fb]{color:#fff}.dl-syllabus__now[data-v-45e850fb]{border:2px solid var(--dl-danger);pointer-events:none;border-radius:5px;grid-row:1}.dl-syllabus__weeks[data-v-45e850fb]{color:var(--dl-muted);text-align:center;font-variant-numeric:tabular-nums;gap:4px;margin-top:.3rem;font-size:.7rem;display:grid}.dl-syllabus__detail[data-v-45e850fb]{min-height:6.5rem;margin-top:1.2rem}.dl-syllabus__heading[data-v-45e850fb]{align-items:baseline;gap:.8rem;display:flex}.dl-syllabus__weeklabel[data-v-45e850fb]{letter-spacing:.08em;text-transform:uppercase;color:var(--dl-accent);flex-shrink:0;font-size:.78rem;font-weight:700}.dl-syllabus__detail h3[data-v-45e850fb]{margin:0;font-size:1.45rem}.dl-syllabus__detail p[data-v-45e850fb]{max-width:68ch;margin:.45rem 0 0;font-size:1.05rem;line-height:1.5}
|
|
|
|
|
|
lecture-06/assets/md-BVq0H9oi2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_69`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),68))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Cross-attention is last weekβs slide`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`Cross-attention is ordinary attention with inputs from two places.`),n(`ul`,null,[n(`li`,null,[n(`strong`,null,[a(`The query `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`Q`)]),n(`annotation`,{encoding:`application/x-tex`},`Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8778em`,"vertical-align":`-0.1944em`}}),n(`span`,{class:`mord mathnormal`},`Q`)])])]),a(` comes from the decoder`)]),a(`, the accent box on the left. It asks what the next word needs.`)]),n(`li`,null,[n(`strong`,null,[a(`The keys `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`K`)]),n(`annotation`,{encoding:`application/x-tex`},`K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0715em`}},`K`)])])]),a(` and values `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`V`)]),n(`annotation`,{encoding:`application/x-tex`},`V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.2222em`}},`V`)])])]),a(` come from the encoder`)]),a(`, one pair per source token.`)]),n(`li`,null,[n(`strong`,null,`The lines are the attention weights.`),a(` Score each key, take a softmax, then a weighted sum of the values. This is Bahdanauβs 2014 attention.`)]),n(`li`,null,[n(`strong`,null,`Two things are new:`),a(` the score is a scaled dot product, and neither side is recurrent.`)])]),n(`p`,null,[a(`The encoderβs `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`K`)]),n(`annotation`,{encoding:`application/x-tex`},`K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0715em`}},`K`)])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`V`)]),n(`annotation`,{encoding:`application/x-tex`},`V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.2222em`}},`V`)])])]),a(` are computed once and reused for every output word.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BYSwjGyl2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,W as r,_ as i,_t as a,b as o,v as s,x as c,yt as l,z as u}from"./modules/shiki-BFOesOFp.js";import{n as d,t as f}from"./slidev/context-DrkI8qiD.js";import{t as p}from"./default-D0qxH3Ml.js";var m={class:`grid grid-cols-2 gap-6 mt-2`},h={viewBox:`0 0 480 140`,class:`dl-diagram`,style:{"max-height":`8rem`},role:`img`,"aria-label":`Each model drawn as a rectangle with width proportional to d_model and height proportional to the number of blocks; the growth is mostly in width`},g={class:`dl-callout`},_={class:`mt-2 dl-secondary`},v={__name:`slides.md__slidev_87`,setup(v){let{$slidev:y,$nav:b,$clicksContext:x,$clicks:S,$page:C,$renderContext:w,$frontmatter:T}=d();return x.setup(),(d,v)=>{let y=r(`click`);return u(),s(p,l(t(a(f)(a(T),86))),{default:n(()=>[v[3]||=i(`h1`,null,`The same block, more of it`,-1),v[4]||=i(`div`,{class:`dl-ledger dl-ledger--scale mt-1`},[i(`table`,null,[i(`thead`,null,[i(`tr`,null,[i(`th`),i(`th`,null,`year`),i(`th`,null,`blocks`),i(`th`,null,[i(`span`,{class:`katex`},[i(`span`,{class:`katex-mathml`},[i(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[i(`semantics`,null,[i(`mrow`,null,[i(`msub`,null,[i(`mi`,null,`d`),i(`mtext`,null,`model`)])]),i(`annotation`,{encoding:`application/x-tex`},`d_{\\text{model}}`)])])]),i(`span`,{class:`katex-html`,"aria-hidden":`true`},[i(`span`,{class:`katex-base`},[i(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),i(`span`,{class:`mord`},[i(`span`,{class:`mord mathnormal`},`d`),i(`span`,{class:`msupsub`},[i(`span`,{class:`vlist-t vlist-t2`},[i(`span`,{class:`vlist-r`},[i(`span`,{class:`vlist`,style:{height:`0.3361em`}},[i(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[i(`span`,{class:`pstrut`,style:{height:`2.7em`}}),i(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[i(`span`,{class:`mord mtight`},[i(`span`,{class:`mord text mtight`},[i(`span`,{class:`mord mtight`},`model`)])])])])]),i(`span`,{class:`vlist-s`},`β`)]),i(`span`,{class:`vlist-r`},[i(`span`,{class:`vlist`,style:{height:`0.15em`}},[i(`span`)])])])])])])])])]),i(`th`,null,`heads`),i(`th`,null,`context`),i(`th`,null,`parameters`)])]),i(`tbody`,null,[i(`tr`,null,[i(`td`,null,`Transformer base`),i(`td`,null,`2017`),i(`td`,null,`6`),i(`td`,null,`512`),i(`td`,null,`8`),i(`td`,null,`512`),i(`td`,null,`65 M`)]),i(`tr`,null,[i(`td`,null,`BERT base`),i(`td`,null,`2018`),i(`td`,null,`12`),i(`td`,null,`768`),i(`td`,null,`12`),i(`td`,null,`512`),i(`td`,null,`110 M`)]),i(`tr`,null,[i(`td`,null,`GPT-2 XL`),i(`td`,null,`2019`),i(`td`,null,`48`),i(`td`,null,`1600`),i(`td`,null,`25`),i(`td`,null,`1024`),i(`td`,null,`1.5 B`)]),i(`tr`,null,[i(`td`,null,`GPT-3`),i(`td`,null,`2020`),i(`td`,null,`96`),i(`td`,null,`12288`),i(`td`,null,`96`),i(`td`,null,`2048`),i(`td`,null,`175 B`)]),i(`tr`,null,[i(`td`,null,`Llama 3.1 70B`),i(`td`,null,`2024`),i(`td`,null,`80`),i(`td`,null,`8192`),i(`td`,null,`64`),i(`td`,null,`128 k`),i(`td`,null,`70 B`)])])])],-1),i(`div`,m,[i(`div`,null,[(u(),o(`svg`,h,[...v[0]||=[i(`text`,{class:`dl-dg-small`,x:`4`,y:`12`},`width = d_model Β· height = blocks`,-1),i(`rect`,{class:`dl-dg-fill is-muted`,x:`10`,y:`94.4`,width:`6.2`,height:`5.6`},null,-1),i(`rect`,{class:`dl-dg-fill is-muted`,x:`75`,y:`88.8`,width:`9.4`,height:`11.2`},null,-1),i(`rect`,{class:`dl-dg-fill is-muted`,x:`135`,y:`55`,width:`19.5`,height:`45`},null,-1),i(`rect`,{class:`dl-dg-fill`,x:`190`,y:`10`,width:`150`,height:`90`},null,-1),i(`rect`,{class:`dl-dg-fill`,x:`360`,y:`25`,width:`100`,height:`75`},null,-1),i(`path`,{class:`dl-dg-split`,d:`M4 100 H476`},null,-1),i(`text`,{class:`dl-dg-small`,x:`13`,y:`118`,"text-anchor":`middle`},`2017`,-1),i(`text`,{class:`dl-dg-small`,x:`80`,y:`118`,"text-anchor":`middle`},`BERT`,-1),i(`text`,{class:`dl-dg-small`,x:`145`,y:`118`,"text-anchor":`middle`},`GPT-2 XL`,-1),i(`text`,{class:`dl-dg-small`,x:`265`,y:`118`,"text-anchor":`middle`},`GPT-3`,-1),i(`text`,{class:`dl-dg-small`,x:`410`,y:`118`,"text-anchor":`middle`},`Llama 3.1`,-1)]]))]),i(`div`,null,[e((u(),o(`div`,g,[...v[1]||=[i(`p`,null,[c(`Deeper, wider, longer β and the `),i(`strong`,null,`same block`),c(`.`)],-1)]])),[[y]]),e((u(),o(`div`,_,[...v[2]||=[i(`p`,null,[c(`Context grew 250-fold, so the `),i(`span`,{class:`katex`},[i(`span`,{class:`katex-mathml`},[i(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[i(`semantics`,null,[i(`mrow`,null,[i(`msup`,null,[i(`mi`,null,`T`),i(`mn`,null,`2`)])]),i(`annotation`,{encoding:`application/x-tex`},`T^2`)])])]),i(`span`,{class:`katex-html`,"aria-hidden":`true`},[i(`span`,{class:`katex-base`},[i(`span`,{class:`katex-strut`,style:{height:`0.8141em`}}),i(`span`,{class:`mord`},[i(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`T`),i(`span`,{class:`msupsub`},[i(`span`,{class:`vlist-t`},[i(`span`,{class:`vlist-r`},[i(`span`,{class:`vlist`,style:{height:`0.8141em`}},[i(`span`,{style:{top:`-3.063em`,"margin-right":`0.05em`}},[i(`span`,{class:`pstrut`,style:{height:`2.7em`}}),i(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[i(`span`,{class:`mord mtight`},`2`)])])])])])])])])])]),c(` cost grew too. Faster kernels and caching kept it affordable.`)],-1)]])),[[y]])])])]),_:1},16)}}};export{v as default};
|
|
|
|
|
|
lecture-06/assets/md-Ba46XhX62.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,V as i,W as a,_ as o,_t as s,b as c,m as l,v as u,yt as d,z as f}from"./modules/shiki-BFOesOFp.js";import{n as p,t as m}from"./slidev/context-DrkI8qiD.js";import{t as h}from"./default-D0qxH3Ml.js";import{t as g}from"./PollSlide-D7L0g784.js";var _={class:`grid grid-cols-[1.7fr_1fr] gap-6 items-start`},v={class:`mt-8`},y={viewBox:`0 0 240 150`,class:`dl-diagram`,role:`img`,"aria-label":`A 100-token target sentence enters the decoder; how many passes are needed?`},b=[`x`],x={class:`mt-2 dl-reveal`},S={class:`mt-2 dl-secondary`},C={__name:`slides.md__slidev_72`,setup(C){let{$slidev:w,$nav:T,$clicksContext:E,$clicks:D,$page:O,$renderContext:k,$frontmatter:A}=p();return E.setup(),(p,C)=>{let w=g,T=a(`click`);return f(),u(h,d(t(s(m)(s(A),71))),{default:n(()=>[o(`div`,_,[o(`div`,null,[r(w,{question:`Training on a 100-token target sentence, how many forward passes through the decoder does teacher forcing need?`,items:[`100 β one per output token`,`1 β the mask makes all 100 positions independent`,`2 β one forward, one backward`,`100 at training time and 1 at generation time`]})]),o(`div`,v,[(f(),c(`svg`,y,[C[0]||=o(`rect`,{class:`dl-dg-net`,x:`40`,y:`14`,width:`160`,height:`44`,rx:`6`},null,-1),C[1]||=o(`text`,{class:`dl-dg-in`,x:`120`,y:`41`,"text-anchor":`middle`},`decoder`,-1),(f(),c(l,null,i(4,e=>o(`rect`,{key:e,class:`dl-dg-box`,x:18+(e-1)*36,y:`96`,width:`28`,height:`22`,rx:`3`},null,8,b)),64)),C[2]||=o(`text`,{class:`dl-dg-small`,x:`166`,y:`111`},`β¦`,-1),C[3]||=o(`rect`,{class:`dl-dg-box`,x:`186`,y:`96`,width:`36`,height:`22`,rx:`3`},null,-1),C[4]||=o(`text`,{class:`dl-dg-small`,x:`204`,y:`111`,"text-anchor":`middle`},`100`,-1),C[5]||=o(`path`,{class:`dl-dg-arrow`,d:`M120 92 V62`},null,-1),C[6]||=o(`text`,{class:`dl-dg-small`,x:`120`,y:`138`,"text-anchor":`middle`},`target sentence`,-1),C[7]||=o(`text`,{class:`dl-dg-lab is-sm`,x:`132`,y:`82`},`passes = ?`,-1)]))])]),e((f(),c(`div`,x,[...C[8]||=[o(`p`,null,`One`,-1)]])),[[T]]),e((f(),c(`div`,S,[...C[9]||=[o(`p`,null,`The mask lets all 100 positions train in one pass. Generation still needs 100.`,-1)]])),[[T]])]),_:1},16)}}};export{C as default};
|
|
|
|
|
|
lecture-06/assets/md-BdyJtiOm.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_65`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),64))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The architecture, step by step`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`The widget walks the original transformer in nine steps, in the order the data moves.`),n(`ol`,null,[n(`li`,null,`The source tokens are embedded, and a position vector is added to each.`),n(`li`,null,[a(`They go up the encoder `),n(`strong`,null,`once`),a(`: self-attention, then feed-forward, six times.`)]),n(`li`,null,`The decoder starts from the words written so far.`),n(`li`,null,`It applies masked self-attention, then cross-attention into the encoder output, then feed-forward, six times.`),n(`li`,null,`A linear layer and a softmax give a probability for every word in the vocabulary.`)]),n(`p`,null,[a(`Then one word is chosen, appended, and the decoder runs again. The encoder runs once; the decoder runs `),n(`strong`,null,`once per word it writes`),a(`.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-Be8ibFbg2.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,V as r,W as i,_ as a,_t as o,b as s,m as c,v as l,x as u,xt as d,yt as f,z as p}from"./modules/shiki-BFOesOFp.js";import{n as m,t as h}from"./slidev/context-DrkI8qiD.js";import{t as g}from"./default-D0qxH3Ml.js";var _={class:`grid grid-cols-[15rem_1fr] gap-6 mt-1`},v={viewBox:`0 0 260 330`,class:`dl-diagram`,role:`img`,"aria-label":`A modern pre-norm block; numbered badges mark the six parts that changed since 2017, and the attention formula at its core is unchanged`},y=[`cy`],b=[`y`],x={class:`mt-3 dl-callout`},S={__name:`slides.md__slidev_81`,setup(S){let{$slidev:C,$nav:w,$clicksContext:T,$clicks:E,$page:D,$renderContext:O,$frontmatter:k}=m();return T.setup(),(m,S)=>{let C=i(`click`);return p(),l(g,f(t(o(h)(o(k),80))),{default:n(()=>[S[23]||=a(`h1`,null,`What else changed inside the block`,-1),a(`div`,_,[a(`div`,null,[(p(),s(`svg`,v,[S[0]||=a(`defs`,null,[a(`marker`,{id:`l6s4-blk`,markerWidth:`6`,markerHeight:`6`,refX:`5`,refY:`3`,orient:`auto`},[a(`path`,{class:`dl-dg-head`,d:`M0 0 L6 3 L0 6 z`})])],-1),S[1]||=a(`path`,{class:`dl-dg-arrow`,"marker-end":`url(#l6s4-blk)`,d:`M110 322 V292 M110 262 V244 M110 150 V142 M110 121 V120 M110 92 V82 M110 46 V40 M110 19 V4`},null,-1),S[2]||=a(`path`,{class:`dl-dg-grad is-good`,"marker-end":`url(#l6s4-blk)`,d:`M110 306 H232 V130 H122`},null,-1),S[3]||=a(`path`,{class:`dl-dg-grad is-good`,"marker-end":`url(#l6s4-blk)`,d:`M110 136 H244 V28 H122`},null,-1),S[4]||=a(`rect`,{class:`dl-dg-box`,x:`60`,y:`264`,width:`100`,height:`26`,rx:`4`},null,-1),S[5]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`282`,"text-anchor":`middle`},`RMSNorm`,-1),S[6]||=a(`rect`,{class:`dl-dg-net`,x:`30`,y:`150`,width:`160`,height:`92`,rx:`6`},null,-1),S[7]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`170`,"text-anchor":`middle`},`attention`,-1),S[8]||=a(`rect`,{class:`dl-dg-op`,x:`40`,y:`180`,width:`140`,height:`28`,rx:`4`},null,-1),S[9]||=a(`text`,{class:`dl-dg-in`,x:`110`,y:`199`,"text-anchor":`middle`},`softmax(QKα΅/βdβ)Β·V`,-1),S[10]||=a(`text`,{class:`dl-dg-small`,x:`110`,y:`230`,"text-anchor":`middle`},`rotate Q and K`,-1),S[11]||=a(`circle`,{class:`dl-dg-op`,cx:`110`,cy:`130`,r:`9`},null,-1),S[12]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`135`,"text-anchor":`middle`},`+`,-1),S[13]||=a(`rect`,{class:`dl-dg-box`,x:`60`,y:`94`,width:`100`,height:`26`,rx:`4`},null,-1),S[14]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`112`,"text-anchor":`middle`},`RMSNorm`,-1),S[15]||=a(`rect`,{class:`dl-dg-net`,x:`45`,y:`48`,width:`130`,height:`32`,rx:`6`},null,-1),S[16]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`69`,"text-anchor":`middle`},`SwiGLU network`,-1),S[17]||=a(`circle`,{class:`dl-dg-op`,cx:`110`,cy:`28`,r:`9`},null,-1),S[18]||=a(`text`,{class:`dl-dg-lab is-sm`,x:`110`,y:`33`,"text-anchor":`middle`},`+`,-1),(p(),s(c,null,r([[1,277],[1,107],[4,165],[6,194],[2,226],[3,64]],e=>a(`g`,{key:e.join(`-`)},[a(`circle`,{class:`dl-dg-fill`,cx:`14`,cy:e[1],r:`10`},null,8,y),a(`text`,{class:`dl-dg-in`,x:`14`,y:e[1]+4.5,"text-anchor":`middle`},d(e[0]),9,b)])),64)),S[19]||=a(`circle`,{class:`dl-dg-fill`,cx:`196`,cy:`64`,r:`10`},null,-1),S[20]||=a(`text`,{class:`dl-dg-in`,x:`196`,y:`68.5`,"text-anchor":`middle`},`5`,-1)]))]),a(`div`,null,[S[22]||=a(`div`,{class:`dl-ledger`},[a(`table`,null,[a(`thead`,null,[a(`tr`,null,[a(`th`,null,`#`),a(`th`,null,`2017`),a(`th`,null,`a model trained today`)])]),a(`tbody`,null,[a(`tr`,null,[a(`td`,null,`1`),a(`td`,null,`LayerNorm, after`),a(`td`,null,[a(`strong`,null,`RMSNorm`),u(`, before`)])]),a(`tr`,null,[a(`td`,null,`2`),a(`td`,null,`sinusoids added at the bottom`),a(`td`,null,[a(`strong`,null,`RoPE`),u(`, rotating `),a(`span`,{class:`katex`},[a(`span`,{class:`katex-mathml`},[a(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[a(`semantics`,null,[a(`mrow`,null,[a(`mi`,null,`Q`)]),a(`annotation`,{encoding:`application/x-tex`},`Q`)])])]),a(`span`,{class:`katex-html`,"aria-hidden":`true`},[a(`span`,{class:`katex-base`},[a(`span`,{class:`katex-strut`,style:{height:`0.8778em`,"vertical-align":`-0.1944em`}}),a(`span`,{class:`mord mathnormal`},`Q`)])])]),u(` and `),a(`span`,{class:`katex`},[a(`span`,{class:`katex-mathml`},[a(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[a(`semantics`,null,[a(`mrow`,null,[a(`mi`,null,`K`)]),a(`annotation`,{encoding:`application/x-tex`},`K`)])])]),a(`span`,{class:`katex-html`,"aria-hidden":`true`},[a(`span`,{class:`katex-base`},[a(`span`,{class:`katex-strut`,style:{height:`0.6833em`}}),a(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0715em`}},`K`)])])])])]),a(`tr`,null,[a(`td`,null,`3`),a(`td`,null,`ReLU`),a(`td`,null,[a(`strong`,null,`SwiGLU`)])]),a(`tr`,null,[a(`td`,null,`4`),a(`td`,null,[u(`8 heads, each with its own `),a(`span`,{class:`katex`},[a(`span`,{class:`katex-mathml`},[a(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[a(`semantics`,null,[a(`mrow`,null,[a(`mi`,null,`K`),a(`mo`,{separator:`true`},`,`),a(`mi`,null,`V`)]),a(`annotation`,{encoding:`application/x-tex`},`K,V`)])])]),a(`span`,{class:`katex-html`,"aria-hidden":`true`},[a(`span`,{class:`katex-base`},[a(`span`,{class:`katex-strut`,style:{height:`0.8778em`,"vertical-align":`-0.1944em`}}),a(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0715em`}},`K`),a(`span`,{class:`mpunct`},`,`),a(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),a(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.2222em`}},`V`)])])])]),a(`td`,null,[a(`strong`,null,`grouped-query`)])]),a(`tr`,null,[a(`td`,null,`5`),a(`td`,null,`biases everywhere`),a(`td`,null,[a(`strong`,null,`no biases`)])]),a(`tr`,null,[a(`td`,null,`6`),a(`td`,null,`plain matrix multiplies`),a(`td`,null,[a(`strong`,null,`FlashAttention`)])])])])],-1),e((p(),s(`div`,x,[...S[21]||=[a(`p`,null,[u(`Six changes, and `),a(`strong`,null,`none of them touch`),u(),a(`span`,{class:`katex`},[a(`span`,{class:`katex-mathml`},[a(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[a(`semantics`,null,[a(`mrow`,null,[a(`mi`,{mathvariant:`normal`},`softmax`),a(`mo`,null,`β‘`),a(`mo`,{stretchy:`false`},`(`),a(`mi`,null,`Q`),a(`msup`,null,[a(`mi`,null,`K`),a(`mi`,{mathvariant:`normal`},`β€`)]),a(`mi`,{mathvariant:`normal`},`/`),a(`msqrt`,null,[a(`msub`,null,[a(`mi`,null,`d`),a(`mi`,null,`k`)])]),a(`mo`,{stretchy:`false`},`)`),a(`mi`,null,`V`)]),a(`annotation`,{encoding:`application/x-tex`},`\\operatorname{softmax}(QK^\\top/\\sqrt{d_k})V`)])])]),a(`span`,{class:`katex-html`,"aria-hidden":`true`},[a(`span`,{class:`katex-base`},[a(`span`,{class:`katex-strut`,style:{height:`1.1072em`,"vertical-align":`-0.25em`}}),a(`span`,{class:`mop`},[a(`span`,{class:`mord mathrm`},`softmax`)]),a(`span`,{class:`mopen`},`(`),a(`span`,{class:`mord mathnormal`},`Q`),a(`span`,{class:`mord`},[a(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0715em`}},`K`),a(`span`,{class:`msupsub`},[a(`span`,{class:`vlist-t`},[a(`span`,{class:`vlist-r`},[a(`span`,{class:`vlist`,style:{height:`0.8491em`}},[a(`span`,{style:{top:`-3.063em`,"margin-right":`0.05em`}},[a(`span`,{class:`pstrut`,style:{height:`2.7em`}}),a(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[a(`span`,{class:`mord mtight`},`β€`)])])])])])])]),a(`span`,{class:`mord`},`/`),a(`span`,{class:`mord sqrt`},[a(`span`,{class:`vlist-t vlist-t2`},[a(`span`,{class:`vlist-r`},[a(`span`,{class:`vlist`,style:{height:`0.8572em`}},[a(`span`,{class:`svg-align`,style:{top:`-3em`}},[a(`span`,{class:`pstrut`,style:{height:`3em`}}),a(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[a(`span`,{class:`mord`},[a(`span`,{class:`mord mathnormal`},`d`),a(`span`,{class:`msupsub`},[a(`span`,{class:`vlist-t vlist-t2`},[a(`span`,{class:`vlist-r`},[a(`span`,{class:`vlist`,style:{height:`0.3361em`}},[a(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[a(`span`,{class:`pstrut`,style:{height:`2.7em`}}),a(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[a(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),a(`span`,{class:`vlist-s`},`β`)]),a(`span`,{class:`vlist-r`},[a(`span`,{class:`vlist`,style:{height:`0.15em`}},[a(`span`)])])])])])])]),a(`span`,{style:{top:`-2.8172em`}},[a(`span`,{class:`pstrut`,style:{height:`3em`}}),a(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[a(`path`,{d:`M95,702
|
| 2 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 3 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 4 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 5 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 6 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 7 |
-
l0 -0
|
| 8 |
-
c5.3,-9.3,12,-14,20,-14
|
| 9 |
-
H400000v40H845.2724
|
| 10 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 11 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 12 |
-
M834 80h400000v40h-400000z`})])])])]),a(`span`,{class:`vlist-s`},`β`)]),a(`span`,{class:`vlist-r`},[a(`span`,{class:`vlist`,style:{height:`0.1828em`}},[a(`span`)])])])]),a(`span`,{class:`mclose`},`)`),a(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.2222em`}},`V`)])])]),u(`, the formula from "One output vector, five lines".`)],-1)]])),[[C]])])])]),_:1},16)}}};export{S as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/md-Bm3b9CdW2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_8`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),7))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The move`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[n(`strong`,null,`Left: last weekβs design.`),a(` A recurrent chain does the work. Attention sits on top as a passenger and reads from every state.`)]),n(`li`,null,[n(`strong`,null,`Right: the 2017 design`),a(`, from `),n(`em`,null,`Attention Is All You Need`),a(` (Vaswani et al.). The chain is gone. Each word connects to every other word through attention only.`)]),n(`li`,null,`With no chain, no position waits for another. The whole sentence is processed at once.`),n(`li`,null,`The authors removed the recurrent neural network (RNN) as an experiment. Translation quality went up, not down.`)]),n(`p`,null,`Keep the weighted sum and delete what it was attached to. Every later model builds on that idea.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BnhBsnM82.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_73`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),72))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: How many decoder passes teacher forcing needs`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,[a(`The poll asked how many decoder passes it takes to train on a 100-token target. The answer is `),n(`strong`,null,`one`),a(`.`)]),n(`ul`,null,[n(`li`,null,[n(`strong`,null,`In training, the whole target sentence is the decoderβs input.`),a(` This is teacher forcing.`)]),n(`li`,null,[n(`strong`,null,[a(`The mask stops position `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`t`)]),n(`annotation`,{encoding:`application/x-tex`},`t`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6151em`}}),n(`span`,{class:`mord mathnormal`},`t`)])])]),a(` from seeing anything after `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,null,`t`)]),n(`annotation`,{encoding:`application/x-tex`},`t`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6151em`}}),n(`span`,{class:`mord mathnormal`},`t`)])])]),a(`.`)]),a(` So each position is still a fair next-token prediction.`)]),n(`li`,null,[n(`strong`,null,`All 100 positions are therefore computed together, in one pass.`)]),n(`li`,null,[n(`strong`,null,`Generation is the opposite: 100 passes, one per token.`),a(` A token does not exist until it has been sampled.`)])]),n(`p`,null,`Training is parallel over the sequence; generation is not.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BpsoksUK.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_93`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),92))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The mechanism is one function call`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`The slide shows that the whole attention mechanism is one PyTorch function.`),n(`ul`,null,[n(`li`,null,[n(`strong`,null,`Reading the sketch:`),a(` q, k and v go into one attention box. The red dashed box is the scores tensor.`)]),n(`li`,null,[n(`strong`,null,`What the call does:`),a(` it scales the scores, applies the mask and the softmax, and multiplies by v. With `),n(`code`,null,`is_causal=True`),a(`, no position sees a later one.`)]),n(`li`,null,[n(`strong`,null,`The shapes:`),a(` q, k, v and the output are all `),n(`code`,null,`(32, 8, 128, 64)`),a(`: batch, heads, tokens, width per head.`)]),n(`li`,null,[n(`strong`,null,`The saving:`),a(` a fused kernel never stores the `),n(`code`,null,`(32, 8, 128, 128)`),a(` scores.`)])]),n(`p`,null,[a(`Remember the shape `),n(`code`,null,`(B, heads, T, d_k)`),a(`: the heads act like extra batch entries.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-Bs7Gg5Ru.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{$ as e,E as t,Q as n,S as r,V as i,W as a,_ as o,_t as s,b as c,g as l,lt as u,m as d,v as f,vt as p,w as m,x as h,xt as g,y as _,yt as v,z as y}from"./modules/shiki-BFOesOFp.js";import{t as b}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as x,t as S}from"./slidev/context-DrkI8qiD.js";import{t as C}from"./slidev/VClicks-vSW8X3kW.js";import{t as w}from"./interactive-DBHsn3dn.js";import{t as T}from"./WidgetFrame-D2L0MlKA.js";import{t as E}from"./StepButton-BcP33F-1.js";var D=[`viewBox`],O=[`x`,`width`],k=[`x`],A=[`x`,`width`],j=[`x`],M=[`d`],N=[`cx`],P=[`x`],F=[`x`],I=[`x`,`y`],L=[`x`,`y`],R=[`x`,`y`],z=640,B=372,V=218,H=56,U=366,W=30,G=b(m({__name:`TransformerStack`,props:{layers:{default:6}},setup(e){let{$slidev:t,$nav:a,$clicksContext:s,$clicks:m,$page:v,$renderContext:b,$frontmatter:S}=x(),C=e,w=[{id:`enc-emb`,x:H,y:300,label:`Input embedding`,sub:`one vector per source token`},{id:`enc-sa`,x:H,y:218,label:`Self-attention`,sub:`every token sees every token`},{id:`enc-ff`,x:H,y:180,label:`Feed-forward`,sub:`each position on its own`},{id:`dec-emb`,x:U,y:300,label:`Output embedding`,sub:`what has been written so far`},{id:`dec-sa`,x:U,y:218,label:`Masked self-attention`,sub:`no peeking at the future`},{id:`dec-ca`,x:U,y:180,label:`Cross-attention`,sub:`Q from here, K and V from the encoder`},{id:`dec-ff`,x:U,y:142,label:`Feed-forward`},{id:`dec-lin`,x:U,y:96,label:`Linear`,sub:`d β vocabulary size`},{id:`dec-sm`,x:U,y:58,label:`Softmax`,sub:`a probability per word in the vocabulary`}],G=[{title:`Embed the source`,lit:[`enc-in`,`enc-emb`],note:"The source sentence is split into tokens and each one is looked up in an embedding table β the same `nn.Embedding` as last week. Nothing here knows anything about order yet."},{title:`Add position`,lit:[`enc-in`,`enc-emb`,`enc-pe`],note:`A fixed positional vector is added to each embedding. Without it the encoder would treat the sentence as a bag of words, because a weighted sum has no order in it.`},{title:`Encoder self-attention`,lit:[`enc-sa`],note:`Every source token attends to every other, in both directions β there is no mask here, because the whole source is available at once. This is the step that makes each vector *contextual*.`},{title:`Encoder block, ΓN`,lit:[`enc-sa`,`enc-ff`,`enc-stack`],note:`Attention and feed-forward, each wrapped in a residual and a LayerNorm, repeated N times. The output is one vector per source token β not one vector for the whole sentence, which is precisely the bottleneck this architecture removes.`},{title:`The decoder starts`,lit:[`dec-in`,`dec-emb`,`dec-pe`],note:`The decoder is fed what has been produced so far, shifted right by one and starting from a begin-of-sequence token. During training that is the true target sentence, so every position trains at once β teacher forcing, exactly as last week.`},{title:`Masked self-attention`,lit:[`dec-sa`],note:`The decoder attends to its own output, with position t forbidden from seeing anything after t. Without the mask the model could read the answer off its own input and the loss would collapse to nothing.`},{title:`Cross-attention`,lit:[`dec-ca`,`cross`],note:`The only place the two stacks meet. Queries come from the decoder β βwhat do I need next?β β and keys and values from the encoderβs output. This is last weekβs Bahdanau attention, with the recurrence removed from both sides.`},{title:`Decoder block, ΓN`,lit:[`dec-sa`,`dec-ca`,`dec-ff`,`dec-stack`],note:`Three sub-layers now rather than two, again each with a residual and a norm, again repeated N times.`},{title:`Predict the next token`,lit:[`dec-lin`,`dec-sm`,`dec-out`],note:`A linear layer to vocabulary size and a softmax: a probability for every word. Take one, append it, and run the decoder again. The encoder runs once; the decoder runs once per output token β which is where βtransformers are parallelβ gets its asterisk.`}],K=u(0),q=l(()=>K.value>=G.length),J=l(()=>K.value===0?null:G[K.value-1]);function Y(){K.value=q.value?0:K.value+1}function X(e){return K.value===0?`idle`:J.value?.lit.includes(e)?`current`:G.slice(0,K.value).some(t=>t.lit.includes(e))?`seen`:`idle`}return(e,t)=>{let a=E,s=T;return y(),f(s,{"max-width":`43rem`},{controls:n(()=>[r(a,{label:q.value?`Start over`:K.value===0?`Walk the architecture`:`Next step`,glyph:`βΈ`,onClick:Y},null,8,[`label`])]),readout:n(()=>[J.value?(y(),c(d,{key:0},[o(`strong`,null,g(K.value)+`/`+g(G.length)+` Β· `+g(J.value.title),1),h(` β `+g(J.value.note),1)],64)):(y(),c(d,{key:1},[t[1]||=h(` Six boxes you have already met, arranged into two stacks. Press `,-1),t[2]||=o(`em`,null,`Walk the architecture`,-1),t[3]||=h(` and follow the data: up the encoder once, then up the decoder once for every word it writes. `,-1)],64))]),default:n(()=>[(y(),c(`svg`,{class:`dl-stack`,viewBox:`0 0 ${z} ${B}`,preserveAspectRatio:`xMidYMid meet`,role:`img`,"aria-label":`The 2017 encoder-decoder transformer: an encoder stack reading the source sentence and a decoder stack that attends to its own output and to the encoder's`},[t[0]||=o(`defs`,null,[o(`marker`,{id:`dl-stack-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`5`,markerHeight:`5`,orient:`auto-start-reverse`},[o(`path`,{d:`M0,0 L8,4 L0,8 z`,fill:`currentColor`})])],-1),_(` Column spines, drawn first so the boxes sit on top of them. `),o(`line`,{class:`dl-stack__spine`,x1:165,y1:336,x2:165,y2:176}),o(`line`,{class:`dl-stack__spine`,x1:475,y1:336,x2:475,y2:54,"marker-end":`url(#dl-stack-arrow)`}),_(` Repeated-block brackets. `),o(`rect`,{class:p([`dl-stack__repeat`,`is-${X(`enc-stack`)}`]),x:44,y:`172`,width:242,height:`84`,rx:`8`},null,10,O),o(`text`,{class:p([`dl-stack__repeatlabel`,`is-${X(`enc-stack`)}`]),x:38,y:`214`,"text-anchor":`end`},`Γ`+g(C.layers),11,k),o(`rect`,{class:p([`dl-stack__repeat`,`is-${X(`dec-stack`)}`]),x:354,y:`134`,width:242,height:`122`,rx:`8`},null,10,A),o(`text`,{class:p([`dl-stack__repeatlabel`,`is-${X(`dec-stack`)}`]),x:602,y:`198`,"text-anchor":`start`},`Γ`+g(C.layers),11,j),_(` The one place the two stacks touch. `),o(`path`,{class:p([`dl-stack__cross`,`is-${X(`cross`)}`]),d:`M 165 176 V 158 H 320 V 195 H 362`,"marker-end":`url(#dl-stack-arrow)`},null,10,M),o(`text`,{class:p([`dl-stack__crosslabel`,`is-${X(`cross`)}`]),x:`318`,y:`152`,"text-anchor":`middle`},` K, V from the encoder `,2),_(` Positional-encoding adders. `),(y(!0),c(d,null,i([{id:`enc-pe`,x:165},{id:`dec-pe`,x:475}],e=>(y(),c(`g`,{key:e.id},[o(`circle`,{class:p([`dl-stack__add`,`is-${X(e.id)}`]),cx:e.x,cy:`272`,r:`11`},null,10,N),o(`text`,{class:`dl-stack__plus`,x:e.x,y:`277`,"text-anchor":`middle`},`+`,8,P),o(`text`,{class:p([`dl-stack__pe`,`is-${X(e.id)}`]),x:e.x-18,y:`276`,"text-anchor":`end`},`position`,10,F)]))),128)),_(` The boxes. `),(y(),c(d,null,i(w,e=>o(`g`,{key:e.id},[o(`rect`,{class:p([`dl-stack__box`,`is-${X(e.id)}`]),x:e.x,y:e.y,width:V,height:W,rx:`5`},null,10,I),o(`text`,{class:p([`dl-stack__label`,`is-${X(e.id)}`]),x:e.x+V/2,y:e.y+(e.sub?14:20),"text-anchor":`middle`},g(e.label),11,L),e.sub?(y(),c(`text`,{key:0,class:p([`dl-stack__sub`,`is-${X(e.id)}`]),x:e.x+V/2,y:e.y+25,"text-anchor":`middle`},g(e.sub),11,R)):_(`v-if`,!0)])),64)),_(` Ports. `),o(`text`,{class:p([`dl-stack__port`,`is-${X(`enc-in`)}`]),x:165,y:`350`,"text-anchor":`middle`},` source sentence `,2),o(`text`,{class:p([`dl-stack__port`,`is-${X(`dec-in`)}`]),x:475,y:`350`,"text-anchor":`middle`},` output so far, shifted right `,2),o(`text`,{class:p([`dl-stack__port`,`is-${X(`dec-out`)}`]),x:475,y:`44`,"text-anchor":`middle`},` probability of every next word `,2),o(`text`,{class:`dl-stack__side`,x:H,y:`18`},`ENCODER β reads once`),o(`text`,{class:`dl-stack__side`,x:U,y:`18`},`DECODER β runs once per output token`)],8,D))]),_:1})}}}),[[`__scopeId`,`data-v-b5551dcc`]]),K={class:`mt-2 dl-callout`},q={__name:`slides.md__slidev_64`,setup(i){let{$slidev:l,$nav:u,$clicksContext:d,$clicks:p,$page:m,$renderContext:g,$frontmatter:_}=x();return d.setup(),(i,l)=>{let u=G,d=C,p=a(`click`);return y(),f(w,v(t(s(S)(s(_),63))),{aside:n(t=>[l[2]||=o(`p`,null,[h(`Press `),o(`strong`,null,`Walk the architecture`),h(` and follow the data: nine steps, no new boxes.`)],-1),r(d,null,{default:n(()=>[...l[0]||=[o(`ul`,null,[o(`li`,null,[h(`up the encoder `),o(`strong`,null,`once`)]),o(`li`,null,[h(`then up the decoder `),o(`strong`,null,`once per word it writes`)]),o(`li`,null,`cross-attention is the only wire between them`)],-1)]]),_:1}),e((y(),c(`div`,K,[...l[1]||=[o(`p`,null,`The famous figure, in the order the data actually moves.`,-1)]])),[[p]])]),default:n(()=>[r(u,{layers:6})]),_:1},16)}}};export{q as default};
|
|
|
|
|
|
lecture-06/assets/md-BtNHnlu_.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_19`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),18))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The sentence we will use all lecture`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[a(`The running example is "the river bank". Each bar chart is one wordβs embedding: four numbers, one bar each. We pretend the four positions mean det (a word like `),n(`em`,null,`the`),a(`), water, money and thing.`)]),n(`li`,null,[n(`em`,null,`the`),a(` = `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[1, 0, 0, 0]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mclose`},`]`)])])]),a(`: only the det bar.`)]),n(`li`,null,[n(`em`,null,`river`),a(` = `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`2`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[0, 2, 0, 1]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mclose`},`]`)])])]),a(`: a thing, and watery.`)]),n(`li`,null,[n(`em`,null,`bank`),a(` = `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`2`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[0, 0, 0, 2]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mclose`},`]`)])])]),a(`: only the thing bar. Its own vector does not say which kind of bank it is.`)]),n(`li`,null,[a(`So the meaning of `),n(`em`,null,`bank`),a(` must come from a neighbour, here `),n(`em`,null,`river`),a(`. Attention is the mechanism that moves it there.`)]),n(`li`,null,`The numbers are chosen by hand, so the arithmetic can be done by hand. Real embeddings have no named axes.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-BtwRUwrk.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_52`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),51))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: The other half of the block`,-1),n(`div`,{class:`dl-describe`},[n(`p`,null,`This covers the feed-forward network (FFN) and its equation.`),n(`ul`,null,[n(`li`,null,[a(`The diagram shows `),n(`em`,null,`the`),a(`, `),n(`em`,null,`river`),a(` and `),n(`em`,null,`bank`),a(`. Each goes up through its own copy of the same small network. The copies share their weights.`)]),n(`li`,null,`There are no arrows between the columns. No token sees another here, because attention already did the mixing.`),n(`li`,null,`The FFN is two linear layers with a ReLU between them. It widens each vector from 512 to 2048 numbers, then narrows it back to 512.`),n(`li`,null,[a(`Worked example: `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mi`,{mathvariant:`bold`},`x`),n(`mo`,null,`=`),n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`2`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`\\mathbf{x} = [1, 2]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.4444em`}}),n(`span`,{class:`mord mathbf`},`x`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mclose`},`]`)])])]),a(` becomes `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mo`,null,`β`),n(`mn`,null,`1`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[1, 1, -1]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`β`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mclose`},`]`)])])]),a(`, then `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[1, 1, 0]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mclose`},`]`)])])]),a(` after ReLU, then `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`2.5`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[2.5, 1]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`2.5`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mclose`},`]`)])])]),a(`.`)])]),n(`p`,null,`Takeaway: attention gathers information; the FFN works on what was gathered.`)],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
lecture-06/assets/md-C0WigTmY2.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_32`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),31))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Why divide by the square root`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,[a(`A score is a dot product: `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)])]),n(`annotation`,{encoding:`application/x-tex`},`d_k`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` products added together. Wider keys give bigger scores, typically growing like `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msqrt`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)])])]),n(`annotation`,{encoding:`application/x-tex`},`\\sqrt{d_k}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.04em`,"vertical-align":`-0.1828em`}}),n(`span`,{class:`mord sqrt`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.8572em`}},[n(`span`,{class:`svg-align`,style:{top:`-3em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])]),n(`span`,{style:{top:`-2.8172em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[n(`path`,{d:`M95,702
|
| 2 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 3 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 4 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 5 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 6 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 7 |
-
l0 -0
|
| 8 |
-
c5.3,-9.3,12,-14,20,-14
|
| 9 |
-
H400000v40H845.2724
|
| 10 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 11 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 12 |
-
M834 80h400000v40h-400000z`})])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.1828em`}},[n(`span`)])])])])])])]),a(`.`)]),n(`li`,null,`The left bars are the softmax of the scores 0, 2, 0: weights 0.11, 0.79, 0.11. The right bars use the same scores eight times bigger, 0, 16, 0. The weights become 0.00, 1.00, 0.00.`),n(`li`,null,[a(`That softmax is `),n(`strong`,null,`saturated`),a(`. Its gradient is almost zero, so the layer stops learning where to look.`)]),n(`li`,null,[a(`The fix is `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`Ξ±`),n(`mrow`,null,[n(`mi`,null,`i`),n(`mi`,null,`j`)])]),n(`mo`,null,`=`),n(`msub`,null,[n(`mrow`,null,[n(`mi`,{mathvariant:`normal`},`softmax`),n(`mo`,null,`β‘`)]),n(`mi`,null,`j`)]),n(`mo`,{stretchy:`false`},`(`),n(`msub`,null,[n(`mi`,{mathvariant:`bold`},`q`),n(`mi`,null,`i`)]),n(`mo`,null,`β
`),n(`msub`,null,[n(`mi`,{mathvariant:`bold`},`k`),n(`mi`,null,`j`)]),n(`mi`,{mathvariant:`normal`},`/`),n(`msqrt`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)])]),n(`mo`,{stretchy:`false`},`)`)]),n(`annotation`,{encoding:`application/x-tex`},`\\alpha_{ij} = \\operatorname{softmax}_j(\\mathbf{q}_i \\cdot \\mathbf{k}_j / \\sqrt{d_k})`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.7167em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.0037em`}},`Ξ±`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3117em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.0037em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0572em`}},`ij`)])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.0361em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mop`},[n(`span`,{class:`mop`},[n(`span`,{class:`mord mathrm`},`softmax`)]),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3117em`}},[n(`span`,{style:{top:`-2.55em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0572em`}},`j`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])]),n(`span`,{class:`mopen`},`(`),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathbf`},`q`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3117em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`i`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}}),n(`span`,{class:`mbin`},`β
`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2222em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.1433em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathbf`},`k`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3117em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0572em`}},`j`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])]),n(`span`,{class:`mord`},`/`),n(`span`,{class:`mord sqrt`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.8572em`}},[n(`span`,{class:`svg-align`,style:{top:`-3em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])]),n(`span`,{style:{top:`-2.8172em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[n(`path`,{d:`M95,702
|
| 13 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 14 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 15 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 16 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 17 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 18 |
-
l0 -0
|
| 19 |
-
c5.3,-9.3,12,-14,20,-14
|
| 20 |
-
H400000v40H845.2724
|
| 21 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 22 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 23 |
-
M834 80h400000v40h-400000z`})])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.1828em`}},[n(`span`)])])])]),n(`span`,{class:`mclose`},`)`)])])]),a(`. Dividing by `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msqrt`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)])])]),n(`annotation`,{encoding:`application/x-tex`},`\\sqrt{d_k}`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.04em`,"vertical-align":`-0.1828em`}}),n(`span`,{class:`mord sqrt`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.8572em`}},[n(`span`,{class:`svg-align`,style:{top:`-3em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])]),n(`span`,{style:{top:`-2.8172em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[n(`path`,{d:`M95,702
|
| 24 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 25 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 26 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 27 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 28 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 29 |
-
l0 -0
|
| 30 |
-
c5.3,-9.3,12,-14,20,-14
|
| 31 |
-
H400000v40H845.2724
|
| 32 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 33 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 34 |
-
M834 80h400000v40h-400000z`})])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.1828em`}},[n(`span`)])])])])])])]),a(` cancels the growth.`)]),n(`li`,null,[a(`For `),n(`em`,null,`bank`),a(` (`),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)]),n(`mo`,null,`=`),n(`mn`,null,`2`)]),n(`annotation`,{encoding:`application/x-tex`},`d_k = 2`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`2`)])])]),a(`): `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mn`,null,`2`),n(`mi`,{mathvariant:`normal`},`/`),n(`msqrt`,null,[n(`mn`,null,`2`)]),n(`mo`,null,`=`),n(`mn`,null,`1.41`)]),n(`annotation`,{encoding:`application/x-tex`},`2 / \\sqrt{2} = 1.41`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1.1572em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mord`},`2/`),n(`span`,{class:`mord sqrt`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.9072em`}},[n(`span`,{class:`svg-align`,style:{top:`-3em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`mord`,style:{"padding-left":`0.833em`}},[n(`span`,{class:`mord`},`2`)])]),n(`span`,{style:{top:`-2.8672em`}},[n(`span`,{class:`pstrut`,style:{height:`3em`}}),n(`span`,{class:`hide-tail`,style:{"min-width":`0.853em`,height:`1.08em`}},[n(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`},[n(`path`,{d:`M95,702
|
| 35 |
-
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
|
| 36 |
-
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
|
| 37 |
-
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
|
| 38 |
-
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
|
| 39 |
-
c69,-144,104.5,-217.7,106.5,-221
|
| 40 |
-
l0 -0
|
| 41 |
-
c5.3,-9.3,12,-14,20,-14
|
| 42 |
-
H400000v40H845.2724
|
| 43 |
-
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
|
| 44 |
-
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
|
| 45 |
-
M834 80h400000v40h-400000z`})])])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.1328em`}},[n(`span`)])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`1.41`)])])]),a(`, and the weight on `),n(`em`,null,`river`),a(` is 0.67.`)]),n(`li`,null,[a(`In the 2017 model, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`d`),n(`mi`,null,`k`)]),n(`mo`,null,`=`),n(`mn`,null,`64`)]),n(`annotation`,{encoding:`application/x-tex`},`d_k = 64`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8444em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`},`d`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3361em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`0em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0315em`}},`k`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])]),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}}),n(`span`,{class:`mrel`},`=`),n(`span`,{class:`mspace`,style:{"margin-right":`0.2778em`}})]),n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.6444em`}}),n(`span`,{class:`mord`},`64`)])])]),a(`, so the divisor is 8.`)])])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lecture-06/assets/md-C126BC2G2.js
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
import{E as e,Q as t,_ as n,_t as r,v as i,x as a,yt as o,z as s}from"./modules/shiki-BFOesOFp.js";import{n as c,t as l}from"./slidev/context-DrkI8qiD.js";import{t as u}from"./default-D0qxH3Ml.js";var d={__name:`slides.md__slidev_29`,setup(d){let{$slidev:f,$nav:p,$clicksContext:m,$clicks:h,$page:g,$renderContext:_,$frontmatter:v}=c();return m.setup(),(c,d)=>(s(),i(u,o(e(r(l)(r(v),28))),{default:t(()=>[...d[0]||=[n(`h1`,null,`In words: Same word, same weights, different neighbour`,-1),n(`div`,{class:`dl-describe`},[n(`ul`,null,[n(`li`,null,`The widget runs the same computation on a second sentence, "the money bank". Only the middle word changed.`),n(`li`,null,[n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`Q`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_Q`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.9694em`,"vertical-align":`-0.2861em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`},`Q`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.2861em`}},[n(`span`)])])])])])])])]),a(`, `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`K`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_K`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.0715em`}},`K`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` and `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`msub`,null,[n(`mi`,null,`W`),n(`mi`,null,`V`)])]),n(`annotation`,{encoding:`application/x-tex`},`W_V`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`0.8333em`,"vertical-align":`-0.15em`}}),n(`span`,{class:`mord`},[n(`span`,{class:`mord mathnormal`,style:{"margin-right":`0.1389em`}},`W`),n(`span`,{class:`msupsub`},[n(`span`,{class:`vlist-t vlist-t2`},[n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.3283em`}},[n(`span`,{style:{top:`-2.55em`,"margin-left":`-0.1389em`,"margin-right":`0.05em`}},[n(`span`,{class:`pstrut`,style:{height:`2.7em`}}),n(`span`,{class:`katex-sizing reset-size6 size3 mtight`},[n(`span`,{class:`mord mathnormal mtight`,style:{"margin-right":`0.2222em`}},`V`)])])]),n(`span`,{class:`vlist-s`},`β`)]),n(`span`,{class:`vlist-r`},[n(`span`,{class:`vlist`,style:{height:`0.15em`}},[n(`span`)])])])])])])])]),a(` are the same. `),n(`em`,null,`bank`),a(`βs embedding is the same, so its query `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[1, 1]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1`),n(`span`,{class:`mclose`},`]`)])])]),a(` is the same.`)]),n(`li`,null,[n(`em`,null,`money`),a(` advertises the money axis: its key is `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`0`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`2`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[0, 2]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`0`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`2`),n(`span`,{class:`mclose`},`]`)])])]),a(`. So `),n(`em`,null,`bank`),a(`βs scores are again 0, 2, 0, and its weights again 0.16, 0.67, 0.16.`)]),n(`li`,null,[a(`But `),n(`em`,null,`money`),a(` hands over a different value. So `),n(`em`,null,`bank`),a(`βs output becomes `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`0.33`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`1.68`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[0.33, 1.68]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`0.33`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`1.68`),n(`span`,{class:`mclose`},`]`)])])]),a(` instead of `),n(`span`,{class:`katex`},[n(`span`,{class:`katex-mathml`},[n(`math`,{xmlns:`http://www.w3.org/1998/Math/MathML`},[n(`semantics`,null,[n(`mrow`,null,[n(`mo`,{stretchy:`false`},`[`),n(`mn`,null,`1.68`),n(`mo`,{separator:`true`},`,`),n(`mn`,null,`0.33`),n(`mo`,{stretchy:`false`},`]`)]),n(`annotation`,{encoding:`application/x-tex`},`[1.68, 0.33]`)])])]),n(`span`,{class:`katex-html`,"aria-hidden":`true`},[n(`span`,{class:`katex-base`},[n(`span`,{class:`katex-strut`,style:{height:`1em`,"vertical-align":`-0.25em`}}),n(`span`,{class:`mopen`},`[`),n(`span`,{class:`mord`},`1.68`),n(`span`,{class:`mpunct`},`,`),n(`span`,{class:`mspace`,style:{"margin-right":`0.1667em`}}),n(`span`,{class:`mord`},`0.33`),n(`span`,{class:`mclose`},`]`)])])]),a(`.`)]),n(`li`,null,`The meaning of a word is not stored in the word. The layer builds it from the neighbours, separately in each sentence.`)])],-1)]]),_:1},16))}};export{d as default};
|
|
|
|
|
|