Model Card
Model cards are files that accompany models and provide handy information, and they are Markdown files with additional metadata.
Verified
Definition
Model cards are files that accompany the models and provide handy information. Model cards are Markdown files with additional metadata. A model repo renders its README.md as a model card.
The model card is a Markdown file with a YAML section at the top that contains metadata about the model. The Hub documentation says model cards are essential for discoverability, reproducibility, and sharing.
At a glance
How to fill out each section of the model card is described in the Annotated Model Card.
- Metadata can be added to a model card using the metadata UI.
- To access the metadata UI, go to the model page and click the Edit model card button in the top right corner of the model card.
- The YAML section of the README.md file can also be edited directly.
- To add metadata that is not supported by the UI, the YAML section of the README.md file can be edited directly.
- Many libraries with Hub integration automatically add metadata to the model card when a model is uploaded.
- The metadata added to the model card supports discovery and easier use of the model.
- Adding datasets to the metadata adds a message reading Datasets used to train: to the model page and links the relevant datasets if they are available on the Hub.
- If the model card includes a link to a Paper page, the Hugging Face Hub extracts the arXiv ID and includes it in the model tags.
The source does not state the order of these points, so they are listed without arrows.
How it works
The supported libraries can be specified in the model card metadata section. If the library is not specified, the Hub tries to automatically detect the library type. In the past, if nothing was detected and there was a config.json file, the library was assumed to be transformers.
If a model is a fine-tune, an adapter, or a quantized version of a base model, the base model can be specified in the model card metadata section. The base model information can also indicate that a model is a merge of multiple existing models. The base model metadata is used to display the base model on the model page.
The Hub infers the type of relationship from the current model to the base model. If a new version of a model is available in the Hub, it can be specified in a new_version field, and that metadata displays a link to the latest version on the model page. The datasets used to train a model can be specified in the metadata section, and they are displayed on the model page where users can filter models by dataset.
The storage buckets linked to a model can be specified in the metadata section, and they are shown as tags on the model page while the linked bucket pages show the model in return.
Example
The pipeline_tag indicates the type of task the model is intended for, and the pipeline tag is also used to determine which widget to use for the model and which APIs to use under the hood. For transformers models, the pipeline tag is automatically inferred, and it can be overridden in the model card metadata if required. The license can be specified in the metadata section, and it is displayed on the model page where users can filter models by license.
If required, a custom license can be specified by adding other as the license value and specifying the name and a link to the license in the metadata. A model's evaluation results can be specified in a structured way in the model card metadata, and the Hub parses them and displays them in a widget on the model page. Custom tags can be added to the tags field in the model card metadata.
A not-for-all-audiences tag can be added to the model card metadata. The Hub uses the KaTeX math typesetting library to render math formulas server-side before parsing the Markdown.
Sources
This page is written from the official sources below. Open them to check the original text.
- Official documentationhttps://huggingface.co/docs/hub/model-cardsFetched
Verified ·
This page is written by AI from the official sources above and checked automatically. This site has not tested it. Found a mistake? Tell us.