模型卡生成器 model-card-generator

模型卡生成器是一个遵循谷歌模型卡框架的自动化文档工具,用于为机器学习模型创建标准化、全面的技术文档。该技能能自动生成包含模型详情、预期用途、性能指标、伦理考量、局限性和版本历史等关键部分的模型卡,支持HTML、Markdown和JSON多种输出格式,旨在提升机器学习项目的透明度、可解释性和可维护性。关键词:模型卡,机器学习文档,模型可解释性,AI伦理,模型评估,自动化文档,MLOps,模型治理。

机器学习 0 次安装 0 次浏览 更新于 2/23/2026

name: model-card-generator description: 遵循谷歌模型卡框架生成模型文档的技能。 allowed-tools:

  • Read
  • Write
  • Bash
  • Glob
  • Grep

model-card-generator

概述

遵循谷歌机器学习模型文档框架,生成全面模型卡的模型文档技能。

能力

  • 模型详情文档(架构、训练等)
  • 预期用途规范
  • 性能指标文档
  • 伦理考量部分
  • 注意事项和局限性
  • 定量分析部分
  • 版本历史追踪
  • 多种输出格式(HTML、Markdown、JSON)

目标流程

  • 模型可解释性与可说明性分析
  • 模型评估与验证框架
  • 机器学习模型再训练流水线

工具与库

  • Model Card Toolkit
  • TensorFlow Model Analysis(可选)
  • Jinja2(模板引擎)

输入模式

{
  "type": "object",
  "required": ["modelDetails", "intendedUse"],
  "properties": {
    "modelDetails": {
      "type": "object",
      "properties": {
        "name": { "type": "string" },
        "version": { "type": "string" },
        "type": { "type": "string" },
        "architecture": { "type": "string" },
        "trainingDate": { "type": "string" },
        "framework": { "type": "string" },
        "citations": { "type": "array", "items": { "type": "string" } },
        "license": { "type": "string" }
      }
    },
    "intendedUse": {
      "type": "object",
      "properties": {
        "primaryUses": { "type": "array", "items": { "type": "string" } },
        "primaryUsers": { "type": "array", "items": { "type": "string" } },
        "outOfScopeUses": { "type": "array", "items": { "type": "string" } }
      }
    },
    "factors": {
      "type": "object",
      "properties": {
        "relevantFactors": { "type": "array", "items": { "type": "string" } },
        "evaluationFactors": { "type": "array", "items": { "type": "string" } }
      }
    },
    "metrics": {
      "type": "object",
      "properties": {
        "performanceMetrics": { "type": "array" },
        "decisionThresholds": { "type": "object" },
        "variationApproaches": { "type": "array" }
      }
    },
    "evaluationData": {
      "type": "object",
      "properties": {
        "datasets": { "type": "array" },
        "motivation": { "type": "string" },
        "preprocessing": { "type": "string" }
      }
    },
    "trainingData": {
      "type": "object",
      "properties": {
        "datasets": { "type": "array" },
        "motivation": { "type": "string" },
        "preprocessing": { "type": "string" }
      }
    },
    "ethicalConsiderations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": { "type": "string" },
          "mitigationStrategy": { "type": "string" }
        }
      }
    },
    "caveatsAndRecommendations": {
      "type": "array",
      "items": { "type": "string" }
    },
    "outputConfig": {
      "type": "object",
      "properties": {
        "format": { "type": "string", "enum": ["html", "markdown", "json"] },
        "outputPath": { "type": "string" }
      }
    }
  }
}

输出模式

{
  "type": "object",
  "required": ["status", "modelCardPath"],
  "properties": {
    "status": {
      "type": "string",
      "enum": ["success", "error"]
    },
    "modelCardPath": {
      "type": "string"
    },
    "format": {
      "type": "string"
    },
    "sections": {
      "type": "array",
      "items": { "type": "string" }
    },
    "warnings": {
      "type": "array",
      "items": { "type": "string" },
      "description": "关于缺失推荐部分的警告"
    }
  }
}

使用示例

{
  kind: 'skill',
  title: '生成模型卡',
  skill: {
    name: 'model-card-generator',
    context: {
      modelDetails: {
        name: '欺诈检测模型',
        version: '2.0.0',
        type: '二分类',
        architecture: 'XGBoost',
        trainingDate: '2024-01-15',
        framework: 'scikit-learn',
        license: '专有'
      },
      intendedUse: {
        primaryUses: ['交易欺诈检测'],
        primaryUsers: ['风险管理团队'],
        outOfScopeUses: ['信用评分', '身份验证']
      },
      metrics: {
        performanceMetrics: [
          { name: 'AUC-ROC', value: 0.95 },
          { name: 'Precision@0.5', value: 0.87 }
        ]
      },
      ethicalConsiderations: [
        { name: '人口统计偏差', mitigationStrategy: '定期公平性审计' }
      ],
      outputConfig: {
        format: 'markdown',
        outputPath: 'docs/model_card.md'
      }
    }
  }
}