模型卡片工具包 (Model Card Toolkit)

模型卡工具包 (MCT) 库简化并自动化了模型卡 (Model Cards) 的生成,模型卡是用于提供模型开发和性能背景信息及透明度的机器学习文档。将模型卡工具包集成到您的机器学习流水线中,使您能够与研究人员、开发人员、记者等人分享模型的元数据和指标。

MCT 使用 JSON 架构存储模型卡字段。对于 TFX 用户,MCT 可以通过 机器学习元数据 (MLMD) 自动填充这些字段。模型卡字段也可以通过 Python API 手动填充。模型卡的部分使用场景包括:

  • 促进模型构建者与产品开发人员之间的信息交流。
  • 告知机器学习模型的使用者,以便他们就如何使用(或不使用)模型做出更明智的决策。
  • 提供有效的公共监督和问责制所需的模型信息。
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()

资源