import{s as fe,n as me,o as pe}from"../chunks/scheduler.f3b1e791.js";import{S as ue,i as he,e as s,s as a,c as x,h as ge,a as l,d as n,b as i,f as le,g as y,j as f,k as oe,l as ce,m as r,n as M,t as H,o as C,p as P}from"../chunks/index.023a9934.js";import{C as de}from"../chunks/CopyLLMTxtMenu.ee636735.js";import{H as E,E as $e}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.9b009efe.js";function be(X){let o,j,A,R,m,S,p,q,u,Z="This page shows how different projects use <code>kernels</code>.",I,h,F,g,ee=`<a href="https://github.com/karpathy/autoresearch" rel="nofollow">karpathy/autoresearch</a> <a href="https://github.com/karpathy/autoresearch/blob/c2450add72cc80317be1fe8111974b892da10944/train.py#L23" rel="nofollow">uses</a> <code>kernels</code> to
integrate Flash-Attention 3 through the <code>get_kernes()</code> method.`,O,c,U,d,te=`<a href="https://github.com/inclusionAI/AReaL" rel="nofollow">inclusionAI/AReaL</a> uses <code>kernels</code> in an opt-in manner to integrate
optimized attention mechanisms.`,B,$,G,b,ne=`<a href="https://github.com/huggingface/transformers/" rel="nofollow">huggingface/transformers</a> primarily
depends on <code>kernels</code> for all optimizations related to optimized kernels, including
optimized attention implementations, MoE blocks, and quantization. Besides
<code>get_kernel()</code>, it also uses <a href="./layers">kernel layers</a> to optimize the forward passes
of common layers involved in the modeling blocks. Some references are available
<a href="https://github.com/search?q=repo%3Ahuggingface%2Ftransformers%20get_kernel(&amp;type=code" rel="nofollow">here</a>
and <a href="https://github.com/search?q=repo%3Ahuggingface%2Ftransformers+use_kernel_forward_from_hub&amp;type=code" rel="nofollow">here</a>.`,V,k,re="Refer to the following posts to know more:",Y,_,ae='<li><a href="https://huggingface.co/blog/faster-transformers" rel="nofollow">Tricks from OpenAI gpt-oss YOU 🫵 can use with transformers</a></li> <li><a href="https://huggingface.co/blog/moe-transformers" rel="nofollow">Mixture of Experts (MoEs) in Transformers</a></li>',D,w,J,v,ie=`Similar to <code>transformers</code>, <a href="https://github.com/huggingface/diffusers/" rel="nofollow">huggingface/diffusers</a> uses
<code>kernels</code> for integrating optimized kernels to <a href="https://github.com/huggingface/diffusers/blob/e5aa719241f9b74d6700be3320a777799bfab70a/src/diffusers/models/attention_dispatch.py" rel="nofollow">compute attention</a>.`,K,T,se=`Besides leveraging pre-built compute kernels, different projects
rely on <code>kernels</code> to also package, build, and distribute their
kernels on the Hugging Face Hub platform. This is made possible by the
<a href="./builder/writing-kernels">“builder” component of <code>kernels</code></a>.
Visit <a href="https://huggingface.co/models?other=kernels" rel="nofollow">this page</a> to find out
different pre-built compute kernels available on the Hub.`,N,L,Q,z,W;return m=new de({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new E({props:{title:"Integrating kernels",local:"integrating-kernels",headingTag:"h1"}}),h=new E({props:{title:"autoresearch",local:"autoresearch",headingTag:"h2"}}),c=new E({props:{title:"AReaL",local:"areal",headingTag:"h2"}}),$=new E({props:{title:"transformers",local:"transformers",headingTag:"h2"}}),w=new E({props:{title:"diffusers",local:"diffusers",headingTag:"h2"}}),L=new $e({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/integrating-kernels.md"}}),{c(){o=s("meta"),j=a(),A=s("p"),R=a(),x(m.$$.fragment),S=a(),x(p.$$.fragment),q=a(),u=s("p"),u.innerHTML=Z,I=a(),x(h.$$.fragment),F=a(),g=s("p"),g.innerHTML=ee,O=a(),x(c.$$.fragment),U=a(),d=s("p"),d.innerHTML=te,B=a(),x($.$$.fragment),G=a(),b=s("p"),b.innerHTML=ne,V=a(),k=s("p"),k.textContent=re,Y=a(),_=s("ul"),_.innerHTML=ae,D=a(),x(w.$$.fragment),J=a(),v=s("p"),v.innerHTML=ie,K=a(),T=s("p"),T.innerHTML=se,N=a(),x(L.$$.fragment),Q=a(),z=s("p"),this.h()},l(e){const t=ge("svelte-u9bgzb",document.head);o=l(t,"META",{name:!0,content:!0}),t.forEach(n),j=i(e),A=l(e,"P",{}),le(A).forEach(n),R=i(e),y(m.$$.fragment,e),S=i(e),y(p.$$.fragment,e),q=i(e),u=l(e,"P",{"data-svelte-h":!0}),f(u)!=="svelte-vnl8ty"&&(u.innerHTML=Z),I=i(e),y(h.$$.fragment,e),F=i(e),g=l(e,"P",{"data-svelte-h":!0}),f(g)!=="svelte-3o1zl0"&&(g.innerHTML=ee),O=i(e),y(c.$$.fragment,e),U=i(e),d=l(e,"P",{"data-svelte-h":!0}),f(d)!=="svelte-14i6hd3"&&(d.innerHTML=te),B=i(e),y($.$$.fragment,e),G=i(e),b=l(e,"P",{"data-svelte-h":!0}),f(b)!=="svelte-13o2le2"&&(b.innerHTML=ne),V=i(e),k=l(e,"P",{"data-svelte-h":!0}),f(k)!=="svelte-58vqvj"&&(k.textContent=re),Y=i(e),_=l(e,"UL",{"data-svelte-h":!0}),f(_)!=="svelte-ixjige"&&(_.innerHTML=ae),D=i(e),y(w.$$.fragment,e),J=i(e),v=l(e,"P",{"data-svelte-h":!0}),f(v)!=="svelte-4wljk1"&&(v.innerHTML=ie),K=i(e),T=l(e,"P",{"data-svelte-h":!0}),f(T)!=="svelte-1cxddfs"&&(T.innerHTML=se),N=i(e),y(L.$$.fragment,e),Q=i(e),z=l(e,"P",{}),le(z).forEach(n),this.h()},h(){oe(o,"name","hf:doc:metadata"),oe(o,"content",ke)},m(e,t){ce(document.head,o),r(e,j,t),r(e,A,t),r(e,R,t),M(m,e,t),r(e,S,t),M(p,e,t),r(e,q,t),r(e,u,t),r(e,I,t),M(h,e,t),r(e,F,t),r(e,g,t),r(e,O,t),M(c,e,t),r(e,U,t),r(e,d,t),r(e,B,t),M($,e,t),r(e,G,t),r(e,b,t),r(e,V,t),r(e,k,t),r(e,Y,t),r(e,_,t),r(e,D,t),M(w,e,t),r(e,J,t),r(e,v,t),r(e,K,t),r(e,T,t),r(e,N,t),M(L,e,t),r(e,Q,t),r(e,z,t),W=!0},p:me,i(e){W||(H(m.$$.fragment,e),H(p.$$.fragment,e),H(h.$$.fragment,e),H(c.$$.fragment,e),H($.$$.fragment,e),H(w.$$.fragment,e),H(L.$$.fragment,e),W=!0)},o(e){C(m.$$.fragment,e),C(p.$$.fragment,e),C(h.$$.fragment,e),C(c.$$.fragment,e),C($.$$.fragment,e),C(w.$$.fragment,e),C(L.$$.fragment,e),W=!1},d(e){e&&(n(j),n(A),n(R),n(S),n(q),n(u),n(I),n(F),n(g),n(O),n(U),n(d),n(B),n(G),n(b),n(V),n(k),n(Y),n(_),n(D),n(J),n(v),n(K),n(T),n(N),n(Q),n(z)),n(o),P(m,e),P(p,e),P(h,e),P(c,e),P($,e),P(w,e),P(L,e)}}}const ke='{"title":"Integrating kernels","local":"integrating-kernels","sections":[{"title":"autoresearch","local":"autoresearch","sections":[],"depth":2},{"title":"AReaL","local":"areal","sections":[],"depth":2},{"title":"transformers","local":"transformers","sections":[],"depth":2},{"title":"diffusers","local":"diffusers","sections":[],"depth":2}],"depth":1}';function _e(X){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xe extends ue{constructor(o){super(),he(this,o,_e,be,fe,{})}}export{xe as component};
