Thanks for tuning in to Google I/O. View all sessions on demandWatch on demand

Model Card 工具包

Model Card Toolkit (MCT) 库会简化并自动生成模型卡片,这是一种有助于深入了解模型的开发过程和性能的机器学习文档。将 Model Card Toolkit 集成到机器学习流水线中后,您便可以与研究人员、开发者、报告人员等人员分享模型的元数据和指标。

MCT 使用 JSON 架构存储模型卡片字段。MCT 可通过 ML Metadata (MLMD) 自动为 TFX 用户填充这些字段。您也可以通过 Python API 手动填充模型卡片字段。模型卡片的一些用例包括:

  • 促进模型构建者和产品开发者之间的信息交换。
  • 为机器学习模型用户提供信息,使他们能够在这些模型的用途(或错误用途)方面做出更加明智的决定。
  • 提供有效公共监督和问责制所需的模型信息。
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()

资源