Buckets:
| import{s as oe,n as he,o as pe}from"../chunks/scheduler.f3b1e791.js";import{S as de,i as me,e as i,s as n,c as h,h as fe,a as s,d as a,b as l,f as ie,g as p,j as P,k as se,l as ce,m as r,n as d,t as m,o as f,p as c}from"../chunks/index.023a9934.js";import{C as ue}from"../chunks/CopyLLMTxtMenu.c780467c.js";import{H as C,E as we}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.fb377ec3.js";function $e(X){let o,A,E,I,u,S,w,j,$,W,y,B,g,Z=`In earlier versions of <code>kernels</code>, a layer’s <code>forward</code> method was replaced | |
| by <a href="/docs/kernels/pr_607/en/api/layers#kernels.use_kernel_forward_from_hub">use_kernel_forward_from_hub()</a> and <a href="/docs/kernels/pr_607/en/api/layers#kernels.replace_kernel_forward_from_hub">replace_kernel_forward_from_hub()</a>. | |
| 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.`,F,k,ee=`To avoid branching, we have to make dispatch decisions ahead of time, | |
| which is what the <a href="/docs/kernels/pr_607/en/api/layers#kernels.kernelize">kernelize()</a> function does.`,K,_,Q,b,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 <a href="/docs/kernels/pr_607/en/api/layers#kernels.kernelize">kernelize()</a>d again with different options.`,R,v,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 <a href="/docs/kernels/pr_607/en/api/layers#kernels.kernelize">kernelize()</a>-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,re=`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,ne=`By default, we collect telemetry when a call to <a href="/docs/kernels/pr_607/en/api/kernels#kernels.get_kernel">get_kernel()</a> is made. | |
| This only includes the <code>kernels</code> version, <code>torch</code> version, and the build | |
| information for the kernel being requested.`,U,z,le="You can disable this by setting <code>export DISABLE_TELEMETRY=yes</code>.",J,L,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"}}),_=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"}}),L=new we({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/faq.md"}}),{c(){o=i("meta"),A=n(),E=i("p"),I=n(),h(u.$$.fragment),S=n(),h(w.$$.fragment),j=n(),h($.$$.fragment),W=n(),h(y.$$.fragment),B=n(),g=i("p"),g.innerHTML=Z,F=n(),k=i("p"),k.innerHTML=ee,K=n(),h(_.$$.fragment),Q=n(),b=i("p"),b.innerHTML=te,R=n(),v=i("p"),v.innerHTML=ae,Y=n(),T=i("p"),T.innerHTML=re,D=n(),h(H.$$.fragment),G=n(),h(M.$$.fragment),O=n(),x=i("p"),x.innerHTML=ne,U=n(),z=i("p"),z.innerHTML=le,J=n(),h(L.$$.fragment),N=n(),q=i("p"),this.h()},l(e){const t=fe("svelte-u9bgzb",document.head);o=s(t,"META",{name:!0,content:!0}),t.forEach(a),A=l(e),E=s(e,"P",{}),ie(E).forEach(a),I=l(e),p(u.$$.fragment,e),S=l(e),p(w.$$.fragment,e),j=l(e),p($.$$.fragment,e),W=l(e),p(y.$$.fragment,e),B=l(e),g=s(e,"P",{"data-svelte-h":!0}),P(g)!=="svelte-1cq1v7j"&&(g.innerHTML=Z),F=l(e),k=s(e,"P",{"data-svelte-h":!0}),P(k)!=="svelte-zrhxkz"&&(k.innerHTML=ee),K=l(e),p(_.$$.fragment,e),Q=l(e),b=s(e,"P",{"data-svelte-h":!0}),P(b)!=="svelte-109zhfj"&&(b.innerHTML=te),R=l(e),v=s(e,"P",{"data-svelte-h":!0}),P(v)!=="svelte-1q9sshw"&&(v.innerHTML=ae),Y=l(e),T=s(e,"P",{"data-svelte-h":!0}),P(T)!=="svelte-1hx872b"&&(T.innerHTML=re),D=l(e),p(H.$$.fragment,e),G=l(e),p(M.$$.fragment,e),O=l(e),x=s(e,"P",{"data-svelte-h":!0}),P(x)!=="svelte-zylftb"&&(x.innerHTML=ne),U=l(e),z=s(e,"P",{"data-svelte-h":!0}),P(z)!=="svelte-fo6nkj"&&(z.innerHTML=le),J=l(e),p(L.$$.fragment,e),N=l(e),q=s(e,"P",{}),ie(q).forEach(a),this.h()},h(){se(o,"name","hf:doc:metadata"),se(o,"content",ye)},m(e,t){ce(document.head,o),r(e,A,t),r(e,E,t),r(e,I,t),d(u,e,t),r(e,S,t),d(w,e,t),r(e,j,t),d($,e,t),r(e,W,t),d(y,e,t),r(e,B,t),r(e,g,t),r(e,F,t),r(e,k,t),r(e,K,t),d(_,e,t),r(e,Q,t),r(e,b,t),r(e,R,t),r(e,v,t),r(e,Y,t),r(e,T,t),r(e,D,t),d(H,e,t),r(e,G,t),d(M,e,t),r(e,O,t),r(e,x,t),r(e,U,t),r(e,z,t),r(e,J,t),d(L,e,t),r(e,N,t),r(e,q,t),V=!0},p:he,i(e){V||(m(u.$$.fragment,e),m(w.$$.fragment,e),m($.$$.fragment,e),m(y.$$.fragment,e),m(_.$$.fragment,e),m(H.$$.fragment,e),m(M.$$.fragment,e),m(L.$$.fragment,e),V=!0)},o(e){f(u.$$.fragment,e),f(w.$$.fragment,e),f($.$$.fragment,e),f(y.$$.fragment,e),f(_.$$.fragment,e),f(H.$$.fragment,e),f(M.$$.fragment,e),f(L.$$.fragment,e),V=!1},d(e){e&&(a(A),a(E),a(I),a(S),a(j),a(W),a(B),a(g),a(F),a(k),a(K),a(Q),a(b),a(R),a(v),a(Y),a(T),a(D),a(G),a(O),a(x),a(U),a(z),a(J),a(N),a(q)),a(o),c(u,e),c(w,e),c($,e),c(y,e),c(_,e),c(H,e),c(M,e),c(L,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 pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Te extends de{constructor(o){super(),me(this,o,ge,$e,oe,{})}}export{Te as component}; | |
Xet Storage Details
- Size:
- 7.27 kB
- Xet hash:
- adc7e7e07f4c28381edc3a3efd8f8d92c5bf7e641e164831419d9bd82ab78f30
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.