Model Repos docs

What are model cards and why are they useful?

The model cards are markdown files that accompany the models and provide very useful information. They are extremely important for discoverability, reproducibility and sharing! They are the README.md file in any repo.

When sharing a model, what should I add to my model card?

The model card should describe:

  • the model
  • its intended uses & potential limitations, including bias and ethical considerations as detailed in Mitchell, 2018
  • the training params and experimental info (you can embed or link to an experiment tracking platform for reference)
  • which datasets did you train on and your eval results

If needed you can find the specification here.

How are model tags determined?

The model cards have a YAML section that specify metadata. These are the fields

---
language: "ISO 639-1 code for your language, or `multilingual`"
thumbnail: "url to a thumbnail used in social sharing"
tags:
- tag1
- tag2
license: "any valid license identifier"
datasets:
- dataset1
- dataset2
metrics:
- metric1
- metric2
---

Some useful information on them:

Here is an example:

---
language:
- ru
- en
tags:
- translation
license: apache-2.0
datasets:
- wmt19
metrics:
- bleu
- sacrebleu
---

How can I control my model's widget's example inputs?

You can specify the widget input in the model card metadata section:

widget:
- text: "Jens Peter Hansen kommer fra Danmark"

We try to provide example inputs for some languages and most widget types in this DefaultWidget.ts file. If we lack some examples, please open a PR updating this file to add them. Thanks!

Can I specify which framework supports my model?

Yes!πŸ”₯ You can specify the framework in the model card metadata section:

tags:
- flair

Find more about our supported libraries here!

How can I link a model to a dataset?

You can specify the dataset in the metadata:

datasets:
- wmt19

Can I access models programatically?

You can use the huggingface_hub library to create, delete, update and retrieve information from repos. You can also use it to download files from repos and integrate it to your own library! For example, you can easily load a Scikit learn model with few lines.

from huggingface_hub import hf_hub_url, cached_download
import joblib

REPO_ID = "YOUR_REPO_ID"
FILENAME = "sklearn_model.joblib"

model = joblib.load(cached_download(
    hf_hub_url(REPO_ID, FILENAME)
))

Can I write LaTeX in my model card?

Yes, we use the KaTeX math typesetting library to render math formulas server-side, before parsing the markdown.

You have to use the following delimiters:

  • $ ... $ for display mode
  • \\ ( ... \\ ) for inline mode (no space between the slashes and the parenthesis).

Then you'll be able to write:

LaTeX \LaTeX

MSE=(1n)βˆ‘i=1n(yiβˆ’xi)2 \mathrm{MSE} = \left(\frac{1}{n}\right)\sum_{i=1}^{n}(y_{i} - x_{i})^{2}

E=mc2 E=mc^2