import{s as he,n as ye,o as ke}from"../chunks/scheduler.f3b1e791.js";import{S as ge,i as we,e as $,s,c as r,h as be,a as c,d as l,b as a,f as ce,g as m,j as B,k as ue,l as Me,m as n,n as i,t as p,o as d,p as o}from"../chunks/index.023a9934.js";import{C as Te}from"../chunks/CopyLLMTxtMenu.ee636735.js";import{C as re}from"../chunks/CodeBlock.5aa52fca.js";import{H as L,E as Je}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.9b009efe.js";function Ce(me){let f,H,E,R,u,X,h,S,y,ie="The <code>kernels</code> CLI provides commands for managing compute kernels.",q,k,z,g,pe='<thead><tr><th>Command</th> <th>Description</th></tr></thead> <tbody><tr><td><a href="cli-upload">upload</a></td> <td>Upload kernels to the Hub</td></tr> <tr><td><a href="cli-benchmark">benchmark</a></td> <td>Run benchmark results for a kernel</td></tr> <tr><td><a href="cli-check">check</a></td> <td>Check a kernel for compliance</td></tr> <tr><td><a href="cli-versions">versions</a></td> <td>Show kernel versions</td></tr> <tr><td><a href="cli-lock">lock</a></td> <td>Lock kernel revisions</td></tr> <tr><td><a href="cli-download">download</a></td> <td>Download locked kernels</td></tr> <tr><td><a href="cli-skills-add">skills</a></td> <td>Add skills for AI coding assistants</td></tr></tbody>',P,w,Q,b,de=`For building and writing kernels, please refer <a href="./builder/build">building kernels</a> and
<a href="./builder/writing-kernels">writing kernels</a>.`,W,M,A,T,D,J,F,C,oe="or",K,U,Y,j,fe="Add to <code>pyproject.toml</code>:",N,V,O,_,$e="Then lock and download:",ee,v,te,x,le,G,ne,I,se,Z,ae;return u=new Te({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),h=new L({props:{title:"Kernels CLI Reference",local:"kernels-cli-reference",headingTag:"h1"}}),k=new L({props:{title:"Commands",local:"commands",headingTag:"h2"}}),w=new L({props:{title:"Quick Start",local:"quick-start",headingTag:"h2"}}),M=new L({props:{title:"Use kernels in your project",local:"use-kernels-in-your-project",headingTag:"h3"}}),T=new L({props:{title:"Directly from the Hub",local:"directly-from-the-hub",headingTag:"h4"}}),J=new re({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFmcm9tJTIwa2VybmVscyUyMGltcG9ydCUyMGdldF9rZXJuZWwlMEElMEElMjMlMjBEb3dubG9hZCUyMG9wdGltaXplZCUyMGtlcm5lbHMlMjBmcm9tJTIwdGhlJTIwSHVnZ2luZyUyMEZhY2UlMjBodWIlMEFteV9rZXJuZWwlMjAlM0QlMjBnZXRfa2VybmVsKCUyMm15LXVzZXJuYW1lJTJGbXkta2VybmVsJTIyJTJDJTIwdmVyc2lvbiUzRDEpJTBBJTBBJTIzJTIwUmFuZG9tJTIwdGVuc29yJTBBeCUyMCUzRCUyMHRvcmNoLnJhbmRuKCgxMCUyQyUyMDEwKSUyQyUyMGR0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMGRldmljZSUzRCUyMmN1ZGElMjIpJTBBJTBBJTIzJTIwUnVuJTIwdGhlJTIwa2VybmVsJTBBeSUyMCUzRCUyMHRvcmNoLmVtcHR5X2xpa2UoeCklMEFteV9rZXJuZWwubXlfa2VybmVsX2Z1bmN0aW9uKHklMkMlMjB4KSUwQSUwQXByaW50KHkp",highlighted:`<span class="hljs-keyword">import</span> torch

<span class="hljs-keyword">from</span> kernels <span class="hljs-keyword">import</span> get_kernel

<span class="hljs-comment"># Download optimized kernels from the Hugging Face hub</span>
my_kernel = get_kernel(<span class="hljs-string">&quot;my-username/my-kernel&quot;</span>, version=<span class="hljs-number">1</span>)

<span class="hljs-comment"># Random tensor</span>
x = torch.randn((<span class="hljs-number">10</span>, <span class="hljs-number">10</span>), dtype=torch.float16, device=<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># Run the kernel</span>
y = torch.empty_like(x)
my_kernel.my_kernel_function(y, x)

<span class="hljs-built_in">print</span>(y)`,wrap:!1}}),U=new L({props:{title:"Locked and downloaded",local:"locked-and-downloaded",headingTag:"h4"}}),V=new re({props:{code:"JTVCdG9vbC5rZXJuZWxzLmRlcGVuZGVuY2llcyU1RCUwQSUyMm15LXVzZXJuYW1lJTJGbXkta2VybmVsJTIyJTIwJTNEJTIwJTIyMSUyMg==",highlighted:`<span class="hljs-section">[tool.kernels.dependencies]</span>
<span class="hljs-attr">&quot;my-username/my-kernel&quot;</span> = <span class="hljs-string">&quot;1&quot;</span>`,wrap:!1}}),v=new re({props:{code:"a2VybmVscyUyMGxvY2slMjAuJTBBa2VybmVscyUyMGRvd25sb2FkJTIwLg==",highlighted:`kernels lock .
kernels download .`,wrap:!1}}),x=new L({props:{title:"See help",local:"see-help",headingTag:"h3"}}),G=new re({props:{code:"a2VybmVscyUyMC0taGVscA==",highlighted:'kernels --<span class="hljs-built_in">help</span>',wrap:!1}}),I=new Je({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/cli.md"}}),{c(){f=$("meta"),H=s(),E=$("p"),R=s(),r(u.$$.fragment),X=s(),r(h.$$.fragment),S=s(),y=$("p"),y.innerHTML=ie,q=s(),r(k.$$.fragment),z=s(),g=$("table"),g.innerHTML=pe,P=s(),r(w.$$.fragment),Q=s(),b=$("p"),b.innerHTML=de,W=s(),r(M.$$.fragment),A=s(),r(T.$$.fragment),D=s(),r(J.$$.fragment),F=s(),C=$("p"),C.textContent=oe,K=s(),r(U.$$.fragment),Y=s(),j=$("p"),j.innerHTML=fe,N=s(),r(V.$$.fragment),O=s(),_=$("p"),_.textContent=$e,ee=s(),r(v.$$.fragment),te=s(),r(x.$$.fragment),le=s(),r(G.$$.fragment),ne=s(),r(I.$$.fragment),se=s(),Z=$("p"),this.h()},l(e){const t=be("svelte-u9bgzb",document.head);f=c(t,"META",{name:!0,content:!0}),t.forEach(l),H=a(e),E=c(e,"P",{}),ce(E).forEach(l),R=a(e),m(u.$$.fragment,e),X=a(e),m(h.$$.fragment,e),S=a(e),y=c(e,"P",{"data-svelte-h":!0}),B(y)!=="svelte-1io9ppu"&&(y.innerHTML=ie),q=a(e),m(k.$$.fragment,e),z=a(e),g=c(e,"TABLE",{"data-svelte-h":!0}),B(g)!=="svelte-ujdr0g"&&(g.innerHTML=pe),P=a(e),m(w.$$.fragment,e),Q=a(e),b=c(e,"P",{"data-svelte-h":!0}),B(b)!=="svelte-10ijoq"&&(b.innerHTML=de),W=a(e),m(M.$$.fragment,e),A=a(e),m(T.$$.fragment,e),D=a(e),m(J.$$.fragment,e),F=a(e),C=c(e,"P",{"data-svelte-h":!0}),B(C)!=="svelte-93sdsf"&&(C.textContent=oe),K=a(e),m(U.$$.fragment,e),Y=a(e),j=c(e,"P",{"data-svelte-h":!0}),B(j)!=="svelte-13nrsm7"&&(j.innerHTML=fe),N=a(e),m(V.$$.fragment,e),O=a(e),_=c(e,"P",{"data-svelte-h":!0}),B(_)!=="svelte-dqzxtl"&&(_.textContent=$e),ee=a(e),m(v.$$.fragment,e),te=a(e),m(x.$$.fragment,e),le=a(e),m(G.$$.fragment,e),ne=a(e),m(I.$$.fragment,e),se=a(e),Z=c(e,"P",{}),ce(Z).forEach(l),this.h()},h(){ue(f,"name","hf:doc:metadata"),ue(f,"content",Ue)},m(e,t){Me(document.head,f),n(e,H,t),n(e,E,t),n(e,R,t),i(u,e,t),n(e,X,t),i(h,e,t),n(e,S,t),n(e,y,t),n(e,q,t),i(k,e,t),n(e,z,t),n(e,g,t),n(e,P,t),i(w,e,t),n(e,Q,t),n(e,b,t),n(e,W,t),i(M,e,t),n(e,A,t),i(T,e,t),n(e,D,t),i(J,e,t),n(e,F,t),n(e,C,t),n(e,K,t),i(U,e,t),n(e,Y,t),n(e,j,t),n(e,N,t),i(V,e,t),n(e,O,t),n(e,_,t),n(e,ee,t),i(v,e,t),n(e,te,t),i(x,e,t),n(e,le,t),i(G,e,t),n(e,ne,t),i(I,e,t),n(e,se,t),n(e,Z,t),ae=!0},p:ye,i(e){ae||(p(u.$$.fragment,e),p(h.$$.fragment,e),p(k.$$.fragment,e),p(w.$$.fragment,e),p(M.$$.fragment,e),p(T.$$.fragment,e),p(J.$$.fragment,e),p(U.$$.fragment,e),p(V.$$.fragment,e),p(v.$$.fragment,e),p(x.$$.fragment,e),p(G.$$.fragment,e),p(I.$$.fragment,e),ae=!0)},o(e){d(u.$$.fragment,e),d(h.$$.fragment,e),d(k.$$.fragment,e),d(w.$$.fragment,e),d(M.$$.fragment,e),d(T.$$.fragment,e),d(J.$$.fragment,e),d(U.$$.fragment,e),d(V.$$.fragment,e),d(v.$$.fragment,e),d(x.$$.fragment,e),d(G.$$.fragment,e),d(I.$$.fragment,e),ae=!1},d(e){e&&(l(H),l(E),l(R),l(X),l(S),l(y),l(q),l(z),l(g),l(P),l(Q),l(b),l(W),l(A),l(D),l(F),l(C),l(K),l(Y),l(j),l(N),l(O),l(_),l(ee),l(te),l(le),l(ne),l(se),l(Z)),l(f),o(u,e),o(h,e),o(k,e),o(w,e),o(M,e),o(T,e),o(J,e),o(U,e),o(V,e),o(v,e),o(x,e),o(G,e),o(I,e)}}}const Ue='{"title":"Kernels CLI Reference","local":"kernels-cli-reference","sections":[{"title":"Commands","local":"commands","sections":[],"depth":2},{"title":"Quick Start","local":"quick-start","sections":[{"title":"Use kernels in your project","local":"use-kernels-in-your-project","sections":[{"title":"Directly from the Hub","local":"directly-from-the-hub","sections":[],"depth":4},{"title":"Locked and downloaded","local":"locked-and-downloaded","sections":[],"depth":4}],"depth":3},{"title":"See help","local":"see-help","sections":[],"depth":3}],"depth":2}],"depth":1}';function je(me){return ke(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ie extends ge{constructor(f){super(),we(this,f,je,Ce,he,{})}}export{Ie as component};
