๐ Utility to create, edit, and publish model cards on the Hugging Face Hub.
This repo is just an idea for now! :)
pip install modelcards
Load a model card from a Hugging Face Hub repo:
from modelcards import ModelCard
card = ModelCard.load("nateraw/rare-puppers")
# Access its card data
print(card.data)
# Update its card data
card.data["library_name"] = "timm"
# Save it to a file
card.save("my_card.md")
# Or, push it to the hub directly to replace the existing card
card.push_to_hub("nateraw/rare-puppers")
Make model cards from the default model card template.
from modelcards import ModelCard
repo_id = "nateraw/my-cool-model-with-card"
# Write/overwrite the model card in that repo
card = ModelCard.from_template(
language='en',
license='mit',
library_name='timm',
tags=['image-classification', 'resnet'],
dataset='imagenet',
metrics=['acc', 'f1'],
model_id=repo_id.split('/')[-1], # Included in the template
model_description="Some really helpful description...", # Included in the template
)
๐ You can see what the resulting model card here looks like at this Hugging Face Hub repo.
Note: you can make your own template and supply that to the from_template
method by using the template_path
argument.
- Support evaluation metrics
- Data validation on card data