Buckets:
| import{s as Ds,n as st,o as tt}from"../chunks/scheduler.f3b1e791.js";import{S as et,i as lt,e as i,s as n,c,h as nt,a as o,d as e,b as a,f as Ks,g as p,j as r,k as z,l as at,m as l,n as M,t as d,o as h,p as u}from"../chunks/index.023a9934.js";import{C as it,H as X,E as ot}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.6f5bdbef.js";import{C as Hs}from"../chunks/CodeBlock.4080e84a.js";function rt(Es){let j,O,q,K,U,D,m,ss,b,$s='Compiling a kernel is CPU-intensive and testing it requires an accelerator (such as a GPU), two things that GitHub’s standard runners do not provide cheaply. Instead of maintaining self-hosted runners, you can offload both steps to <a href="https://huggingface.co/docs/huggingface_hub/guides/jobs" rel="nofollow">Hugging Face Jobs</a> directly from a GitHub Actions workflow.',ts,g,Gs="Two prebuilt actions make this possible:",es,I,xs='<li><a href="https://github.com/huggingface/kernel-builder-job" rel="nofollow"><code>huggingface/kernel-builder-job</code></a> runs the Nix kernel builder on a CPU flavor and publishes the built kernel to the Hub.</li> <li><a href="https://github.com/huggingface/hf-jobs-action" rel="nofollow"><code>huggingface/hf-jobs-action</code></a> runs an arbitrary script on any flavor (including GPUs), which is convenient for testing the kernel you just built. This also helps to test the kernel across different hardware.</li>',ls,C,Ss="A typical setup has two workflows: one that <strong>builds</strong> the kernel on push, and one that <strong>tests</strong> it on a GPU. They communicate through the Hub, the build uploads artifacts, the test pulls them back down.",ns,f,as,A,Qs='<li>An <a href="https://huggingface.co/settings/tokens" rel="nofollow">HF access token</a> with the <code>job.write</code> permission. If the test job loads gated models, the token also needs read access to them.</li> <li>The token stored as a repository secret named <code>HF_TOKEN</code> (<strong>Settings → Secrets and variables → Actions</strong>).</li> <li>A kernel repository on the Hub to upload to, with kernel-creation access for the owning user or org (see <a href="build#uploading-your-kernel-to-the-hub">Building kernels</a>).</li>',is,y,Ls=`<p>Jobs run under the <code>namespace</code> you specify (your username or an org) and | |
| count against that namespace’s compute quota.</p>`,os,k,rs,B,Ns="The build action checks out nothing by itself, your script clones the exact commit and invokes the Nix builder. Compilation happens on the HF Jobs CPU flavor, and <code>build-and-upload</code> pushes the finished variants to the Hub.",cs,v,ps,H,Zs="The path filter keeps the build from running on unrelated commits, and <code>workflow_dispatch</code> lets you trigger it by hand from the <strong>Actions</strong> tab. The upload destination is taken from <code>--repo-id</code> (or, if omitted, from the <code>repo-id</code>/<code>version</code> fields in <code>build.toml</code>).",Ms,T,Vs=`<p>Builds can take a long time on the first run because every PyTorch and CUDA | |
| variant is compiled. Set a generous <code>timeout</code> (the example allows six hours) | |
| and rely on the <a href="build#using-the-hugging-face-binary-cache">Hugging Face binary cache</a> | |
| to keep subsequent builds fast.</p>`,ds,E,Ws=`You can speed up builds by tuning how much work runs in parallel. <code>--max-jobs</code> | |
| sets how many kernel variants are built concurrently, while <code>--cores</code> sets how | |
| many CPU cores each of those jobs may use. Pick values that fit the chosen CPU | |
| <code>flavor</code>: a larger flavor (such as <code>cpu-xl</code>) has more cores to spread across | |
| jobs, so raising <code>--max-jobs</code> and <code>--cores</code> together shortens the total build | |
| time. Setting them too high for the flavor only adds scheduling overhead.`,hs,$,us,G,_s="<thead><tr><th>Input</th> <th>Required</th> <th>Default</th> <th>Description</th></tr></thead> <tbody><tr><td><code>token</code></td> <td>yes</td> <td></td> <td>HF token with <code>job.write</code> permission.</td></tr> <tr><td><code>namespace</code></td> <td>yes</td> <td></td> <td>HF namespace (username or org) that owns the job.</td></tr> <tr><td><code>script</code></td> <td>yes</td> <td></td> <td>Shell script to run in the container.</td></tr> <tr><td><code>flavor</code></td> <td>no</td> <td><code>cpu-upgrade</code></td> <td>Hardware flavor (e.g. <code>cpu-xl</code>).</td></tr> <tr><td><code>image</code></td> <td>no</td> <td>Nix + cachix image</td> <td>Container image to run the build in.</td></tr> <tr><td><code>timeout</code></td> <td>no</td> <td><code>1200</code></td> <td>Maximum seconds to wait for the job.</td></tr></tbody>",js,x,Fs="The action exposes <code>job_id</code> and <code>job_url</code> outputs that link to the run on huggingface.co.",ys,S,Ts,Q,Ys='Once the kernel is on the Hub, the generic jobs action runs a test script on a GPU flavor. The <code>files</code> input copies repository files into the container (under <code>/tmp/files</code> by default), and a <a href="https://docs.astral.sh/uv/guides/scripts/" rel="nofollow"><code>uv</code> script</a> with inline dependencies keeps the environment self-contained.',ws,L,Js,N,Rs='The test script pulls the kernel straight from the Hub with the <a href="../basic-usage"><code>kernels</code></a> library, so it always runs against the artifacts the build workflow just published:',Us,Z,ms,V,Xs="Run the build workflow before the test workflow so the Hub has a fresh kernel to pull. For tightly coupled steps, you can also have one workflow trigger the other, or combine both jobs in a single workflow with a <code>needs:</code> dependency.",bs,W,gs,_,zs="<thead><tr><th>Input</th> <th>Required</th> <th>Default</th> <th>Description</th></tr></thead> <tbody><tr><td><code>token</code></td> <td>yes</td> <td></td> <td>HF token with <code>job.write</code> permission.</td></tr> <tr><td><code>namespace</code></td> <td>yes</td> <td></td> <td>HF namespace (username or org) that owns the job.</td></tr> <tr><td><code>image</code></td> <td>yes</td> <td></td> <td>Container image to run.</td></tr> <tr><td><code>script</code></td> <td>yes</td> <td></td> <td>Shell script to execute in the container.</td></tr> <tr><td><code>flavor</code></td> <td>no</td> <td><code>cpu-basic</code></td> <td>Hardware flavor (e.g. <code>rtx-pro-6000</code>).</td></tr> <tr><td><code>files</code></td> <td>no</td> <td></td> <td>Newline-separated repo files to copy into the job.</td></tr> <tr><td><code>files_dest</code></td> <td>no</td> <td><code>/tmp/files</code></td> <td>Directory the files are copied to inside the container.</td></tr> <tr><td><code>env</code></td> <td>no</td> <td><code>{}</code></td> <td>Environment variables as a JSON object.</td></tr> <tr><td><code>timeout</code></td> <td>no</td> <td><code>1200</code></td> <td>Maximum seconds to wait for the job.</td></tr></tbody>",Is,F,Cs,Y,qs='Flavors map to the machine types available on Hugging Face Jobs, CPU flavors such as <code>cpu-upgrade</code> and <code>cpu-xl</code> for builds, and GPU flavors such as <code>l4x1</code>, <code>a100-large</code>, <code>h200</code>, or <code>rtx-pro-6000</code> for tests. Pick the most reasonable GPU that fits your model to keep jobs low cost. The current list and pricing are in the <a href="https://huggingface.co/docs/huggingface_hub/guides/jobs" rel="nofollow">Hugging Face Jobs documentation</a>.',fs,w,Ps=`<p>HF Jobs currently only offers a few CPU architectures, so the kernel is built | |
| for whatever architecture the available CPU flavors provide. This is a current | |
| limitation to keep in mind if you need to target a specific architecture.</p>`,As,J,Os=`<p>HF Jobs containers start with shell tracing enabled (<code>set -x</code>). Always run | |
| <code>set +x</code> before exporting <code>HF_TOKEN</code> so the token does not leak into the | |
| streamed build logs.</p>`,ks,R,Bs,P,vs;return U=new it({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),m=new X({props:{title:"Building and testing kernels with GitHub Actions",local:"building-and-testing-kernels-with-github-actions",headingTag:"h1"}}),f=new X({props:{title:"Prerequisites",local:"prerequisites",headingTag:"h2"}}),k=new X({props:{title:"Building on push",local:"building-on-push",headingTag:"h2"}}),v=new Hs({props:{code:"JTIzJTIwLmdpdGh1YiUyRndvcmtmbG93cyUyRmJ1aWxkLWtlcm5lbC55bWwlMEFuYW1lJTNBJTIwQnVpbGQlMjBLZXJuZWwlMEElMEFvbiUzQSUwQSUyMCUyMHB1c2glM0ElMEElMjAlMjAlMjAlMjBicmFuY2hlcyUzQSUyMCU1Qm1haW4lNUQlMEElMjAlMjAlMjAlMjBwYXRocyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMC0lMjAlMjJjc3JjJTJGKiolMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAtJTIwJTIydG9yY2gtZXh0JTJGKiolMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAtJTIwYnVpbGQudG9tbCUwQSUyMCUyMCUyMCUyMCUyMCUyMC0lMjBmbGFrZS5uaXglMEElMjAlMjAlMjAlMjAlMjAlMjAtJTIwZmxha2UubG9jayUwQSUyMCUyMHdvcmtmbG93X2Rpc3BhdGNoJTNBJTBBJTBBam9icyUzQSUwQSUyMCUyMGJ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ybmVsLWJ1aWxkZXIlMjAtLSUyMGJ1aWxkLWFuZC11cGxvYWQlMjAlNUMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAtLW1heC1qb2JzJTIwNCUyMCU1QyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0tY29yZXMlMjA4JTIwJTVDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLS1yZXBvLWlkJTIweW91ci11c2VybmFtZSUyRnlvdXIta2VybmVs",highlighted:`<span class="hljs-comment"># .github/workflows/build-kernel.yml</span> | |
| <span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">Kernel</span> | |
| <span class="hljs-attr">on:</span> | |
| <span class="hljs-attr">push:</span> | |
| <span class="hljs-attr">branches:</span> [<span class="hljs-string">main</span>] | |
| <span class="hljs-attr">paths:</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">"csrc/**"</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">"torch-ext/**"</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">build.toml</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">flake.nix</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">flake.lock</span> | |
| <span class="hljs-attr">workflow_dispatch:</span> | |
| <span class="hljs-attr">jobs:</span> | |
| <span class="hljs-attr">build:</span> | |
| <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span> | |
| <span class="hljs-attr">steps:</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v4</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Build</span> <span class="hljs-string">kernel</span> <span class="hljs-string">via</span> <span class="hljs-string">HF</span> <span class="hljs-string">Jobs</span> | |
| <span class="hljs-attr">uses:</span> <span class="hljs-string">huggingface/kernel-builder-job@main</span> | |
| <span class="hljs-attr">with:</span> | |
| <span class="hljs-attr">token:</span> <span class="hljs-string">\${{</span> <span class="hljs-string">secrets.HF_TOKEN</span> <span class="hljs-string">}}</span> | |
| <span class="hljs-attr">namespace:</span> <span class="hljs-string">your-username</span> | |
| <span class="hljs-attr">flavor:</span> <span class="hljs-string">cpu-xl</span> | |
| <span class="hljs-attr">timeout:</span> <span class="hljs-string">"21600"</span> | |
| <span class="hljs-attr">script:</span> <span class="hljs-string">| | |
| # The container starts with \`set -x\`; disable tracing so the | |
| # token below is not echoed into the streamed logs. | |
| set +x | |
| export HF_TOKEN="\${{ secrets.HF_TOKEN }}" | |
| # Rebuild artifacts, so skip pulling existing LFS blobs. | |
| export GIT_LFS_SKIP_SMUDGE=1 | |
| </span> | |
| <span class="hljs-string">git</span> <span class="hljs-string">clone</span> <span class="hljs-string">"$<span class="hljs-template-variable">{{ github.server_url }}</span>/$<span class="hljs-template-variable">{{ github.repository }}</span>"</span> <span class="hljs-string">kernel</span> | |
| <span class="hljs-string">cd</span> <span class="hljs-string">kernel</span> | |
| <span class="hljs-string">git</span> <span class="hljs-string">checkout</span> <span class="hljs-string">"$<span class="hljs-template-variable">{{ github.sha }}</span>"</span> | |
| <span class="hljs-string">nix</span> <span class="hljs-string">run</span> <span class="hljs-string">github:huggingface/kernels#kernel-builder</span> <span class="hljs-string">--</span> <span class="hljs-string">build-and-upload</span> <span class="hljs-string">\\</span> | |
| <span class="hljs-string">--max-jobs</span> <span class="hljs-number">4</span> <span class="hljs-string">\\</span> | |
| <span class="hljs-string">--cores</span> <span class="hljs-number">8</span> <span class="hljs-string">\\</span> | |
| <span class="hljs-string">--repo-id</span> <span class="hljs-string">your-username/your-kernel</span>`,lang:"yaml",wrap:!1}}),$=new X({props:{title:"kernel-builder-job inputs",local:"kernel-builder-job-inputs",headingTag:"h3"}}),S=new X({props:{title:"Testing on a GPU",local:"testing-on-a-gpu",head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JTIwJTIwJTIwJTIwJTIwJTIwJTIwaW1hZ2UlM0ElMjBnaGNyLmlvJTJGYXN0cmFsLXNoJTJGdXYlM0FweXRob24zLjEwLWJvb2t3b3JtJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdGltZW91dCUzQSUyMCUyMjM2MDAlMjIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmaWxlcyUzQSUyMHNjcmlwdHMlMkZ0ZXN0LnB5JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2NyaXB0JTNBJTIwJTdDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2V0JTIwJTJCeCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV4cG9ydCUyMEhGX1RPS0VOJTNEJTIyJTI0JTdCJTdCJTIwc2VjcmV0cy5IRl9UT0tFTiUyMCU3RCU3RCUyMiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHV2JTIwcnVuJTIwJTJGdG1wJTJGZmlsZXMlMkZ0ZXN0LnB5",highlighted:`<span class="hljs-comment"># .github/workflows/run-tests.yml</span> | |
| <span class="hljs-attr">name:</span> <span class="hljs-string">Run</span> <span class="hljs-string">tests</span> | |
| <span class="hljs-attr">on:</span> | |
| <span class="hljs-attr">push:</span> | |
| <span class="hljs-attr">branches:</span> [<span class="hljs-string">main</span>] | |
| <span class="hljs-attr">paths:</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-string">scripts/test.py</span> | |
| <span class="hljs-attr">workflow_dispatch:</span> | |
| <span class="hljs-attr">jobs:</span> | |
| <span class="hljs-attr">run:</span> | |
| <span class="hljs-attr">runs-on:</span> <span class="hljs-string">ubuntu-latest</span> | |
| <span class="hljs-attr">steps:</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-attr">uses:</span> <span class="hljs-string">actions/checkout@v4</span> | |
| <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">Run</span> <span class="hljs-string">test.py</span> <span class="hljs-string">on</span> <span class="hljs-string">an</span> <span class="hljs-string">HF</span> <span class="hljs-string">Jobs</span> <span class="hljs-string">GPU</span> | |
| <span class="hljs-attr">uses:</span> <span class="hljs-string">huggingface/hf-jobs-action@main</span> | |
| <span class="hljs-attr">with:</span> | |
| <span class="hljs-attr">token:</span> <span class="hljs-string">\${{</span> <span class="hljs-string">secrets.HF_TOKEN</span> <span class="hljs-string">}}</span> | |
| <span class="hljs-attr">namespace:</span> <span class="hljs-string">your-username</span> | |
| <span class="hljs-attr">flavor:</span> <span class="hljs-string">rtx-pro-6000</span> | |
| <span class="hljs-attr">image:</span> <span class="hljs-string">ghcr.io/astral-sh/uv:python3.10-bookworm</span> | |
| <span class="hljs-attr">timeout:</span> <span class="hljs-string">"3600"</span> | |
| <span class="hljs-attr">files:</span> <span class="hljs-string">scripts/test.py</span> | |
| <span class="hljs-attr">script:</span> <span class="hljs-string">| | |
| set +x | |
| export HF_TOKEN="\${{ secrets.HF_TOKEN }}" | |
| uv run /tmp/files/test.py</span>`,lang:"yaml",wrap:!1}}),Z=new Hs({props:{code:"JTIzJTIwc2NyaXB0cyUyRnRlc3QucHklMEElMjMlMjAlMkYlMkYlMkYlMjBzY3JpcHQlMEElMjMlMjBkZXBlbmRlbmNpZXMlMjAlM0QlMjAlNUIlMjJrZXJuZWxzJTIyJTJDJTIwJTIydG9yY2glMjIlNUQlMEElMjMlMjAlMkYlMkYlMkYlMEFmcm9tJTIwa2VybmVscyUyMGltcG9ydCUyMGdldF9rZXJuZWwlMEElMEFrZXJuZWwlMjAlM0QlMjBnZXRfa2VybmVsKCUyMnlvdXItdXNlcm5hbWUlMkZ5b3VyLWtlcm5lbCUyMiklMEElMjMlMjAuLi4lMjBleGVyY2lzZSUyMHRoZSUyMGtlcm5lbCUyMGFuZCUyMGFzc2VydCUyMG9uJTIwdGhlJTIwcmVzdWx0cyUyMC4uLg==",highlighted:`<span class="hljs-comment"># scripts/test.py</span> | |
| <span class="hljs-comment"># /// script</span> | |
| <span class="hljs-comment"># dependencies = ["kernels", "torch"]</span> | |
| <span class="hljs-comment"># ///</span> | |
| <span class="hljs-keyword">from</span> kernels <span class="hljs-keyword">import</span> get_kernel | |
| kernel = get_kernel(<span class="hljs-string">"your-username/your-kernel"</span>) | |
| <span class="hljs-comment"># ... exercise the kernel and assert on the results ...</span>`,lang:"python",wrap:!1}}),W=new X({props:{title:"hf-jobs-action inputs",local:"hf-jobs-action-inputs",headingTag:"h3"}}),F=new X({props:{title:"Choosing a flavor",local:"choosing-a-flavor",headingTag:"h2"}}),R=new ot({props:{source:"https://github.com/huggingface/kernels/blob/main/docs/source/builder/github-actions.md"}}),{c(){j=i("meta"),O=n(),q=i("p"),K=n(),c(U.$$.fragment),D=n(),c(m.$$.fragment),ss=n(),b=i("p"),b.innerHTML=$s,ts=n(),g=i("p"),g.textContent=Gs,es=n(),I=i("ul"),I.innerHTML=xs,ls=n(),C=i("p"),C.innerHTML=Ss,ns=n(),c(f.$$.fragment),as=n(),A=i("ul"),A.innerHTML=Qs,is=n(),y=i("blockquote"),y.innerHTML=Ls,os=n(),c(k.$$.fragment),rs=n(),B=i("p"),B.innerHTML=Ns,cs=n(),c(v.$$.fragment),ps=n(),H=i("p"),H.innerHTML=Zs,Ms=n(),T=i("blockquote"),T.innerHTML=Vs,ds=n(),E=i("p"),E.innerHTML=Ws,hs=n(),c($.$$.fragment),us=n(),G=i("table"),G.innerHTML=_s,js=n(),x=i("p"),x.innerHTML=Fs,ys=n(),c(S.$$.fragment),Ts=n(),Q=i("p"),Q.innerHTML=Ys,ws=n(),c(L.$$.fragment),Js=n(),N=i("p"),N.innerHTML=Rs,Us=n(),c(Z.$$.fragment),ms=n(),V=i("p"),V.innerHTML=Xs,bs=n(),c(W.$$.fragment),gs=n(),_=i("table"),_.innerHTML=zs,Is=n(),c(F.$$.fragment),Cs=n(),Y=i("p"),Y.innerHTML=qs,fs=n(),w=i("blockquote"),w.innerHTML=Ps,As=n(),J=i("blockquote"),J.innerHTML=Os,ks=n(),c(R.$$.fragment),Bs=n(),P=i("p"),this.h()},l(s){const t=nt("svelte-u9bgzb",document.head);j=o(t,"META",{name:!0,content:!0}),t.forEach(e),O=a(s),q=o(s,"P",{}),Ks(q).forEach(e),K=a(s),p(U.$$.fragment,s),D=a(s),p(m.$$.fragment,s),ss=a(s),b=o(s,"P",{"data-svelte-h":!0}),r(b)!=="svelte-s9excn"&&(b.innerHTML=$s),ts=a(s),g=o(s,"P",{"data-svelte-h":!0}),r(g)!=="svelte-8tyxhx"&&(g.textContent=Gs),es=a(s),I=o(s,"UL",{"data-svelte-h":!0}),r(I)!=="svelte-1ua20xp"&&(I.innerHTML=xs),ls=a(s),C=o(s,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1nkgmyn"&&(C.innerHTML=Ss),ns=a(s),p(f.$$.fragment,s),as=a(s),A=o(s,"UL",{"data-svelte-h":!0}),r(A)!=="svelte-mdict8"&&(A.innerHTML=Qs),is=a(s),y=o(s,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r(y)!=="svelte-1j4xyj4"&&(y.innerHTML=Ls),os=a(s),p(k.$$.fragment,s),rs=a(s),B=o(s,"P",{"data-svelte-h":!0}),r(B)!=="svelte-fjjjt5"&&(B.innerHTML=Ns),cs=a(s),p(v.$$.fragment,s),ps=a(s),H=o(s,"P",{"data-svelte-h":!0}),r(H)!=="svelte-1ql1fp1"&&(H.innerHTML=Zs),Ms=a(s),T=o(s,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r(T)!=="svelte-1k9k30z"&&(T.innerHTML=Vs),ds=a(s),E=o(s,"P",{"data-svelte-h":!0}),r(E)!=="svelte-2k8asc"&&(E.innerHTML=Ws),hs=a(s),p($.$$.fragment,s),us=a(s),G=o(s,"TABLE",{"data-svelte-h":!0}),r(G)!=="svelte-1ojltpm"&&(G.innerHTML=_s),js=a(s),x=o(s,"P",{"data-svelte-h":!0}),r(x)!=="svelte-1tjghwi"&&(x.innerHTML=Fs),ys=a(s),p(S.$$.fragment,s),Ts=a(s),Q=o(s,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-1hyjlv7"&&(Q.innerHTML=Ys),ws=a(s),p(L.$$.fragment,s),Js=a(s),N=o(s,"P",{"data-svelte-h":!0}),r(N)!=="svelte-185d696"&&(N.innerHTML=Rs),Us=a(s),p(Z.$$.fragment,s),ms=a(s),V=o(s,"P",{"data-svelte-h":!0}),r(V)!=="svelte-pdls8t"&&(V.innerHTML=Xs),bs=a(s),p(W.$$.fragment,s),gs=a(s),_=o(s,"TABLE",{"data-svelte-h":!0}),r(_)!=="svelte-69b27n"&&(_.innerHTML=zs),Is=a(s),p(F.$$.fragment,s),Cs=a(s),Y=o(s,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-c3a1ta"&&(Y.innerHTML=qs),fs=a(s),w=o(s,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r(w)!=="svelte-17oidf7"&&(w.innerHTML=Ps),As=a(s),J=o(s,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r(J)!=="svelte-bb8xuy"&&(J.innerHTML=Os),ks=a(s),p(R.$$.fragment,s),Bs=a(s),P=o(s,"P",{}),Ks(P).forEach(e),this.h()},h(){z(j,"name","hf:doc:metadata"),z(j,"content",ct),z(y,"class","note"),z(T,"class","tip"),z(w,"class","note"),z(J,"class","warning")},m(s,t){at(document.head,j),l(s,O,t),l(s,q,t),l(s,K,t),M(U,s,t),l(s,D,t),M(m,s,t),l(s,ss,t),l(s,b,t),l(s,ts,t),l(s,g,t),l(s,es,t),l(s,I,t),l(s,ls,t),l(s,C,t),l(s,ns,t),M(f,s,t),l(s,as,t),l(s,A,t),l(s,is,t),l(s,y,t),l(s,os,t),M(k,s,t),l(s,rs,t),l(s,B,t),l(s,cs,t),M(v,s,t),l(s,ps,t),l(s,H,t),l(s,Ms,t),l(s,T,t),l(s,ds,t),l(s,E,t),l(s,hs,t),M($,s,t),l(s,us,t),l(s,G,t),l(s,js,t),l(s,x,t),l(s,ys,t),M(S,s,t),l(s,Ts,t),l(s,Q,t),l(s,ws,t),M(L,s,t),l(s,Js,t),l(s,N,t),l(s,Us,t),M(Z,s,t),l(s,ms,t),l(s,V,t),l(s,bs,t),M(W,s,t),l(s,gs,t),l(s,_,t),l(s,Is,t),M(F,s,t),l(s,Cs,t),l(s,Y,t),l(s,fs,t),l(s,w,t),l(s,As,t),l(s,J,t),l(s,ks,t),M(R,s,t),l(s,Bs,t),l(s,P,t),vs=!0},p:st,i(s){vs||(d(U.$$.fragment,s),d(m.$$.fragment,s),d(f.$$.fragment,s),d(k.$$.fragment,s),d(v.$$.fragment,s),d($.$$.fragment,s),d(S.$$.fragment,s),d(L.$$.fragment,s),d(Z.$$.fragment,s),d(W.$$.fragment,s),d(F.$$.fragment,s),d(R.$$.fragment,s),vs=!0)},o(s){h(U.$$.fragment,s),h(m.$$.fragment,s),h(f.$$.fragment,s),h(k.$$.fragment,s),h(v.$$.fragment,s),h($.$$.fragment,s),h(S.$$.fragment,s),h(L.$$.fragment,s),h(Z.$$.fragment,s),h(W.$$.fragment,s),h(F.$$.fragment,s),h(R.$$.fragment,s),vs=!1},d(s){s&&(e(O),e(q),e(K),e(D),e(ss),e(b),e(ts),e(g),e(es),e(I),e(ls),e(C),e(ns),e(as),e(A),e(is),e(y),e(os),e(rs),e(B),e(cs),e(ps),e(H),e(Ms),e(T),e(ds),e(E),e(hs),e(us),e(G),e(js),e(x),e(ys),e(Ts),e(Q),e(ws),e(Js),e(N),e(Us),e(ms),e(V),e(bs),e(gs),e(_),e(Is),e(Cs),e(Y),e(fs),e(w),e(As),e(J),e(ks),e(Bs),e(P)),e(j),u(U,s),u(m,s),u(f,s),u(k,s),u(v,s),u($,s),u(S,s),u(L,s),u(Z,s),u(W,s),u(F,s),u(R,s)}}}const ct='{"title":"Building and testing kernels with GitHub Actions","local":"building-and-testing-kernels-with-github-actions","sections":[{"title":"Prerequisites","local":"prerequisites","sections":[],"depth":2},{"title":"Building on push","local":"building-on-push","sections":[{"title":"kernel-builder-job inputs","local":"kernel-builder-job-inputs","sections":[],"depth":3}],"depth":2},{"title":"Testing on a GPU","local":"testing-on-a-gpu","sections":[{"title":"hf-jobs-action inputs","local":"hf-jobs-action-inputs","sections":[],"depth":3}],"depth":2},{"title":"Choosing a flavor","local":"choosing-a-flavor","sections":[],"depth":2}],"depth":1}';function pt(Es){return tt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class jt extends et{constructor(j){super(),lt(this,j,pt,rt,Ds,{})}}export{jt as component}; | |
Xet Storage Details
- Size:
- 26.2 kB
- Xet hash:
- be2cf6b1794f6fce23c75162a33064b2331172985db4a9f7208c573a5e978e67
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.