Skip to content

feat: enforce that a version must be specified#544

Open
drbh wants to merge 7 commits into
mainfrom
require-version
Open

feat: enforce that a version must be specified#544
drbh wants to merge 7 commits into
mainfrom
require-version

Conversation

@drbh
Copy link
Copy Markdown
Collaborator

@drbh drbh commented May 12, 2026

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.

Copy link
Copy Markdown
Member

@danieldk danieldk left a comment

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).

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