Skip to content

feat: enforce that a version must be specified - #544

Merged
drbh merged 7 commits into
mainfrom
require-version
May 19, 2026
Merged

drbh merged 7 commits into
mainfrom
require-version

Conversation

@drbh

@drbh drbh commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR enforces that a version or revision must be specified in all cases

note: this PR also updates the examples cards to render correctly; updates the __all__s for some functions, adds a small change for the cli to work on tvm-ffi kernels, and regenerates the cards since there were template placeholders previously. I added these changes to this PR since I updated the card template to include the version and thought the examples should reflect.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@danieldk danieldk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems to have gone wrong for the cards? They should be templates, but this PR makes them filled.

@@ -1,56 +1,25 @@
---
library_name: kernels
{% if license %}license: {{ license }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the license be filled from the metadata, I don't think we want to hardcode it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea 100% I made the mistake of pushing hydrated cards 🤦‍♂️, fixed in latest changes


kernel_module = get_kernel("{{ repo_id }}")
{{ functions[0] }} = kernel_module.{{ functions[0] }}
kernel_module = get_kernel("kernels-test/cutlass-gemm-tvm-ffi", version=1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused, this should be done by card filling, right? The card should be filled at upload time, not in the repo already.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, should be resolved in latest changes

- `{{ layer }}`
{% endfor %}
{% endif %}
- `cutlass_gemm`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Now the list of functions would never update as a kernel is extended.

Comment thread kernels/src/kernels/_versions.py Outdated
return revision
elif version is not None:

if version is not None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep this an elif right? To indicate that this is a continuation of the previous condition.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes that makes more sense syntactically, updated to use elif in the latest changes

Comment thread kernels/src/kernels/utils.py Outdated
result = activation.relu(out, x)
```
"""
if revision is None and version is None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this here? select_revision_or_version gets called below. We should have one place for validation, not the same validation in multiple places.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, removed in latest

Comment on lines 72 to 77
if revision is not None and version is not None:
raise ValueError("Either a revision or a version must be specified, not both.")
if revision is None and version is None:
raise ValueError("Either a revision or a version must be specified.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we need the duplication because the fetching is only lazy (for good reasons).

@danieldk danieldk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!!!

@drbh
drbh merged commit 4a2d92f into main May 19, 2026
68 of 70 checks passed
sayakpaul pushed a commit that referenced this pull request May 19, 2026
* feat: enforce that a version must be specified

* fix: regenerate example cards and update tvm ffi examples to render correctly

* fix: reformat

* fix: remove card hydration

* fix: prefer elif syntax

* fix: remove duplicate check

* fix: reformat
TimPietruskyRunPod added a commit to TimPietruskyRunPod/worker-vllm that referenced this pull request Jun 2, 2026
Two fixes that together unblock the hub tests:

1. tests.json allowedCudaVersions: 12.x -> 13.0 (matches hub.json and
   Dockerfile post-v2.20.0). Previously container init failed with
   'unsatisfied condition: cuda>=13.0'.

2. requirements.txt: pin kernels<0.15. v0.15.1 (2026-05-29) made
   LayerRepository require revision or version
   (huggingface/kernels#544), which transformers>=5 doesn't yet pass.
   Worker startup raised: ValueError: Either a revision or a version
   must be specified.

Refs: DR-1161
TimPietruskyRunPod added a commit to TimPietruskyRunPod/worker-vllm that referenced this pull request Jun 2, 2026
Three coupled fixes needed to make .runpod/tests.json hub tests pass
again after the v2.20.0 upgrades:

1. tests.json allowedCudaVersions: 12.x -> 13.0 (Dockerfile and
   hub.json moved to CUDA 13.0; old values caused
   'unsatisfied condition: cuda>=13.0' at container init).

2. requirements.txt kernels<0.15: huggingface/kernels v0.15.1
   tightened LayerRepository to require revision or version
   (huggingface/kernels#544), which transformers >=5 doesn't pass.
   Worker raised ValueError at import. 0.14.1 is the last safe.

3. tests.json timeout 30000 -> 300000: vLLM cold start
   (torch.compile + warmup) takes ~60-70s on RTX 4090 for SmolLM2-135M.
   30s timeout fired before the worker could respond, producing
   'context deadline exceeded'.

Refs: DR-1161
TimPietruskyRunPod added a commit to runpod-workers/worker-vllm that referenced this pull request Jun 2, 2026
Three coupled fixes verified end-to-end on a private fork
(TimPietruskyRunPod/worker-vllm v0.1.3 → both hub tests passing):

1. tests.json allowedCudaVersions: 12.x → 13.0
   The Dockerfile and hub.json moved to CUDA 13.0 in v2.20.0
   (#288, #289), but tests.json was still pinned to 12.5–12.9, so
   the test pod was scheduled on a GPU with driver < 13.0 and
   container init failed at the nvidia-container-cli hook with
   "unsatisfied condition: cuda>=13.0".

2. requirements.txt kernels<0.15
   huggingface/kernels v0.15.1 tightened LayerRepository to require
   a revision or version argument
   (huggingface/kernels#544). transformers
   >=5 still constructs LayerRepository(repo_id=..., layer_name=...)
   without either, so worker import raised ValueError during
   `from transformers import ...`. 0.14.1 is the last safe release.

3. tests.json timeout 30000 → 300000
   vLLM cold start (torch.compile + FlashInfer warmup) on RTX 4090
   for SmolLM2-135M takes ~60–70s before the first request can be
   served. The previous 30s per-test timeout fired before the
   worker came up, producing "context cancelled or timed out:
   context deadline exceeded" for every test even when the worker
   was healthy. 300s gives enough headroom for cold start + the
   actual inference call.

Refs: DR-1161

This branch was previously deployed

1 inactive deployment
testpypi — 9d56ed7a Deployed May 15, 2026 by drbh via Publish Python 🐍 distribution 📦 to TestPyPI #1203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants