Skip to content

Commit ae0a078

Browse files
authored
docs: refresh for native kernel repo type on the Hub (#520)
* docs: refresh for native kernel repo type on the Hub - Update discovery URLs from /models?other=kernels to huggingface.co/kernels - Replace landing-page thumbnail with light/dark variants and link to hf.co/kernels - Add migration.md 0.14 section: kernel-only loader, kernel-creation access flow, model-to-kernel repo migration steps - Add Repository type and Trusted publishers sections to kernel-requirements.md (covers trust_remote_code requirement) - Add upload prerequisite note in builder/build.md * docs: replace README header with light/dark Kernels thumbnail * docs: update README links (full huggingface.co URL, native kernels listing)
1 parent 658395e commit ae0a078

6 files changed

Lines changed: 76 additions & 12 deletions

File tree

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# kernels
22

33
<div align="center">
4-
<img src="https://github.com/user-attachments/assets/4b5175f3-1d60-455b-8664-43b2495ee1c3" width="450" height="450" alt="kernel-builder logo">
4+
<a href="https://huggingface.co/kernels">
5+
<picture>
6+
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kernels/kernels-thumbnail-dark.png">
7+
<source media="(prefers-color-scheme: light)" srcset="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kernels/kernels-thumbnail-light.png">
8+
<img alt="Kernels" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kernels/kernels-thumbnail-light.png" style="max-width: 100%;">
9+
</picture>
10+
</a>
511
<p align="center">
612
<a href="https://pypi.org/project/kernels"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/kernels"></a>
713
<a href="https://github.com/huggingface/kernels/tags"><img alt="GitHub tag" src="https://img.shields.io/github/v/tag/huggingface/kernels"></a>
@@ -12,7 +18,7 @@
1218
<hr/>
1319

1420
The Kernel Hub allows Python libraries and applications to load compute
15-
kernels directly from the [Hub](https://hf.co/). To support this kind
21+
kernels directly from the [Hub](https://huggingface.co/). To support this kind
1622
of dynamic loading, Hub kernels differ from traditional Python kernel
1723
packages in that they are made to be:
1824

@@ -57,8 +63,7 @@ activation.gelu_fast(y, x)
5763
print(y)
5864
```
5965

60-
You can [search for kernels](https://huggingface.co/models?other=kernels) on
61-
the Hub.
66+
Browse available kernels at [huggingface.co/kernels](https://huggingface.co/kernels).
6267

6368
## 📚 Documentation
6469

docs/source/builder/build.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ $ cd mykernel
179179
$ kernel-builder build-and-upload
180180
```
181181

182+
> [!NOTE]
183+
> Uploads go to a `kernel`-type Hub repository (the first-class kernel
184+
> repository type). The owning user or org must have kernel-creation
185+
> access. Request it from
186+
> [huggingface.co/settings/account](https://huggingface.co/settings/account)
187+
> ("Request Kernels Creation").
188+
182189
Aside from building and uploading the kernel itself, this will also fill
183190
the card template and upload it as `README.md` to the Hub if the card
184191
template is provided in the source repository as `CARD.md`.

docs/source/index.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Kernels
22

33
<div align="center">
4-
<img src="https://github.com/user-attachments/assets/64a652f3-0cd3-4829-b3c1-df13f7933569" width="450" height="450" alt="kernel-builder logo">
4+
<a href="https://huggingface.co/kernels">
5+
<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kernels/kernels-thumbnail-light.png" alt="Kernels"/>
6+
<img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/kernels/kernels-thumbnail-dark.png" alt="Kernels"/>
7+
</a>
58
</div>
69

710
The Kernel Hub allows Python libraries and applications to load compute
8-
kernels directly from the [Hub](https://hf.co/). To support this kind
9-
of dynamic loading, Hub kernels differ from traditional Python kernel
10-
packages in that they are made to be:
11+
kernels directly from the [Hub](https://huggingface.co/). Kernels are a first-class
12+
repository type on the Hub, with dedicated pages that surface supported
13+
hardware and versions. To support dynamic loading, Hub kernels differ from
14+
traditional Python kernel packages in that they are made to be:
1115

1216
- **Portable**: a kernel can be loaded from paths outside `PYTHONPATH`.
1317
- **Unique**: multiple versions of the same kernel can be loaded in the
@@ -16,8 +20,7 @@ packages in that they are made to be:
1620
the different PyTorch build configurations (various CUDA versions
1721
and C++ ABIs). Furthermore, older C library versions must be supported.
1822

19-
You can [search for kernels](https://huggingface.co/models?other=kernels) on
20-
the Hub.
23+
Browse available kernels at [huggingface.co/kernels](https://huggingface.co/kernels).
2124

2225
If you're looking for a more involved "Why kernels?" answer, refer to
2326
[this page](./why_kernels.md).

docs/source/integrating-kernels.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ Besides leveraging pre-built compute kernels, different projects
3636
rely on `kernels` to also package, build, and distribute their
3737
kernels on the Hugging Face Hub platform. This is made possible by the
3838
["builder" component of `kernels`](./builder/writing-kernels.md).
39-
Visit [this page](https://huggingface.co/models?other=kernels) to find out
40-
different pre-built compute kernels available on the Hub.
39+
Visit [huggingface.co/kernels](https://huggingface.co/kernels) to browse
40+
the pre-built compute kernels available on the Hub.

docs/source/kernel-requirements.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ systems and Torch builds.
77
[Join us on Discord](https://discord.gg/H6Tkmd88N3) for questions and discussions
88
about building kernels!
99

10+
## Repository type
11+
12+
Compliant kernels are published as `kernel`-type repositories on the Hub
13+
(the first-class kernel repository type). New uploads via `kernel-builder`
14+
default to this type; see the [migration guide](migration.md) if you
15+
maintain an older `model`-type kernel repository.
16+
17+
## Trusted publishers
18+
19+
`kernels` only loads kernels from a curated set of trusted publishers by
20+
default. Loading from any other publisher raises an error unless the caller
21+
opts in with `trust_remote_code=True`:
22+
23+
```python
24+
# Trusted publisher: works without opt-in.
25+
get_kernel("kernels-community/activation", version=1)
26+
27+
# Untrusted publisher: must opt in explicitly.
28+
get_kernel("some-other-org/my-kernel", version=1, trust_remote_code=True)
29+
```
30+
31+
The Hub also exposes a `trustedKernelPublisher` flag on the kernel API and
32+
displays a corresponding badge in the UI.
33+
1034
## Directory layout
1135

1236
A kernel repository on the Hub must contain a `build` directory. This

docs/source/migration.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,28 @@ kernel_layer_mapping = {
6666
}
6767
}
6868
```
69+
70+
## 0.14
71+
72+
### `kernel` repo type on the Hub
73+
74+
Kernels are now a first-class repository type on the Hugging Face Hub, and
75+
`kernels` 0.14 loads kernels exclusively from `kernel`-type repositories.
76+
`model`-type kernel repositories are no longer supported by the loader.
77+
78+
New uploads via `kernel-builder build-and-upload` default to
79+
`--repo-type kernel`. To publish, the owning user or org must have
80+
kernel-creation access. Request it from
81+
[huggingface.co/settings/account](https://huggingface.co/settings/account)
82+
("Request Kernels Creation").
83+
84+
To migrate an existing `model`-type kernel repository:
85+
86+
1. Make sure the publishing org has been granted kernel-creation access
87+
(see above).
88+
2. Re-upload with `kernel-builder build-and-upload` to a `kernel`-type
89+
repository. Either keep the same `repo-id` in `build.toml` if the
90+
repository has been migrated to the new type, or point it at a newly
91+
created `kernel`-type repository.
92+
3. Update consumers' `get_kernel(...)` and `LayerRepository(...)` calls
93+
to reference the new repository if the `repo-id` changed.

0 commit comments

Comments
 (0)