Skip to content

add utilities to generate template repo cards#210

Open
sayakpaul wants to merge 24 commits intomainfrom
repocard-utils
Open

add utilities to generate template repo cards#210
sayakpaul wants to merge 24 commits intomainfrom
repocard-utils

Conversation

@sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Jan 14, 2026

As discussed internally, this PR adds utilities to easily generate template repository cards for the kernels built with kernels and kernel-builder.

For now, the repository card contains basic info, which IMO, is sufficient for a v1. But of course, feedback is welcome.

If we run

python example_usage.py --kernels_dir /fsx/sayak/kernels-community/activation --card_path activation.md

We should expect to get an activation.md, looking like so:

Unfold

library_name: kernels
license: apache-2.0

This is the repository card of {repo_id} that has been pushed on the Hub. It was built to be used with the kernels library. This card was automatically generated.

How to use

# make sure `kernels` is installed: `pip install -U kernels`
from kernels import get_kernel

kernel_module = get_kernel("REPO_ID") # <- change the ID if needed
silu_and_mul = kernel_module.silu_and_mul

silu_and_mul(...)

Benchmarks

[TODO: provide benchmarks if available]

Code source

[TODO: provide original code source and other relevant citations if available]

Notes

[TODO: provide additional notes about this kernel if needed]

On the Hub, this would preview much better, of course. You can preview here.

TODOs

  • Tests
  • Docs
  • upload-card CLI command
  • Remove the example_usage.py script
  • Discuss how this should be integrated in the build workflow (or any other workflow for that matter)

From Slack

We could have an upload-card subcommand (or even make it part of upload) that uploads the card to main on the Hub.

I agree to this. I will work on it in this PR later.

@danieldk @drbh the above are some TODOs that came to mind, but the list isn't limited to that. Would love an initial review of this draft and address anything.

@sayakpaul sayakpaul requested review from danieldk and drbh January 14, 2026 06:00
@HuggingFaceDocBuilderDev

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.

Comment on lines +106 to +107
except Exception:
return None
Copy link
Member Author

Choose a reason for hiding this comment

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

Can raise here instead as well.

Copy link
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.

Awesome! Small comment on the __init__ parsing.

@sayakpaul
Copy link
Member Author

@danieldk

I have addressed #210 (comment). Additionally, I have added support to log "Supported backends" and "Supported CUDA backends" when they are available through build.toml.

Example: https://huggingface.co/sayakpaul/example-kernels-repocard

LMK your thoughts and I will start addressing the rest of the stuff.

@sayakpaul
Copy link
Member Author

sayakpaul commented Jan 16, 2026

Updated a bunch of stuff and the following is a summary:

  • Utility to update license if available through build.toml
  • Utility to update all the functions available in __all__
  • Added a force_update_content flag so that even when a kernel card is available it can be force-updated
  • Decided replace model_card to kernel_card which is much more idiomatic, IMO

Here's how an updated kernel card looks like: https://huggingface.co/sayakpaul/example-kernels-repocard

Once I have another round of feedback, I will work on the following:

  • update-card utility
  • tests
  • docs

LMK.

@@ -0,0 +1,36 @@
from pathlib import Path
Copy link
Member Author

Choose a reason for hiding this comment

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

Example script. Will be removed.

@sayakpaul sayakpaul requested a review from danieldk January 22, 2026 14:30
@sayakpaul sayakpaul changed the title [wip] add utilities to generate template repo cards add utilities to generate template repo cards Jan 27, 2026
@sayakpaul sayakpaul marked this pull request as ready for review January 27, 2026 10:50
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