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 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 JSON file toolkit.update_model_card_json(model_card) # Return the model card document as an HTML page html = toolkit.export_format()