模型卡工具套件

模型卡工具套件 (MCT) 程式庫可簡化並自動產生模型卡,模型卡是機器學習文件,可提供模型的開發和效能背景資訊和透明度。將模型卡工具套件整合到您的 ML 管線中,即可讓您與研究人員、開發人員、記者等分享模型的metadata和指標。

MCT 使用 JSON schema 儲存模型卡欄位。MCT 可以透過 ML Metadata (MLMD) 為 TFX 使用者自動填入這些欄位。模型卡欄位也可以透過 Python API 手動填入。模型卡的一些用途包括:

  • 促進模型建構者和產品開發人員之間資訊的交流。
  • 告知 ML 模型的使用者,以便他們在如何使用 (或不使用) 模型方面做出更明智的決定。
  • 提供有效的公眾監督和問責所需的模型資訊。
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()

資源