https://github.com/tensorflow/model-card-toolkit
A toolkit that streamlines and automates the generation of model cards
https://github.com/tensorflow/model-card-toolkit
deep-learning machine-learning model-cards responsible-ai responsible-ml tensorflow transparency
Last synced: 28 days ago
JSON representation
A toolkit that streamlines and automates the generation of model cards
- Host: GitHub
- URL: https://github.com/tensorflow/model-card-toolkit
- Owner: tensorflow
- License: apache-2.0
- Archived: true
- Created: 2020-07-24T16:48:58.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-07-26T12:05:00.000Z (over 2 years ago)
- Last Synced: 2025-01-10T08:33:27.094Z (10 months ago)
- Topics: deep-learning, machine-learning, model-cards, responsible-ai, responsible-ml, tensorflow, transparency
- Language: Python
- Homepage: https://www.tensorflow.org/responsible_ai/model_card_toolkit/guide
- Size: 9.05 MB
- Stars: 427
- Watchers: 20
- Forks: 87
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-privacy-engineering - Model Card Toolkit - Google's Model Card Toolkit streamlines and automates generation of [Model Cards](https://modelcards.withgoogle.com/about), machine learning documents that provide context and transparency into a model's development and performance. (Awesome Privacy Engineering [](https://awesome.re) / Machine Learning and Algorithmic Bias)
- awesome-python-machine-learning-resources - GitHub - 85% open · ⏱️ 28.04.2022): (模型的可解释性)
- awesome-production-machine-learning - Model Card Toolkit - card-toolkit.svg?style=social) - Model Card Toolkit is a toolkit that streamlines and automates the generation of model cards. (Metadata Management)
- jimsghstars - tensorflow/model-card-toolkit - A toolkit that streamlines and automates the generation of model cards (Python)
README
# Model Card Toolkit
[![CI][ci_badge]][ci_link]
[![PyPI][pypi_badge]][pypi_link]
[![Documentation][docs_badge]][docs_link]
The Model Card Toolkit (MCT) streamlines and automates generation of
[Model Cards](https://modelcards.withgoogle.com/about) [1], machine learning documents
that provide context and transparency into a model's development and performance.
Integrating the MCT into your ML pipeline enables you to share model metadata and
metrics with researchers, developers, reporters, and more.
Some use cases of model cards include:
* Facilitating the exchange of information between model builders and product developers.
* Informing users of ML models to make better-informed decisions about how to use them (or how not to use them).
* Providing model information required for effective public oversight and accountability.

## Installation
The Model Card Toolkit is hosted on [PyPI](https://pypi.org/project/model-card-toolkit/),
and requires Python 3.7 or later.
Installing the basic, framework agnostic package:
```sh
pip install model-card-toolkit
```
If you are generating model cards for TensorFlow models, install the optional
TensorFlow dependencies to use Model Card Toolkit's TensorFlow utilities:
```sh
pip install model-card-toolkit[tensorflow]
```
You may need to append the `--use-deprecated=legacy-resolver` flag when running
versions of pip starting with 20.3.
See [the installation guide](model_card_toolkit/documentation/guide/install.md)
for more installation options.
## Getting Started
import model_card_toolkit as mct
# Initialize the Model Card Toolkit with a path to store generate assets
model_card_output_path = ...
toolkit = mct.ModelCardToolkit(model_card_output_path)
# Initialize the ModelCard, which can be freely populated
model_card = toolkit.scaffold_assets()
model_card.model_details.name = 'My Model'
# Write the model card data to a proto file
toolkit.update_model_card(model_card)
# Return the model card document as an HTML page
html = toolkit.export_format()
## Model Card Generation on TFX
If you are using [TensorFlow Extended (TFX)](https://www.tensorflow.org/tfx), you can
incorporate model card generation into your TFX pipeline via the `ModelCardGenerator`
component.
The `ModelCardGenerator` component has moved to the
[TFX Addons](https://github.com/tensorflow/tfx-addons) library and is no longer
packaged in Model Card Toolkit from version 2.0.0. Before you can use the
component, you will need to install the `tfx-addons` package:
```sh
pip install tfx-addons[model_card_generator]
```
See the [ModelCardGenerator guide](https://github.com/tensorflow/tfx-addons/blob/main/tfx_addons/model_card_generator/README.md)
and run the [case study notebook](https://github.com/tensorflow/tfx-addons/blob/main/examples/model_card_generator/MLMD_Model_Card_Toolkit_Demo.ipynb)
to learn more about the component.
## Schema
Model cards are stored in proto as an intermediate format. You can see the model
card JSON schema in the `schema` directory.
## References
[1] https://arxiv.org/abs/1810.03993
[ci_badge]: https://github.com/tensorflow/model-card-toolkit/actions/workflows/ci.yml/badge.svg
[ci_link]: https://github.com/tensorflow/model-card-toolkit/actions/workflows/ci.yml
[pypi_badge]: https://badge.fury.io/py/model-card-toolkit.svg
[pypi_link]: https://badge.fury.io/py/model-card-toolkit
[docs_badge]: https://img.shields.io/badge/TensorFow-page-orange
[docs_link]: https://www.tensorflow.org/responsible_ai/model_card_toolkit/guide