Buckets:
| import{s as oe,n as de,o as he}from"../chunks/scheduler.f3b1e791.js";import{S as pe,i as ce,e as r,s as i,c as d,h as me,a as s,d as a,b as l,f as re,g as h,j as P,k as se,l as fe,m as n,n as p,t as c,o as m,p as f}from"../chunks/index.023a9934.js";import{C as ue}from"../chunks/CopyLLMTxtMenu.50a4d06c.js";import{H as C,E as we}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.0b509b2e.js";function $e(X){let o,A,E,I,u,S,w,W,$,B,y,F,g,Z=`In earlier versions of <code>kernels</code>, a layer’s <code>forward</code> method was replaced | |
| by <code>use_kernel_forward_from_hub</code> and <code>replace_kernel_forward_from_hub</code>. | |
| The new <code>forward</code> would dispatch to a kernel based on the device type, | |
| whether a model was training, etc. However, this approach was | |
| fundamentally incompatible with <code>torch.compile</code> since it relied | |
| on data-dependent branching.`,j,b,ee=`To avoid branching, we have to make dispatch decisions ahead of time, | |
| which is what the <code>kernelize</code> function does.`,K,v,Q,k,te=`There are some other possible approaches. The first is to completely | |
| replace existing layers by kernel layers. However, since this would | |
| permit free-form layer classes, it would be much harder to validate | |
| that layers are fully compatible with the layers that they are | |
| replacing. For instance, they could have completely different member | |
| variables. Besides that, we would also need to hold on to the original | |
| layers, in case we need to revert to the base layers when the model | |
| is <code>kernelize</code>d again with different options.`,R,_,ae=`A second approach would be to make an auxiliary layer that wraps the | |
| original layer and the kernel layer and dispatches to the kernel layer. | |
| This wouldn’t have the issues of the first approach, because kernel layers | |
| could be similarly strict as they are now, and we would still have access | |
| to the original layers when <code>kernelize</code>-ing the model again. However, | |
| this would change the graph structure of the model and would break use | |
| cases where programs access the model internals (e.g. | |
| <code>model.layers[0].attention.query_weight</code>) or rely on the graph structure | |
| in other ways.`,Y,T,ne=`The approach of <code>forward</code>-replacement is the least invasive, because | |
| it preserves the original model graph. It is also reversible, since | |
| even though the <code>forward</code> of a layer <em>instance</em> might be replaced, | |
| the corresponding class still has the original <code>forward</code>.`,D,H,G,M,O,x,ie=`By default, we collect telemetry when a call to <code>get_kernel()</code> is made. | |
| This only includes the <code>kernels</code> version, <code>torch</code> version, and the build | |
| information for the kernel being requested.`,U,L,le="You can disable this by setting <code>export DISABLE_TELEMETRY=yes</code>.",J,z,N,q,V;return u=new ue({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),w=new C({props:{title:"FAQ",local:"faq",headingTag:"h1"}}),$=new C({props:{title:"Kernel layers",local:"kernel-layers",headingTag:"h2"}}),y=new C({props:{title:"Why is the kernelization step needed as a separate step?",local:"why-is-the-kernelization-step-needed-as-a-separate-step",headingTag:"h3"}}),v=new C({props:{title:"Why does kernelization only replace forward methods?",local:"why-does-kernelization-only-replace-forward-methods",headingTag:"h3"}}),H=new C({props:{title:"Misc",local:"misc",headingTag:"h2"}}),M=new C({props:{title:"How can I disable kernel reporting in the user-agent?",local:"how-can-i-disable-kernel-reporting-in-the-user-agent",headingTag:"h3"}}),z=new we({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/faq.md"}}),{c(){o=r("meta"),A=i(),E=r("p"),I=i(),d(u.$$.fragment),S=i(),d(w.$$.fragment),W=i(),d($.$$.fragment),B=i(),d(y.$$.fragment),F=i(),g=r("p"),g.innerHTML=Z,j=i(),b=r("p"),b.innerHTML=ee,K=i(),d(v.$$.fragment),Q=i(),k=r("p"),k.innerHTML=te,R=i(),_=r("p"),_.innerHTML=ae,Y=i(),T=r("p"),T.innerHTML=ne,D=i(),d(H.$$.fragment),G=i(),d(M.$$.fragment),O=i(),x=r("p"),x.innerHTML=ie,U=i(),L=r("p"),L.innerHTML=le,J=i(),d(z.$$.fragment),N=i(),q=r("p"),this.h()},l(e){const t=me("svelte-u9bgzb",document.head);o=s(t,"META",{name:!0,content:!0}),t.forEach(a),A=l(e),E=s(e,"P",{}),re(E).forEach(a),I=l(e),h(u.$$.fragment,e),S=l(e),h(w.$$.fragment,e),W=l(e),h($.$$.fragment,e),B=l(e),h(y.$$.fragment,e),F=l(e),g=s(e,"P",{"data-svelte-h":!0}),P(g)!=="svelte-s0bxyo"&&(g.innerHTML=Z),j=l(e),b=s(e,"P",{"data-svelte-h":!0}),P(b)!=="svelte-79i1mq"&&(b.innerHTML=ee),K=l(e),h(v.$$.fragment,e),Q=l(e),k=s(e,"P",{"data-svelte-h":!0}),P(k)!=="svelte-146yl4c"&&(k.innerHTML=te),R=l(e),_=s(e,"P",{"data-svelte-h":!0}),P(_)!=="svelte-q9to15"&&(_.innerHTML=ae),Y=l(e),T=s(e,"P",{"data-svelte-h":!0}),P(T)!=="svelte-1hx872b"&&(T.innerHTML=ne),D=l(e),h(H.$$.fragment,e),G=l(e),h(M.$$.fragment,e),O=l(e),x=s(e,"P",{"data-svelte-h":!0}),P(x)!=="svelte-hypnfi"&&(x.innerHTML=ie),U=l(e),L=s(e,"P",{"data-svelte-h":!0}),P(L)!=="svelte-fo6nkj"&&(L.innerHTML=le),J=l(e),h(z.$$.fragment,e),N=l(e),q=s(e,"P",{}),re(q).forEach(a),this.h()},h(){se(o,"name","hf:doc:metadata"),se(o,"content",ye)},m(e,t){fe(document.head,o),n(e,A,t),n(e,E,t),n(e,I,t),p(u,e,t),n(e,S,t),p(w,e,t),n(e,W,t),p($,e,t),n(e,B,t),p(y,e,t),n(e,F,t),n(e,g,t),n(e,j,t),n(e,b,t),n(e,K,t),p(v,e,t),n(e,Q,t),n(e,k,t),n(e,R,t),n(e,_,t),n(e,Y,t),n(e,T,t),n(e,D,t),p(H,e,t),n(e,G,t),p(M,e,t),n(e,O,t),n(e,x,t),n(e,U,t),n(e,L,t),n(e,J,t),p(z,e,t),n(e,N,t),n(e,q,t),V=!0},p:de,i(e){V||(c(u.$$.fragment,e),c(w.$$.fragment,e),c($.$$.fragment,e),c(y.$$.fragment,e),c(v.$$.fragment,e),c(H.$$.fragment,e),c(M.$$.fragment,e),c(z.$$.fragment,e),V=!0)},o(e){m(u.$$.fragment,e),m(w.$$.fragment,e),m($.$$.fragment,e),m(y.$$.fragment,e),m(v.$$.fragment,e),m(H.$$.fragment,e),m(M.$$.fragment,e),m(z.$$.fragment,e),V=!1},d(e){e&&(a(A),a(E),a(I),a(S),a(W),a(B),a(F),a(g),a(j),a(b),a(K),a(Q),a(k),a(R),a(_),a(Y),a(T),a(D),a(G),a(O),a(x),a(U),a(L),a(J),a(N),a(q)),a(o),f(u,e),f(w,e),f($,e),f(y,e),f(v,e),f(H,e),f(M,e),f(z,e)}}}const ye='{"title":"FAQ","local":"faq","sections":[{"title":"Kernel layers","local":"kernel-layers","sections":[{"title":"Why is the kernelization step needed as a separate step?","local":"why-is-the-kernelization-step-needed-as-a-separate-step","sections":[],"depth":3},{"title":"Why does kernelization only replace forward methods?","local":"why-does-kernelization-only-replace-forward-methods","sections":[],"depth":3}],"depth":2},{"title":"Misc","local":"misc","sections":[{"title":"How can I disable kernel reporting in the user-agent?","local":"how-can-i-disable-kernel-reporting-in-the-user-agent","sections":[],"depth":3}],"depth":2}],"depth":1}';function ge(X){return he(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends pe{constructor(o){super(),ce(this,o,ge,$e,oe,{})}}export{Te as component}; | |
Xet Storage Details
- Size:
- 6.9 kB
- Xet hash:
- 027d4c0e7dd36939411ef32993b15df9876b376051032e54e584af29aefd72e2
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.