

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Amazon SageMaker 모델 카드
<a name="model-cards"></a>

**중요**  
Amazon SageMaker Model Card는 SageMaker Model Registry와 통합됩니다. Model Registry에 모델을 등록하는 경우 통합을 사용하여 감사 정보를 추가할 수 있습니다. 자세한 내용은 [모델 버전 세부 정보 업데이트](model-registry-details.md) 단원을 참조하십시오.

Amazon SageMaker 모델 카드를 사용하면 기계 학습(ML) 모델에 대한 중요한 세부 정보를 한 곳에 문서화하여 거버넌스 및 보고를 간소화할 수 있습니다. 모델 카드는 수명 주기 동안 모델에 대한 주요 정보를 캡처하고 책임 있는 AI 관행을 구현하는 데 도움이 될 수 있습니다.

모델의 용도 및 위험 등급, 훈련 세부 정보 및 지표, 평가 결과 및 관찰, 추가 설명(예: 고려 사항, 권장 사항, 사용자 지정 정보)과 같은 세부 정보를 분류합니다. 모델 카드를 생성하여 다음 작업을 수행할 수 있습니다.
+ 모델 사용 방법에 대한 지침을 제공합니다.
+ 모델 훈련 및 성과에 대한 자세한 설명과 함께 감사 활동을 지원합니다.
+ 비즈니스 목표를 지원하기 위한 모델의 용도를 전달합니다.

모델 카드는 문서화할 정보에 대한 권장 가이드를 제공하며 사용자 지정 정보 필드를 포함합니다. 모델 카드를 만든 후 PDF로 내보내거나 다운로드하여 관련 이해 관계자와 공유할 수 있습니다. 모델 카드에 대한 승인 상태 업데이트 이외의 모든 편집은 모델 변경 내용에 대한 변경 불가능한 기록을 남기기 위해 추가 모델 카드 버전을 생성합니다.

**Topics**
+ [사전 조건](#model-cards-prerequisites)
+ [모델의 용도](#model-cards-intended-uses)
+ [위험 등급](#model-cards-risk-rating)
+ [모델 카드 JSON 스키마](#model-cards-json-schema)
+ [모델 카드 생성](model-cards-create.md)
+ [모델 카드 작업](model-cards-manage.md)
+ [Amazon SageMaker Model Cards에 대한 교차 계정 지원 설정](model-cards-xaccount.md)
+ [모델 카드용 하위 수준 SageMaker API](model-cards-apis.md)
+ [모델 카드 FAQ](model-cards-faqs.md)

## 사전 조건
<a name="model-cards-prerequisites"></a>

Amazon SageMaker 모델 카드를 시작하려면 모델 카드를 생성하고, 편집하고, 보고, 내보낼 수 있는 권한이 있어야 합니다.

## 모델의 용도
<a name="model-cards-intended-uses"></a>

모델의 용도를 지정하면 모델 개발자와 사용자가 책임감 있게 모델을 훈련시키거나 배포하는 데 필요한 정보를 확보할 수 있습니다. 모델의 용도는 모델을 사용하기에 적합한 시나리오와 모델 사용이 권장되지 않는 시나리오를 설명해야 합니다.

다음 사항을 포함하는 것이 좋습니다.
+ 모델의 일반 목적 
+ 모델이 의도된 사용 사례 
+ 모델이 의도하지 않은 사용 사례
+ 모델을 개발할 때 세운 전제

모델의 용도는 기술적 세부 사항을 넘어서서 프로덕션 환경에서 모델을 사용하는 방법, 모델을 사용하기에 적합한 시나리오, 추가 고려 사항(예: 모델에 사용할 데이터 유형 또는 개발 중 가정된 사항)을 설명합니다.

## 위험 등급
<a name="model-cards-risk-rating"></a>

개발자는 위험 수준이 다양한 사용 사례를 위한 ML 모델을 만듭니다. 예를 들어 대출 신청을 승인하는 모델은 이메일 카테고리를 탐지하는 모델보다 위험이 더 높은 모델일 수 있습니다. 모델의 다양한 위험 프로필을 고려할 때 모델 카드는 모델의 위험 등급을 분류할 수 있는 필드를 제공합니다.

이 위험 등급은 `unknown`, `low`, `medium`또는 `high`일 수 있습니다. 이러한 위험 등급 필드를 사용하여 알 수 없음, 낮음, 중간 또는 고위험 모델에 레이블을 지정하고 조직이 특정 모델을 생산에 적용하는 것과 관련된 기존 규칙을 준수할 수 있습니다.

## 모델 카드 JSON 스키마
<a name="model-cards-json-schema"></a>

모델 카드의 평가 세부 정보는 JSON 형식으로 제공되어야 합니다. [SageMaker Clarify](https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-processing-job-run.html) 또는 [SageMaker AI Model Monitor](https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-model-quality.html)에서 생성한 기존 JSON 형식 평가 보고서가 있는 경우, 이를 Amazon S3에 업로드하고 평가 지표를 자동으로 구문 분석하도록 S3 URI를 제공하세요. 자세한 내용과 샘플 보고서는 Amazon SageMaker 모델 거버넌스 - 모델 카드 예제 노트북에서 [예제 지표](https://github.com/aws/amazon-sagemaker-examples/tree/main/sagemaker_model_governance/example_metrics) 폴더를 참조하세요.**

SageMaker Python SDK를 사용하여 모델 카드를 생성할 때 모델 콘텐츠는 모델 카드 JSON 스키마에 있어야 하며 문자열로 제공되어야 합니다. 다음 예제와 유사한 모델 콘텐츠를 제공합니다.

### 모델 카드 JSON 스키마 샘플 파일
<a name="model-cards-json-schema-example"></a>

```
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://json-schema.org/draft-07/schema#",
  "title": "SageMakerModelCardSchema",
  "description": "Internal model card schema for SageMakerRepositoryService without model_package_details",
  "version": "0.1.0",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "model_overview": {
      "description": "Overview about the model",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "model_description": {
          "description": "description of model",
          "type": "string",
          "maxLength": 1024
        },
        "model_creator": {
          "description": "Creator of model",
          "type": "string",
          "maxLength": 1024
        },
        "model_artifact": {
          "description": "Location of the model artifact",
          "type": "array",
          "maxContains": 15,
          "items": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "algorithm_type": {
          "description": "Algorithm used to solve the problem",
          "type": "string",
          "maxLength": 1024
        },
        "problem_type": {
          "description": "Problem being solved with the model",
          "type": "string"
        },
        "model_owner": {
          "description": "Owner of model",
          "type": "string",
          "maxLength": 1024
        }
      }
    },
    "intended_uses": {
      "description": "Intended usage of model",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "purpose_of_model": {
          "description": "Why the model was developed?",
          "type": "string",
          "maxLength": 2048
        },
        "intended_uses": {
          "description": "intended use cases",
          "type": "string",
          "maxLength": 2048
        },
        "factors_affecting_model_efficiency": {
          "type": "string",
          "maxLength": 2048
        },
        "risk_rating": {
          "description": "Risk rating for model card",
          "$ref": "#/definitions/risk_rating"
        },
        "explanations_for_risk_rating": {
          "type": "string",
          "maxLength": 2048
        }
      }
    },
    "business_details": {
      "description": "Business details of model",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "business_problem": {
          "description": "What business problem does the model solve?",
          "type": "string",
          "maxLength": 2048
        },
        "business_stakeholders": {
          "description": "Business stakeholders",
          "type": "string",
          "maxLength": 2048
        },
        "line_of_business": {
          "type": "string",
          "maxLength": 2048
        }
      }
    },
    "training_details": {
      "description": "Overview about the training",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "objective_function": {
          "description": "the objective function the model will optimize for",
          "function": {
            "$ref": "#/definitions/objective_function"
          },
          "notes": {
            "type": "string",
            "maxLength": 1024
          }
        },
        "training_observations": {
          "type": "string",
          "maxLength": 1024
        },
        "training_job_details": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "training_arn": {
              "description": "SageMaker Training job arn",
              "type": "string",
              "maxLength": 1024
            },
            "training_datasets": {
              "description": "Location of the model datasets",
              "type": "array",
              "maxContains": 15,
              "items": {
                "type": "string",
                "maxLength": 1024
              }
            },
            "training_environment": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "container_image": {
                  "description": "SageMaker training image uri",
                  "type": "array",
                  "maxContains": 15,
                  "items": {
                    "type": "string",
                    "maxLength": 1024
                  }
                }
              }
            },
            "training_metrics": {
              "type": "array",
              "items": {
                "maxItems": 50,
                "$ref": "#/definitions/training_metric"
              }
            },
            "user_provided_training_metrics": {
              "type": "array",
              "items": {
                "maxItems": 50,
                "$ref": "#/definitions/training_metric"
              }
            },
            "hyper_parameters": {
              "type": "array",
              "items": {
                "maxItems": 100,
                "$ref": "#/definitions/training_hyper_parameter"
              }
            },
            "user_provided_hyper_parameters": {
              "type": "array",
              "items": {
                "maxItems": 100,
                "$ref": "#/definitions/training_hyper_parameter"
              }
            }
          }
        }
      }
    },
    "evaluation_details": {
      "type": "array",
      "default": [],
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "pattern": ".{1,63}"
          },
          "evaluation_observation": {
            "type": "string",
            "maxLength": 2096
          },
          "evaluation_job_arn": {
            "type": "string",
            "maxLength": 256
          },
          "datasets": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 1024
            },
            "maxItems": 10
          },
          "metadata": {
            "description": "additional attributes associated with the evaluation results",
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 1024
            }
          },
          "metric_groups": {
            "type": "array",
            "default": [],
            "items": {
              "type": "object",
              "required": [
                "name",
                "metric_data"
              ],
              "properties": {
                "name": {
                  "type": "string",
                  "pattern": ".{1,63}"
                },
                "metric_data": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "$ref": "#/definitions/simple_metric"
                      },
                      {
                        "$ref": "#/definitions/linear_graph_metric"
                      },
                      {
                        "$ref": "#/definitions/bar_chart_metric"
                      },
                      {
                        "$ref": "#/definitions/matrix_metric"
                      }
                    ]

                  }
                }
              }
            }
          }
        }
      }
    },
    "additional_information": {
      "additionalProperties": false,
      "type": "object",
      "properties": {
        "ethical_considerations": {
          "description": "Any ethical considerations that the author wants to provide",
          "type": "string",
          "maxLength": 2048
        },
        "caveats_and_recommendations": {
          "description": "Caveats and recommendations for people who might use this model in their applications.",
          "type": "string",
          "maxLength": 2048
        },
        "custom_details": {
          "type": "object",
          "additionalProperties": {
            "$ref": "#/definitions/custom_property"
          }
        }
      }
    }
  },
  "definitions": {
    "source_algorithms": {
      "type": "array",
      "minContains": 1,
      "maxContains": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "algorithm_name"
        ],
        "properties": {
          "algorithm_name": {
            "description": "The name of an algorithm that was used to create the model package. The algorithm must be either an algorithm resource in your SageMaker account or an algorithm in AWS Marketplace that you are subscribed to.",
            "type": "string",
            "maxLength": 170
          },
          "model_data_url": {
            "description": "The Amazon S3 path where the model artifacts, which result from model training, are stored.",
            "type": "string",
            "maxLength": 1024
          }
        }
      }
    },
    "inference_specification": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "containers"
      ],
      "properties": {
        "containers": {
          "description": "Contains inference related information which were used to create model package.",
          "type": "array",
          "minContains": 1,
          "maxContains": 15,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "image"
            ],
            "properties": {
              "model_data_url": {
                "description": "The Amazon S3 path where the model artifacts, which result from model training, are stored.",
                "type": "string",
                "maxLength": 1024
              },
              "image": {
                "description": "Inference environment path. The Amazon EC2 Container Registry (Amazon ECR) path where inference code is stored.",
                "type": "string",
                "maxLength": 255
              },
              "nearest_model_name": {
                "description": "The name of a pre-trained machine learning benchmarked by Amazon SageMaker Inference Recommender model that matches your model.",
                "type": "string"
              }
            }
          }
        }
      }
    },
    "risk_rating": {
      "description": "Risk rating of model",
      "type": "string",
      "enum": [
        "High",
        "Medium",
        "Low",
        "Unknown"
      ]
    },
    "custom_property": {
      "description": "Additional property in section",
      "type": "string",
      "maxLength": 1024
    },
    "objective_function": {
      "description": "objective function that training job is optimized for",
      "additionalProperties": false,
      "properties": {
        "function": {
          "type": "string",
          "enum": [
            "Maximize",
            "Minimize"
          ]
        },
        "facet": {
          "type": "string",
          "maxLength": 63
        },
        "condition": {
          "type": "string",
          "maxLength": 63
        }
      }
    },
    "training_metric": {
      "description": "training metric data",
      "type": "object",
      "required": [
        "name",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "notes": {
          "type": "string",
          "maxLength": 1024
        },
        "value": {
          "type": "number"
        }
      }
    },
    "training_hyper_parameter": {
      "description": "training hyper parameter",
      "type": "object",
      "required": [
        "name"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "value": {
          "type": "string",
          "pattern": ".{0,255}"
        }
      }
    },
    "linear_graph_metric": {
      "type": "object",
      "required": [
        "name",
        "type",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "notes": {
          "type": "string",
          "maxLength": 1024
        },
        "type": {
          "type": "string",
          "enum": [
            "linear_graph"
          ]
        },
        "value": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "minItems": 2,
                "maxItems": 2
              },
              "minItems": 1
            }
          ]
        },
        "x_axis_name": {
          "$ref": "#/definitions/axis_name_string"
        },
        "y_axis_name": {
          "$ref": "#/definitions/axis_name_string"
        }
      }
    },
    "bar_chart_metric": {
      "type": "object",
      "required": [
        "name",
        "type",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "notes": {
          "type": "string",
          "maxLength": 1024
        },
        "type": {
          "type": "string",
          "enum": [
            "bar_chart"
          ]
        },
        "value": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "number"
              },
              "minItems": 1
            }
          ]
        },
        "x_axis_name": {
          "$ref": "#/definitions/axis_name_array"
        },
        "y_axis_name": {
          "$ref": "#/definitions/axis_name_string"
        }
      }
    },
    "matrix_metric": {
      "type": "object",
      "required": [
        "name",
        "type",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "notes": {
          "type": "string",
          "maxLength": 1024
        },
        "type": {
          "type": "string",
          "enum": [
            "matrix"
          ]
        },
        "value": {
          "anyOf": [
            {
              "type": "array",
              "items": {
                "type": "array",
                "items": {
                  "type": "number"
                },
                "minItems": 1,
                "maxItems": 20
              },
              "minItems": 1,
              "maxItems": 20
            }
          ]
        },
        "x_axis_name": {
          "$ref": "#/definitions/axis_name_array"
        },
        "y_axis_name": {
          "$ref": "#/definitions/axis_name_array"
        }
      }
    },
    "simple_metric": {
      "description": "metric data",
      "type": "object",
      "required": [
        "name",
        "type",
        "value"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "pattern": ".{1,255}"
        },
        "notes": {
          "type": "string",
          "maxLength": 1024
        },
        "type": {
          "type": "string",
          "enum": [
            "number",
            "string",
            "boolean"
          ]
        },
        "value": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "string",
              "maxLength": 63
            },
            {
              "type": "boolean"
            }
          ]
        },
        "x_axis_name": {
          "$ref": "#/definitions/axis_name_string"
        },
        "y_axis_name": {
          "$ref": "#/definitions/axis_name_string"
        }
      }
    },
    "axis_name_array": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 63
      }
    },
    "axis_name_string": {
      "type": "string",
      "maxLength": 63
    }
  }
}
```

# 모델 카드 생성
<a name="model-cards-create"></a>

**중요**  
Amazon SageMaker Studio 또는 Amazon SageMaker Studio Classic에서 Amazon SageMaker 리소스를 만들도록 허용하는 사용자 지정 IAM 정책은 해당 리소스에 태그를 추가할 수 있는 권한도 부여해야 합니다. Studio와 Studio Classic은 만드는 리소스에 태그를 자동으로 지정하기 때문에 리소스에 태그를 추가할 권한이 필요합니다. IAM 정책이 Studio 및 Studio Classic에서 리소스를 만들도록 허용하지만 태그 지정은 허용하지 않는 경우 리소스 만들기를 시도할 때 'AccessDenied' 오류가 발생할 수 있습니다. 자세한 내용은 [SageMaker AI 리소스 태그 지정을 위한 권한 제공](security_iam_id-based-policy-examples.md#grant-tagging-permissions) 섹션을 참조하세요.  
SageMaker 리소스를 만들 수 있는 권한을 부여하는 [AWS Amazon SageMaker AI에 대한 관리형 정책](security-iam-awsmanpol.md)에는 해당 리소스를 만드는 동안 태그를 추가할 수 있는 권한이 이미 포함되어 있습니다.

SageMaker AI 콘솔 또는 SageMaker Python SDK를 사용하여 Amazon SageMaker 모델 카드를 생성할 수 있습니다. 직접 API 작업을 사용할 수도 있습니다. 이러한 API 작업에 대한 자세한 내용은 [모델 카드용 하위 수준 SageMaker API](model-cards-apis.md)섹션을 참조하세요.

## SageMaker AI 콘솔을 사용하여 모델 카드 생성
<a name="model-cards-console-create"></a>

Amazon SageMaker AI 콘솔로 이동합니다. 탐색 창의 **거버넌스**에서 **모델 카드**를 선택합니다. 오른쪽 상단 모서리에서 **모델 카드 생성**을 선택합니다.

**모델 카드 생성** 프롬프트의 4단계를 수행하여 모델에 대한 세부 정보를 문서화하세요.

### 1단계: 모델 세부 정보 및 용도 입력
<a name="model-cards-console-create-enter-model-details"></a>

모델이 AWS 리소스인 경우이 필드에 정확한 모델 이름을 지정하여 모델 세부 정보를 자동으로 채웁니다. 기존 모델 이름을 찾아보려면 Amazon SageMaker AI 콘솔에서 **모델**을 참조하세요. 각 고유 모델 이름은 연결된 모델 카드가 하나만 가질 수 있습니다.

모델이 AWS 리소스가 아닌 경우 모델의 고유한 이름을 제공합니다. 모델을 AWS 리소스로 추가하려면 *Amazon SageMaker AI 개발자 안내서*의 [모델 생성을](https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints-deployment.html#realtime-endpoints-deployment-create-model) 참조하세요. 또는 [SageMaker AI Marketplace](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-marketplace.html) 또는 [SageMaker AI Model Registry](https://docs.aws.amazon.com/sagemaker/latest/dg/model-registry.html)를 사용하여 모델을 모델 패키지로 추가할 수 있습니다.

용도에 대한 자세한 내용은 [모델의 용도](model-cards.md#model-cards-intended-uses)섹션을 참조하세요. 위험 등급에 대한 자세한 내용은 [위험 등급](model-cards.md#model-cards-risk-rating)섹션을 참조하세요.

#### 2단계: 훈련 세부 정보 입력
<a name="model-cards-console-create-enter-training-details"></a>

훈련 세부 정보, 훈련 관찰, 데이터세트, 하이퍼파라미터, 모델의 목표 함수에 대한 세부 정보를 모델 카드에 추가합니다.

모델 카드의 목표 함수는 훈련 중에 최적화된 모든 함수일 수 있습니다. 여기에는 비용 함수, 손실 함수 또는 목표 지표가 포함될 수 있지만 이에 국한되지는 않습니다. 이 섹션에서 모델 훈련에 가장 중요한 목표 함수를 설명하세요.

목표 함수의 다음 속성을 카탈로그로 작성하는 것이 좋습니다.
+ 최적화 방향
+ 지표
+ 설명

예를 들어, 바이너리 분류 문제(설명)의 경우 교차 엔트로피 손실(지표)을 최소화(최적화 방향)하거나 로지스틱 회귀 가능성을 최대화할 수 있습니다. 또한 다른 것보다 이 목표 함수를 선택한 이유에 대한 메모도 제공할 수 있습니다.

#### 3단계: 평가 세부 정보 입력
<a name="model-cards-console-create-enter-evaluation-details"></a>

SageMaker Clarify 또는 모델 모니터에서 생성한 기존 평가 보고서가 있는 경우, 해당 보고서에 대한 S3 URI를 제공하거나 수동으로 업로드하여 모델 카드에 추가하세요.

자세한 내용은 [바이어스 분석 및 설명 가능성을 위해 SageMaker Clarify 처리 작업 실행](https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-processing-job-run.html)을 참조하세요.

모델 모니터를 사용하여 모델 품질 지표의 드리프트를 모니터링하는 방법에 대한 자세한 내용은 [모델 품질 모니터링](https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-model-quality.html)을 참조하세요.

자체 평가 보고서를 추가하려면 **일반 모델 카드 평가**를 선택합니다. 모든 모델 카드 평가 보고서는 [모델 카드 JSON 스키마](model-cards.md#model-cards-json-schema)에 있어야 합니다.

#### 4단계: 추가 세부 정보 입력
<a name="model-cards-console-create-enter-additional-details"></a>

모델 카드에서 다루려는 추가 정보에 대한 사용자 지정 모델 카드 세부 정보 필드를 추가하세요. 예를 들어, 사용자 지정 필드 사업 부문(LOB)을 개인 금융이라는 값과 함께 포함할 수 있습니다.****

#### 모델 카드 저장
<a name="model-cards-console-create-save"></a>

모델 카드의 정보를 검토한 후 오른쪽 하단 모서리에서 **저장**을 선택하여 모델 카드를 저장합니다.

## SageMaker Python SDK를 사용하여 모델 카드 생성
<a name="model-cards-sdk-create"></a>

모델 카드를 생성하기 전에 먼저 모델 카드의 콘텐츠를 정의해야 합니다. SageMaker Python SDK를 사용하는 경우 모델 콘텐츠는 모델 개요, 훈련 세부 정보, 용도, 평가 세부 정보 및 추가 정보로 구성됩니다.

다음에 대한 모델 카드를 생성할 수 있습니다:
+ SageMaker AI에서 호스팅되는 모델
+ SageMaker 모델 레지스트리 내의 모델 패키지(모델)
+ SageMaker AI 외부에서 호스팅되거나 등록된 모델

모델을 연결하지 않고도 모델 카드를 생성할 수 있습니다.

훈련한 모델을 SageMaker 모델 레지스트리에 추가하는 것이 좋습니다. 모델 레지스트리는 모델을 카탈로그화하고 모델 버전을 추적하는 데 도움이 됩니다. 모델 카드를 생성하면 모델 레지스트리의 모델 정보가 모델 카드에 자동으로 채워집니다. 모델 카드를 생성한 후 모델 카드를 편집하거나 정보를 추가할 수 있습니다.

모델 레지스트리에 대한 자세한 내용은 [Model Registry를 사용한 모델 등록 배포](model-registry.md)섹션을 참조하세요. 모델 레지스트리에서 모델 카드를 생성하는 방법에 대한 자세한 내용은 [SageMaker 모델 레지스트리에서 모델을 위한 모델 카드를 생성합니다.](#model-cards-sdk-create-model-registry)섹션을 참조하세요.

**참고**  
SageMaker Python SDK와 함께 모델 카드를 사용하려면 먼저 SageMaker AI 세션을 설정해야 합니다. 자세한 내용은 SageMaker Python SDK API 참조의 [세션](https://sagemaker.readthedocs.io/en/stable/api/utility/session.html)을 참조하세요.

SageMaker 모델 레지스트리에 없는 모델을 위한 모델 카드를 생성하려면 [모델 레지스트리에 없는 모델 생성](#model-card-sdk-create-model-non-model-registry)섹션을 참조하세요.

### 모델 레지스트리에 없는 모델 생성
<a name="model-card-sdk-create-model-non-model-registry"></a>

다음 섹션의 정보를 사용하여 모델 레지스트리에 추가하지 않은 모델의 모델 카드를 생성할 수 있습니다.

#### 1단계: 모델 개요 정의
<a name="model-cards-sdk-create-model-overview"></a>

모델 개요를 정의합니다.

```
model_overview = ModelOverview.from_model_name(
model_name=model_name,
sagemaker_session=sagemaker_session,
model_description="A-description-of-your-model",
problem_type="Problem-type", # For example, "Binary Classification"
algorithm_type="Algorithm-type", # For example, "Logistic Regression"
model_creator="Name-of-model-creator",
model_owner="Name-of-model-owner",
)
```

모델이 AWS 리소스인 경우 모델 ARN, 추론 컨테이너 URI, 모델 아티팩트의 S3 위치와 같은 개요 정보를 자동으로 검색할 수 있습니다. 다음 명령을 사용하여 연결된 AWS 메타데이터를 인쇄합니다.

```
print(model_overview.model_id)
print(model_overview.inference_environment.container_image)
print(model_overview.model_artifact)
```

#### 2단계: 훈련 세부 정보 정의
<a name="model-cards-sdk-create-training-details"></a>

모델의 훈련 세부 정보를 정의하려면 먼저 목표 함수를 정의해야 합니다.

```
objective_function = ObjectiveFunction(
    function=Function(
        function=ObjectiveFunctionEnum.MINIMIZE,
        facet=FacetEnum.LOSS,
    ),
    notes="An-explanation-about-objective-function",
)
```

다음으로 기존 모델 개요, 세션 및 목표 함수를 사용하여 훈련 세부 정보를 정의할 수 있습니다. 여기에 훈련 관찰 결과를 모두 추가합니다.

```
training_details = TrainingDetails.from_model_overview(
    model_overview=model_overview,
    sagemaker_session=sagemaker_session,
    objective_function=objective_function,
    training_observations="Model-training-observations",
)
```

다시 한 번, 모델이 AWS 리소스인 경우 특정 훈련 세부 정보가 자동으로 채워집니다. 다음 명령을 사용하여 훈련 작업 ARN, 훈련 컨테이너 URI, 훈련 지표를 인쇄합니다.

```
print(training_details.training_job_details.training_arn)
print(training_details.training_job_details.training_environment.container_image) 
print([{"name": i.name, "value": i.value} for i in training_details.training_job_details.training_metrics])
```

#### 평가 세부 정보를 정의합니다.
<a name="model-cards-sdk-create-evalutation-details"></a>

모델의 평가 세부 정보를 정의하려면 먼저 평가 작업에 사용되는 지표를 설명하는 지표 그룹을 하나 이상 정의해야 합니다.

```
my_metric_group = MetricGroup(
name="binary classification metrics",
metric_data=[Metric(name="accuracy", type=MetricTypeEnum.NUMBER, value=0.5)]
)
```

그런 다음 각 평가 작업에 대한 평가 지표와 데이터세트를 사용하여 평가 세부 정보를 정의할 수 있습니다. 여기에 평가 관찰 내용을 추가하고 평가 작업에 고유한 이름을 지정합니다.

```
evaluation_details = [
    EvaluationJob(
        name="Example-evaluation-job",
        evaluation_observation="Evaluation-observations",
        datasets=["s3://path/to/evaluation/data"],
        metric_groups=[my_metric_group],
    )
]
```

[SageMaker AI Clarify](https://docs.aws.amazon.com/sagemaker/latest/dg/clarify-processing-job-run.html) 또는 [SageMaker AI Model Monitor](https://docs.aws.amazon.com/sagemaker/latest/dg/model-monitor-model-quality.html)에서 생성한 기존 평가 보고서가 있는 경우, 이를 Amazon S3에 업로드하고 평가 지표를 자동으로 구문 분석하도록 S3 URI를 제공하세요. 고유한 일반 모델 카드 평가 보고서를 추가하려면 [평가 결과 JSON 형식](https://docs.aws.amazon.com/sagemaker/latest/dg/model-cards-json-schema.html)의 보고서를 제공하세요.

```
report_type = "clarify_bias.json"
example_evaluation_job.add_metric_group_from_json(
    f"example_metrics/{report_type}", EvaluationMetricTypeEnum.CLARIFY_BIAS
)
```

#### 3단계: 용도 정의
<a name="model-cards-sdk-create-intended-uses"></a>

모델의 일반 용도와 의도된 사용 사례를 포함하여 모델의 용도를 정의합니다. 또한 특정 사용 사례에서 이 모델의 효율성에 영향을 미칠 수 있는 모든 요인과 모델에 대한 조직의 위험 등급을 포함하는 것이 좋습니다. 자세한 정보는 [모델의 용도](model-cards.md#model-cards-intended-uses)및 [위험 등급](model-cards.md#model-cards-risk-rating)섹션을 참조하세요.

```
intended_uses = IntendedUses(
purpose_of_model="Purpose-of-the-model",
intended_uses="The-intended-uses-of-this-model",
factors_affecting_model_efficiency="Any-factors-effecting-model-efficacy",
risk_rating=RiskRatingEnum.LOW,
explanations_for_risk_rating="Explanation-for-low-risk-rating",
)
```

#### 추가 정보 정의
<a name="model-cards-sdk-create-additional-details"></a>

마지막으로 모델 카드에 사용자 지정 정보를 추가할 수 있습니다. 모델에 대한 윤리적 고려 사항, 주의 사항 및 권장 사항을 문서화할 수 있습니다. 키-값 페어 형식으로 원하는 사용자 지정 세부 정보를 추가할 수도 있습니다.

```
additional_information = AdditionalInformation(
ethical_considerations="Any-ethical-considerations",
caveats_and_recommendations="Any-caveats-and-recommendations",
custom_details={"custom details1": "details-value"},
)
```

#### 4단계: 모델 카드 생성
<a name="model-cards-sdk-create-define"></a>

모델 카드의 이름을 지정하고 모델 카드를 정의한 다음 해당 정의를 사용하여 SageMaker Python SDK를 사용하여 모델 카드를 생성합니다.

```
model_card_name = "my-model-card"
my_card = ModelCard(
    name=model_card_name,
    status=ModelCardStatusEnum.DRAFT,
    model_overview=model_overview,
    training_details=training_details,
    intended_uses=intended_uses,
    evaluation_details=evaluation_details,
    additional_information=additional_information,
    sagemaker_session=sagemaker_session,
)
my_card.create()
```

### SageMaker 모델 레지스트리에서 모델을 위한 모델 카드를 생성합니다.
<a name="model-cards-sdk-create-model-registry"></a>

모델 카드를 생성하기 전에 모델 패키지 그룹과 모델 패키지를 생성했는지 확인하세요. 모델 레지스트리에 대한 자세한 내용은 [Model Registry를 사용한 모델 등록 배포](model-registry.md)섹션을 참조하세요.

**중요**  
SageMaker 모델 레지스트리의 작업을 사용할 수 있는 권한이 있어야 합니다. `AmazonSageMakerModelRegistryFullAccess` AWS 관리형 정책을 사용하는 것이 좋습니다. 관리형 정책에 대한 자세한 내용은 [AWS 모델 레지스트리에 대한 관리형 정책](security-iam-awsmanpol-model-registry.md)섹션을 참조하세요.

SageMaker Python SDK를 사용하여 SageMaker 모델 레지스트리 내에 모델 패키지용 모델 카드를 생성할 수 있습니다. 모델 패키지는 사용자가 훈련시킨 모델입니다. 모델 카드를 생성하면 Amazon SageMaker 모델 카드는 모델 패키지의 데이터를 모델 카드로 자동으로 가져옵니다.

모델 패키지용 모델 카드를 생성할 때 Amazon SageMaker 모델 카드는 [DescribeModelPackage](https://docs.aws.amazon.com/APIReference/API_DescribeModelPackage.html#API_DescribeModelPackage_ResponseSyntax) 작업을 사용하여 모델 패키지의 데이터를 모델 카드에 추가합니다. 다음은 모델 패키지에서 모델 카드로 가져올 수 있는 필드의 예입니다.
+ [ModelDataUrl](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ModelPackageContainerDefinition.html#sagemaker-Type-ModelPackageContainerDefinition-ModelDataUrl)
+ [ModelPackageDescription](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html#sagemaker-DescribeModelPackage-response-ModelPackageDescription)
+ [ModelPackageGroupName](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html#sagemaker-DescribeModelPackage-response-ModelPackageGroupName)
+ [ModelPackageStatus](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html#sagemaker-DescribeModelPackage-response-ModelPackageStatus)
+ [ModelPackageVersion](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html#sagemaker-DescribeModelPackage-response-ModelPackageVersion)

다음 코드를 사용하여 모델 패키지를 정의하고 모델 패키지를 기반으로 모델 카드를 생성하세요.

```
mp_details = ModelPackage.from_model_package_arn(
    model_package_arn="example_model_package_arn",
    sagemaker_session=sagemaker_session,
)

model_card_name = "example-model-card"
my_card = ModelCard(
    name=model_card_name,
    status=ModelCardStatusEnum.status,
    model_package_details=mp_details,
    sagemaker_session=sagemaker_session,
)
my_card.create()
```

`status`의 경우, 모델 카드의 승인 상태를 지정하고 있습니다. 상태를 지정하지 않을 경우 SageMaker 모델 카드는 `DRAFT`의 기본값을 사용합니다. SageMaker AI 세션을 지정하지 않는 경우 SageMaker Model Cards는 기본 SageMaker AI 세션을 사용합니다.

모델 이름과 모델 패키지의 Amazon 리소스 이름(ARN)을 지정해야 합니다. 모델 패키지의 Amazon 리소스 이름(ARN)을 가져오는 방법에 대한 자세한 내용은 [모델 버전 세부 정보 확인 및 업데이트(Boto3)](model-registry-details.md#model-registry-details-api)섹션을 참조하세요.

모델 패키지에서 생성한 모델 카드에 누락되거나 부정확한 정보가 있을 수 있습니다. 모델 카드에 정보를 추가하거나 편집할 수 있습니다. 모델 카드 관리에 대한 자세한 내용은 [모델 카드 작업](model-cards-manage.md)섹션을 참조하세요.

SageMaker 모델 레지스트리는 모델 패키지의 버전 관리를 지원합니다. 모델 패키지의 버전을 관리하고 각 버전에 대한 모델 카드를 생성할 수 있습니다. 이전 버전의 모델 카드의 정보는 후속 버전에서 생성된 모델 카드에 전달됩니다. 예를 들어, 모델 패키지의 버전 1, 버전 2, 버전 3이 있을 수 있습니다. 버전 1용 모델 카드는 이미 만들었지만 버전 2용 모델 카드는 만들지 않았다고 가정해 보겠습니다. 버전 3용 모델 카드를 생성하는 경우 Amazon SageMaker 모델 카드는 버전 1용 모델 카드에서 버전 3용 모델 카드로 정보를 자동으로 전달합니다.

**참고**  
버전 관리를 사용하지 않는 모델 패키지용 모델 카드를 생성할 수도 있습니다. 하지만 대부분의 기계 학습 워크플로에는 동일한 모델의 여러 버전이 포함되므로 다음을 수행하는 것이 좋습니다.  
각 모델 패키지에 대해 하나의 버전 생성
각 모델 패키지의 각 버전에 대해 하나의 모델 카드 생성

# 모델 카드 작업
<a name="model-cards-manage"></a>

모델 카드를 생성한 후 모델 카드를 관리할 수 있습니다. 모델 카드 관리에는 다음 작업이 포함됩니다.
+ 모델 카드 편집
+ 모델 카드 삭제
+ 모델 카드를 PDF로 내보내기

Amazon SageMaker AI 콘솔 또는 SageMaker Python SDK를 사용하여 관리할 수 있습니다. Python SDK 사용에 대한 자세한 내용은 SageMaker Python SDK API 참조의 [Amazon SageMaker Model Cards](https://sagemaker.readthedocs.io/en/stable/api/governance/model_card.html)를 참조하세요.

SageMaker Python SDK를 사용하는 노트북 예시는 *[Amazon SageMaker Model Governance - Model Card](https://github.com/aws/amazon-sagemaker-examples/tree/main/sagemaker_model_governance/model_card.ipynb)* 예시 노트북을 참조하세요.

**Topics**
+ [모델 카드 편집](model-cards-console-edit.md)
+ [모델 카드 내보내기](model-cards-console-export.md)
+ [모델 카드 삭제](model-cards-console-delete.md)

# 모델 카드 편집
<a name="model-cards-console-edit"></a>

모델 카드를 편집하려면 Amazon SageMaker 모델 카드 Console에서 이름을 선택하여 선택한 모델 카드로 이동한 다음 **편집**을 선택합니다.

모델 카드를 저장한 후에는 모델 카드의 이름을 편집할 수 없습니다. 모델 카드 버전을 저장한 후에는 모델 카드의 해당 버전을 업데이트할 수 없습니다. 모델 변경 내용에 대한 변경 불가능한 기록을 남기기 위해 편집해야 하는 모든 내용은 후속 버전으로 저장됩니다.

모델 카드의 다른 버전을 보려면 **작업**, **버전 선택**을 선택한 다음 보려는 버전을 선택합니다.

`model_card.update()` 메서드를 사용하여 모델 카드를 편집할 수 있습니다. 모델 카드를 업데이트하면 모델 변경 내용의 변경 불가능한 기록을 남기기 위해 새 모델 카드 버전이 생성됩니다. 모델 카드의 이름은 업데이트할 수 없습니다.

```
my_card.model_overview.model_description = "updated-model-decription"
my_card.update()
```

# 모델 카드 내보내기
<a name="model-cards-console-export"></a>

모델 카드를 내보내려면 다음 단계를 따르세요.

1. Amazon SageMaker 모델 카드 콘솔로 이동합니다.

1. 내보내려는 모델 카드의 이름을 선택합니다.

1. 모델 카드 개요에서 **작업**을 선택한 다음 **PDF 내보내기**를 선택합니다.

1. S3 URI를 입력하거나 모델 카드 PDF에 사용할 수 있는 S3 버킷을 찾아보세요.

1. 모델 카드가 성공적으로 내보내지면 결과 배너에서 **PDF 다운로드**를 선택하거나 Amazon S3에서 직접 PDF를 다운로드할 수 있습니다.

S3 출력 경로를 지정하여 SageMaker Python SDK에서 모델 카드를 내보내고 다음 명령을 사용하여 해당 경로로 모델 카드 PDF를 내보낼 수 있습니다.

```
s3_output_path = f"s3://{bucket}/{prefix}/export"
pdf_s3_url = my_card.export_pdf(s3_output_path=s3_output_path).delete()
```

# 모델 카드 삭제
<a name="model-cards-console-delete"></a>

다음 단계에 따라 하나 이상의 모델 카드를 영구 삭제하세요.

1. Amazon SageMaker 모델 카드 콘솔로 이동합니다.

1. 삭제할 카드의 이름 왼쪽에 있는 상자를 선택합니다.

1. 오른쪽 상단 모서리에서 **삭제**를 선택합니다.

1. 하나 이상의 카드를 영구 삭제하라는 요청을 확인합니다.

콘솔에서 모델 카드 개요를 볼 때 **작업**을 선택한 다음 **모델 카드 삭제**를 선택하여 모델 카드를 삭제할 수도 있습니다.

SageMaker Python SDK 내에서 다음 명령을 사용하여 모델 카드를 영구적으로 삭제할 수 있습니다.

```
my_card.delete()
```

# Amazon SageMaker Model Cards에 대한 교차 계정 지원 설정
<a name="model-cards-xaccount"></a>

Amazon SageMaker 모델 카드에서 교차 계정 지원을 사용하여 AWS 계정 간에 모델 카드를 공유합니다. 모델 카드가 생성되는 계정은 모델 카드 계정입니다.** 모델 카드 계정의 사용자는 공유 계정과 모델 카드 계정을 공유합니다.** 공유 계정의 사용자는 모델 카드를 업데이트하거나 모델 카드를 PDF로 만들 수 있습니다.

모델 카드 계정의 사용자는 AWS Resource Access Manager (AWS RAM)를 통해 모델 카드를 공유하므로 AWS 계정 간에 리소스를 공유할 AWS RAM 수 있습니다. 에 대한 소개는 [란 무엇입니까 AWS Resource Access Manager?](https://docs.aws.amazon.com/ram/latest/userguide/what-is.html)를 AWS RAM참조하세요.

모델 카드를 공유하는 프로세스는 다음과 같습니다.

1. 모델 카드 계정의 사용자가 AWS Resource Access Manager를 사용하여 교차 계정 모델 카드 공유를 설정합니다.

1. 모델 카드가 AWS KMS 키로 암호화된 경우 모델 공유를 설정하는 사용자도 공유 계정의 사용자에게 AWS KMS 권한을 제공해야 합니다.

1. 공유 계정의 사용자가 리소스 공유에 대한 초대를 수락합니다.

1. 공유 계정의 사용자는 다른 사용자에게 모델 카드에 액세스할 수 있는 권한을 제공합니다.

모델 카드 계정 사용자인 경우 다음 섹션을 참조하세요.
+ [교차 계정 모델 카드 공유 설정](#model-cards-xaccount-set-up)
+ [공유 계정에 대한 AWS KMS 권한 설정](#model-cards-xaccount-kms)
+ [리소스 공유 초대에 대한 응답 수신](#model-cards-xaccount-set-up-responses)

공유 계정의 사용자인 경우 본인 및 해당 계정의 다른 사용자에 대한 권한 설정에 대해 [공유 계정에서 IAM 사용자 권한 설정](#model-cards-xaccount-shared-account-permissions)섹션을 참조하세요.

## 교차 계정 모델 카드 공유 설정
<a name="model-cards-xaccount-set-up"></a>

 AWS Resource Access Manager (AWS RAM)를 사용하여 AWS 계정의 사용자에게 다른 AWS 계정에서 생성된 모델 카드를 보거나 업데이트할 수 있는 액세스 권한을 부여합니다.

모델 카드 공유를 설정하려면 리소스 공유를 생성해야 합니다. 리소스 공유는 다음 사항을 지정합니다.
+ 공유 중인 리소스
+ 리소스에 액세스할 수 있는 사용자 또는 대상
+ 리소스에 대한 관리형 권한

리소스 공유에 대한 자세한 내용은 [AWS RAM에 대한 용어 및 개념](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-terms-and-concepts.html)을 참조하세요. 리소스 공유 생성 프로세스를 진행하기 전에 시간을 내어 AWS RAM 개념적으로 이해하는 것이 좋습니다.

**중요**  
리소스 공유를 생성할 권한이 있어야 합니다. 권한에 대한 자세한 내용은 [AWS RAM 에서 IAM을 사용하는 방법을](https://docs.aws.amazon.com/ram/latest/userguide/security-iam-policies.html) 참조하세요.

리소스 공유를 만드는 절차와 이에 대한 추가 정보는 [리소스 공유 생성](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-sharing.html#getting-started-sharing-create)을 참조하세요.

리소스 공유를 생성하는 절차를 진행할 때 리소스 유형으로 `sagemaker:ModelCard`를 지정합니다. AWS RAM 리소스 기반 정책의 Amazon 리소스 번호(ARN)도 지정해야 합니다. 기본 정책을 지정하거나 모델 카드의 PDF를 생성할 수 있는 추가 권한이 있는 정책을 지정할 수 있습니다.

기본 `AWSRAMPermissionSageMakerModelCards`리소스 기반 정책을 사용하면 공유 계정의 사용자에게 다음 작업을 수행할 수 있는 권한이 있습니다.
+  [DescribeModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelCard.html)
+ [ListModelCardVersions](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListModelCardVersions.html)
+ [UpdateModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelCard.html)

`AWSRAMPermissionSageMakerModelCardsAllowExport` 리소스 기반 정책을 사용하면 공유 계정의 사용자는 위의 모든 작업을 수행할 수 있는 권한을 가집니다. 또한 모델 카드 내보내기 작업을 생성하고 다음 작업을 통해 해당 작업을 설명할 수 있는 권한도 있습니다.
+ [CreateModelCardExportJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModelCardExportJob.html)
+ [DescribeModelCardExportJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelCardExportJob.html)

공유 계정의 사용자는 내보내기 작업을 생성하여 모델 카드의 PDF를 생성할 수 있습니다. 또한 PDF의 Amazon S3 URI를 찾기 위해 생성된 내보내기 작업에 대해서도 설명할 수 있습니다.

모델 카드와 내보내기 작업은 리소스입니다. 모델 카드 계정은 공유 계정에서 사용자가 생성한 내보내기 작업을 소유합니다. 예를 들어, 계정 A의 사용자가 모델 카드 X를 공유 계정 B와 공유하는 경우, 계정 B의 사용자는 계정 B의 사용자가 지정하는 Amazon S3 위치에 출력을 저장하는 모델 카드 X에 대한 내보내기 작업 Y를 생성합니다. 계정 B가 내보내기 작업 Y를 생성했지만 이 작업은 계정 A에 속합니다.

각 AWS 계정에는 리소스 할당량이 있습니다. 모델 카드와 관련된 할당량에 대한 자세한 내용은 [Amazon SageMaker 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sagemaker.html#limits_sagemaker)을 참조하세요.

### 공유 계정에 대한 AWS KMS 권한 설정
<a name="model-cards-xaccount-kms"></a>

공유 중인 모델 카드가 AWS Key Management Service 키로 암호화된 경우 키에 대한 액세스 권한도 공유 계정과 공유해야 합니다. 그렇지 않으면 공유 계정의 사용자가 모델 카드를 보거나 업데이트하거나 내보낼 수 없습니다. 에 대한 개요는 단원을 AWS KMS참조하십시오[AWS Key Management Service](https://docs.aws.amazon.com/kms/latest/developerguide/overview.html).

공유 계정의 사용자에게 AWS KMS 권한을 제공하려면 다음 문으로 키 정책을 업데이트합니다.

```
{
    "Effect": "Allow",
    "Principal": {
        "AWS": [
            "arn:aws:iam::shared-account-id::role/example-IAM-role"
        ]
    },
    "Action": [
        "kms:GenerateDataKey",
        "kms:Decrypt",
    ]
    "Resource": "arn:aws:kms:AWS-Region-of-model-card-account:model-card-account-id:key/AWS KMS-key-id"
    "Condition": {
        "Bool": {"kms:GrantIsForAWSResource": true },
        "StringEquals": {
            "kms:ViaService": [
                "sagemaker.AWS-Region.amazonaws.com", 
                "s3.AWS-Region.amazonaws.com"
            ],
        },
        "StringLike": {
          "kms:EncryptionContext:aws:sagemaker:model-card-arn": "arn:aws:sagemaker:AWS-Region:model-card-account-id:model-card/model-card-name"
        }
    }    
}
```

위의 설명문은 공유 계정의 사용자에게 `kms:Decrypt`및 `kms:GenerateDataKey`권한을 제공합니다. `kms:Decrypt`를 사용하여 사용자는 모델 카드를 복호화할 수 있습니다. `kms:GenerateDataKey`를 사용하면 사용자가 업데이트한 모델 카드나 자신이 만든 PDF를 암호화할 수 있습니다.

### 리소스 공유 초대에 대한 응답 수신
<a name="model-cards-xaccount-set-up-responses"></a>

리소스 공유를 생성하고 나면 리소스 공유에서 지정한 공유 계정에 가입하라는 초대가 전송됩니다. 초대를 수락해야 리소스에 액세스할 수 있습니다.

리소스 공유 초대 수락에 대한 자세한 내용은 *AWS Resource Access Manager 사용 설명서*의 [공유 AWS 리소스 사용을 ](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-shared.html)참조하세요.

### 공유 계정에서 IAM 사용자 권한 설정
<a name="model-cards-xaccount-shared-account-permissions"></a>

다음 정보는 모델 카드 계정의 리소스 공유 초대를 수락했다고 가정합니다. 리소스 공유 초대 수락에 대한 자세한 내용은 [공유 AWS 리소스 사용을 참조하세요](https://docs.aws.amazon.com/ram/latest/userguide/getting-started-shared.html).

귀하와 계정의 다른 사용자는 IAM 역할을 사용하여 모델 카드 계정에서 공유된 모델 카드에 액세스합니다. 다음 템플릿을 사용하여 IAM 역할의 정책을 변경할 수 있습니다. 템플릿을 자체 사용 사례에 맞게 수정할 수 있습니다.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "sagemaker:DescribeModelCard",
                "sagemaker:UpdateModelCard",
                "sagemaker:CreateModelCardExportJob",
                "sagemaker:ListModelCardVersions",
                "sagemaker:DescribeModelCardExportJob"
            ],
            "Resource": [
                "arn:aws:sagemaker:us-east-1:111122223333:model-card/example-model-card-name-0",
                "arn:aws:sagemaker:us-east-1:111122223333:model-card/example-model-card-name-1/*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::amzn-s3-demo-bucket-storing-the-pdf-of-the-model-card/model-card-name/*"
        }
    ]
}
```

------

를 사용하여 암호화된 모델 카드에 액세스하려면 계정의 사용자에게 다음 AWS KMS 권한을 제공해야 AWS KMS합니다.

```
{
     "Effect": "Allow",
     "Action": [
         "kms:GenerateDataKey",
         "kms:Decrypt",
     ],
     "Resource": "arn:aws:kms:AWS-Region:AWS-account-id-where-the-model-card-is-created:key/AWS Key Management Service-key-id"
}
```

# 모델 카드용 하위 수준 SageMaker API
<a name="model-cards-apis"></a>

Amazon SageMaker API 또는 AWS 명령줄 인터페이스()를 통해 Amazon SageMaker 모델 카드를 직접 생성할 수 있습니다AWS CLI.

**참고**  
로우 레벨 API로 모델 카드를 생성할 때는 콘텐츠가 모델 카드 JSON 스키마에 있어야 하며 문자열로 제공되어야 합니다. 자세한 내용은 [모델 카드 JSON 스키마](model-cards.md#model-cards-json-schema)섹션을 참조하세요.

## SageMaker API
<a name="model-cards-apis-sagemaker"></a>

다음 SageMaker API 명령을 사용하여 Amazon SageMaker 모델 카드와 함께 작업할 수 있습니다.
+ [CreateModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModelCard.html)
+ [DescribeModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelCard.html)
+ [ListModelCards](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListModelCards.html)
+ [ListModelCardVersions](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListModelCardVersions.html)
+ [UpdateModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_UpdateModelCard.html)
+ [CreateModelCardExportJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateModelCardExportJob.html)
+ [DescribeModelCardExportJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelCardExportJob.html)
+ [ListModelCardExportJobs](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ListModelCardExportJobs.html)
+ [DeleteModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DeleteModelCard.html)

## AWS CLI
<a name="model-cards-apis-cli"></a>

다음 AWS CLI 명령을 사용하여 Amazon SageMaker 모델 카드를 사용할 수 있습니다.
+ [create-model-card](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/create-model-card.html)
+ [describe-model-card](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/describe-model-card.html)
+ [list-model-cards](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/list-model-cards.html)
+ [list-model-card-versions](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/list-model-card-versions.html)
+ [update-model-card](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/update-model-card.html)
+ [create-model-card-export-job](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/create-model-card-export-job.html)
+ [describe-model-card-export-job](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/describe-model-card-export-job.html)
+ [list-model-card-export-jobs](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/list-model-card-export-jobs.html)
+ [delete-model-card](https://docs.aws.amazon.com/cli/latest/reference/sagemaker/delete-model-card.html)

# 모델 카드 FAQ
<a name="model-cards-faqs"></a>

Amazon SageMaker 모델 카드에 대한 일반적으로 묻는 질문에 대한 답변은 아래의 FAQ 항목을 참조하세요.

## Q: 모델 위험이란 무엇입니까?
<a name="model-cards-faqs-risk"></a>

A: 사이버 공격 예측 및 대출 신청 승인부터 이메일 범주 탐지에 이르기까지 다양한 비즈니스 애플리케이션에 대한 모델을 사용할 수 있습니다. 이러한 각 애플리케이션은 서로 다른 위험 수준을 가집니다. 예를 들어, 사이버 공격을 잘못 탐지하는 것은 이메일을 잘못 분류하는 것보다 비즈니스에 훨씬 더 큰 영향을 미칩니다. 모델의 이렇게 다양한 위험 프로필을 고려하면 모델 카드를 사용하여 모델에 대해 `low`, `medium`또는 `high`의 위험 등급을 제공할 수 있습니다. 모델의 위험도를 모르는 경우 상태를 `unknown`으로 설정할 수 있습니다. 고객은 각 모델에 대한 위험 프로필을 할당할 책임이 있습니다. 위험 등급에 따라 조직에서 해당 모델을 프로덕션에 배포하기 위한 다양한 규칙을 적용할 수 있습니다. 자세한 내용은 [위험 등급](model-cards.md#model-cards-risk-rating)섹션을 참조하세요.

## Q: 모델의 용도는 무엇입니까?
<a name="model-cards-faqs-intended-use"></a>

모델의 용도는 프로덕션 애플리케이션에서 모델을 어떻게 사용해야 하는지를 설명합니다. 이는 모델을 배포해야 하는 인스턴스 유형과 같은 기술적 요구 사항을 넘어서는 것으로, 모델을 사용하여 생성할 애플리케이션 유형, 모델에서 적절한 성능을 기대할 수 있는 시나리오 또는 모델과 함께 사용할 데이터 유형을 의미합니다. 더 나은 모델 거버넌스를 위해 이 정보를 모델 카드에 제공하는 것이 좋습니다. 용도 필드에 일종의 모델 사양을 정의하여 모델 개발자와 소비자가 모델을 훈련하고 배포하는 동안 이 사양을 따르도록 할 수 있습니다. 자세한 내용은 [모델의 용도](model-cards.md#model-cards-intended-uses) 단원을 참조하십시오.

## Q. SageMaker AI는 모델 카드에 정보를 자동으로 채우나요?
<a name="model-cards-faqs-autopopulate"></a>

SageMaker Python SDK 또는 AWS Console을 사용하여 모델 카드를 생성할 때 SageMaker AI는 훈련된 모델에 대한 정보를 자동으로 채웁니다. 여기에는 포괄적인 훈련 세부 정보와 `describe-model` API 직접 호출을 통해 사용할 수 있는 모든 모델 정보가 포함됩니다. Amazon SageMaker Studio에서 작업하는 경우 [DescribeModelPackage](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeModelPackage.html) API를 직접적으로 호출하여 모델 카드를 자동으로 채울 수 있습니다.

## Q: 모델 카드를 사용자 지정할 수 있습니까?
<a name="model-cards-faqs-customize"></a>

Amazon SageMaker 모델 카드에는 수정할 수 없는 정의된 구조가 있습니다. 이 구조는 모델 카드에서 캡처해야 하는 정보에 대한 지침을 제공합니다. 모델 카드의 구조는 변경할 수 없지만 모델 카드의 **추가 정보** 섹션에 있는 사용자 지정 속성을 통해 어느 정도 유연성이 도입되었습니다.

## Q: 모델 카드를 생성한 후 편집할 수 있습니까?
<a name="model-cards-faqs-edit"></a>

모델 카드에는 모델 카드와 관련된 버전이 있습니다. 지정된 모델 버전은 모델 카드 상태를 제외한 모든 속성에서 변경할 수 없습니다. 평가 지표, 설명 또는 용도와 같이 모델 카드를 변경하는 경우 SageMaker AI는 업데이트된 정보를 반영하기 위해 새 버전의 모델 카드를 생성합니다. 이는 모델 카드를 생성한 후에는 변조할 수 없도록 하기 위한 것입니다.

모델 카드는 Model Registry에서 모델 패키지 버전을 변경할 때마다 자동으로 업데이트됩니다.

## Q. SageMaker AI를 사용하여 훈련되지 않은 모델을 위한 모델 카드를 생성할 수 있나요?
<a name="model-cards-faqs-external-models"></a>

A: 예. SageMaker AI에서 훈련되지 않은 모델을 위한 모델 카드를 생성할 수 있지만 카드에 정보가 자동으로 채워지지는 않습니다. SageMaker AI 모델이 아닌 경우 모델 카드에 필요한 모든 정보를 제공해야 합니다.

## Q.모델 카드를 내보내거나 공유할 수 있습니까?
<a name="model-cards-faqs-export"></a>

A: 예. 모델 카드의 각 버전을 PDF로 내보내고, 다운로드하고, 공유할 수 있습니다.

## Q.모델 카드를 사용하려면 모델 레지스트리에 모델을 등록해야 합니까?
<a name="model-cards-faqs-registry"></a>

A: 모델 카드는 SageMaker AI 콘솔과 Model Registry를 통해 액세스할 수 있습니다. Model Registry를 사용하면 모델의 각 버전에 대한 모델 카드가 자동으로 수신됩니다.

## Q.모델 카드와 모델 레지스트리의 차이는 무엇입니까?
<a name="model-cards-faqs-cards-vs-registry"></a>

A: 모델 카드는 SageMaker AI의 권장 가이드를 따르고 자체 사용자 지정 정보를 제공하여 조직에 모델에 대한 세부 정보를 원하는 만큼 문서화할 수 있는 메커니즘을 제공하기 위한 것입니다. ML 프로세스 초기에 모델 카드를 도입하고 이를 사용하여 모델이 해결해야 하는 비즈니스 문제와 모델을 사용할 때 고려해야 할 사항을 정의할 수 있습니다. 모델을 훈련시킨 후에는 해당 모델과 관련된 모델 카드에 모델 및 훈련 방법에 대한 정보를 채울 수 있습니다. 모델 카드는 모델과 연결되며 모델과 연결되면 변경할 수 없습니다. 이를 통해 모델 카드는 훈련 방법 및 사용 방법 등 모델과 관련된 모든 정보를 한 곳에서 확인할 수 있습니다.

모델 레지스트리는 모델에 대한 메타데이터를 저장하는 카탈로그입니다. 모델 레지스트리의 각 항목은 고유한 모델 버전에 해당합니다. 이 모델 버전에는 Amazon S3에서 모델 아티팩트가 저장되는 위치, 모델을 배포하는 데 필요한 컨테이너, 모델에 첨부해야 하는 사용자 지정 메타데이터와 같은 모델에 대한 정보가 포함되어 있습니다. 각 모델 패키지 버전에는 모델 카드가 연결되어 있습니다.

## Q. 모델 카드와 모델 레지스트리는 어떤 관계가 있나요?
<a name="model-cards-faqs-cards-registry-relation"></a>

A: 모델 카드는 Model Registry 객체에 통합됩니다. Model Registry의 각 모델 패키지 버전은 해당 모델 카드에 연결됩니다. [ModelPackageModelCard](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_ModelPackageModelCard.html) API를 사용하여 각 버전의 모델 카드 스키마에 액세스할 수 있습니다.

## Q: 모델 카드 버전은 모델 레지스트리의 모델 버전과 관련이 있습니까?
<a name="model-cards-faqs-cards-vs-registry-versions"></a>

A: 예, 모델 카드와 Model Registry의 모델 간에는 1:1 관계가 있습니다. Model Registry에 저장된 각 모델 버전에는 정확히 하나의 상응하는 모델 카드가 연결되어 있습니다.

## Q.모델 카드가 SageMaker 모델 모니터와 통합되어 있습니까?
<a name="model-cards-faqs-model-monitor"></a>

A: 아니요.지표 파일을 Amazon S3에 업로드하고 카드에 연결하여 SageMaker 모델 모니터에서 계산한 성능 지표를 모델 카드에 업로드할 수 있지만, 모델 모니터와 모델 카드 간에는 기본적으로 통합되지 않습니다. 모델 대시보드는 모델 모니터와 통합됩니다. 모델 대시보드에 대한 자세한 내용은 [Amazon SageMaker 모델 대시보드](https://docs.aws.amazon.com/sagemaker/latest/dg/model_dashboard.html)를 참조하세요.