Model Card Toolkit
The Model Card Toolkit (MCT) library streamlines and automates generation of Model Cards, machine learning documents that provide context and transparency into a model's development and performance. Integrating the Model Card Toolkit into your ML pipeline will allow you to share your model's metadata and metrics with researchers, developers, reporters, and more.
MCT stores model card fields using a JSON schema. MCT can automatically populate those fields for TFX users via ML Metadata (MLMD). Model card fields can also be manually populated via a Python API. 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.
import model_card_toolkit # Initialize the Model Card Toolkit with a path to store generate assets model_card_output_path = ... mct = model_card_toolkit.ModelCardToolkit(model_card_output_path) # Initialize the model_card_toolkit.ModelCard, which can be freely populated model_card = mct.scaffold_assets() model_card.model_details.name = 'My Model' # Write the model card data to a JSON file mct.update_model_card_json(model_card) # Return the model card document as an HTML page html = mct.export_format()