In a Hugging Face model card's YAML header, what do license, base_model and pipeline_tag tell a reviewer adopting a checkpoint?
answer
- the README.md is the card
- metadata between two --- lines
- a licence identifier, or other with a link
- lineage: base_model and its relation
- the task drives the widget and filters
basics
~20 sThe YAML block at the top of a repo's README.md is the Hub's metadata: license names the declared licence, base_model names the checkpoint this one derives from, and pipeline_tag names the task. All three are claims written by the uploader.
solid answer
~50 sA model card is the repo's `README.md`, and the YAML between its opening `---` lines is metadata the Hub indexes and displays. `license` holds a licence identifier such as `apache-2.0`, or `other` with `license_name` and `license_link` for a custom licence; it is where a licence review starts, not where it ends. `base_model` names the Hub id this checkpoint was fine-tuned, quantized or adapted from (a list for a merge), and the Hub infers the relationship unless `base_model_relation` sets it to `adapter`, `merge`, `quantized` or `finetune`; that gives a reviewer the lineage to follow. `pipeline_tag` declares the task, drives the page's widget and the task filter, and for Transformers models is inferred from `config.json` unless the card overrides it. Every field is self-declared, so read it at the revision you pin and treat it as a claim to verify.
code
yaml · 11 lines---
license: apache-2.0
base_model: HuggingFaceH4/zephyr-7b-beta
base_model_relation: finetune
pipeline_tag: text-generation
library_name: transformers
datasets:
- your-org/support-chats
language:
- en
---go deeper
Recall that the model card is the repo's README.md and that the YAML at its top holds license, base_model, pipeline_tag and similar fields the Hub displays.
Explain how license: other works with license_name and license_link, how base_model and base_model_relation express lineage, and where pipeline_tag comes from.
Use card metadata as the first pass of a model review: read it at the pinned revision, follow the base_model chain, and treat every field as an uploader's claim to verify.
Decide which card fields a team requires before a checkpoint is adopted or published, and what evidence beyond the card a review must collect.
## Where the metadata lives Every Hub repo can have a **model card**: the `README.md` at the root of the repo. Its first lines may hold a **YAML front-matter block**, opened and closed by lines containing `---`. The Hub parses that block to show badges on the model page, to power search filters, and to decide which inference widget to render. You can edit it in the web metadata UI or directly in the file. Because the card is a file in the repo, it is versioned with commits like the weights: the card at `main` today may differ from the card at the commit you pinned. ## The three fields a reviewer starts with | Field | What it declares | Where the Hub uses it | What to watch | |---|---|---|---| | `license` | A licence identifier, for example `apache-2.0` or `mit` | Shown on the page, filterable in search | `other` means a custom licence; look for `license_name` and `license_link` | | `base_model` | The Hub id (or ids) this model derives from | Shown on the page; models can be filtered by base model | A list means a merge; the relation can be inferred or set | | `pipeline_tag` | The task the model is meant for | Task filter, widget choice, which APIs are used | Inferred from `config.json` for Transformers models unless overridden | A few details on each: - **`license`**: the metadata UI offers a dropdown of common identifiers. A custom licence uses `license: other` plus `license_name` and `license_link`, which may point to a licence file stored in the repo. What a given licence actually permits is a separate licensing question; a gated repo may also ask you to accept its terms before downloading. - **`base_model`**: used for fine-tunes, adapters, quantized versions and merges. The Hub infers the kind of relationship (`adapter`, `merge`, `quantized`, `finetune`), and `base_model_relation` sets it explicitly. Following the chain tells a reviewer which upstream checkpoint, card and licence to read next. - **`pipeline_tag`**: for Transformers models the Hub infers it from `config.json`; other libraries often write it themselves. A wrong tag shows the wrong widget and puts the model under the wrong task filter. ## Other fields worth reading - **`library_name`**: which library loads the repo. For repos created after August 2024, the Hub no longer assumes Transformers just because a `config.json` exists, so set `library_name: transformers` explicitly. - **`datasets`**: Hub ids of the datasets the model was trained on, displayed on the page and usable as a search filter. - **`new_version`**: points to a newer model repo, so a reviewer can spot that a checkpoint has been superseded. - **Gating fields**: `extra_gated_prompt` and `extra_gated_fields` customise the access-request form on a gated repo. - **`language`** and **`tags`**: help search and filtering, and say which languages the uploader claims to support. ## Reading it in code 1. `HfApi().model_info(repo_id, revision=sha).card_data` returns the parsed metadata as a `ModelCardData` object at a specific commit. 2. `ModelCard.load(repo_id)` loads the card from the Hub (or from a local file path) and exposes the YAML as `.data` and the prose as `.text`. 3. `ModelCardData` has named attributes for `license`, `license_name`, `license_link`, `base_model`, `pipeline_tag`, `library_name` and `datasets`; other keys are kept as extra attributes. A review script can fail when `license` is missing or `other` without a link, or when `base_model` is absent for something that is clearly a fine-tune. ## A first-pass review checklist 1. Pin the revision you intend to adopt and read the card at that commit. 2. Confirm `license` is present; if it is `other`, open `license_link` and hand the text to whoever reviews licences. 3. Follow `base_model` up the chain and read each ancestor's card the same way. 4. Check that `pipeline_tag` and `library_name` match how you plan to load and use the model. 5. Note the declared `datasets`, and whether `new_version` says the checkpoint has been superseded. ## What the card does not prove - **It is self-declared.** The uploader writes every field; the Hub displays and indexes it but does not certify it. - **It describes intent, not bytes.** Whether the files match the claimed lineage, and whether they can be trusted at all, is an artifact-trust and supply-chain question, answered with other evidence. - **It changes with commits.** Read the card at the revision you pin, not at `main`.
- How do you declare a custom licence that has no standard identifier in a Hub model card?Set `license: other`, then add `license_name` with a short name for the licence and `license_link` pointing to its text, either a URL or a licence file stored in the same repo. The Hub then shows a custom licence instead of an unknown one, and reviewers have a link to read.
- Why might a new Transformers model repo show no library or a wrong widget even though config.json is present?For repos created after August 2024, the Hub no longer assumes Transformers just because a `config.json` exists, so the card should say `library_name: transformers`. A wrong widget usually means `pipeline_tag` was inferred or set to the wrong task; setting it explicitly in the card's YAML fixes both the widget and the task filter.
- The Hub verifies that a model really was trained from the checkpoint named in base_model.
- If the card's license field says apache-2.0, there is nothing else to check.
- pipeline_tag only affects how the page looks and has no other effect.
- The model card at main describes whatever revision you pinned.
- Model card metadata lives in config.json, not in README.md.