

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

# `modeltransform` 명령을 사용한 모델 변환
<a name="machine-learning-api-modeltransform"></a>

Neptune ML `modeltransform` 명령을 사용하여 모델 변환 작업을 생성하거나, 작업 상태를 확인하거나, 중지하거나, 모든 활성 모델 변환 작업을 나열할 수 있습니다.

## Neptune ML `modeltransform` 명령을 사용하여 모델 변환 작업 생성
<a name="machine-learning-api-modeltransform-create-job"></a>

모델 재훈련 없이 증분 변환 작업을 생성하는 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata start-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-transform job ID)}}" \
  --data-processing-job-id "{{(the job-id of a completed data-processing job)}}" \
  --ml-model-training-job-id "{{(the job-id of a completed model-training job)}}" \
  --model-transform-output-s3-location "s3://{{(your S3 bucket)}}/neptune-model-transform"
```

자세한 내용은 AWS CLI 명령 참조의 [start-ml-model-transform-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-transform-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.start_ml_model_transform_job(
    id='{{(a unique model-transform job ID)}}',
    dataProcessingJobId='{{(the job-id of a completed data-processing job)}}',
    mlModelTrainingJobId='{{(the job-id of a completed model-training job)}}',
    modelTransformOutputS3Location='s3://{{(your S3 bucket)}}/neptune-model-transform'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "dataProcessingJobId" : "{{(the job-id of a completed data-processing job)}}",
        "mlModelTrainingJobId" : "{{(the job-id of a completed model-training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-transform"
      }'
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "dataProcessingJobId" : "{{(the job-id of a completed data-processing job)}}",
        "mlModelTrainingJobId" : "{{(the job-id of a completed model-training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-transform"
      }'
```

------

완료된 SageMaker AI 훈련 작업에서 작업을 생성하는 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata start-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-transform job ID)}}" \
  --training-job-name "{{(name of a completed SageMaker training job)}}" \
  --model-transform-output-s3-location "s3://{{(your S3 bucket)}}/neptune-model-transform"
```

자세한 내용은 AWS CLI 명령 참조의 [start-ml-model-transform-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-transform-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.start_ml_model_transform_job(
    id='{{(a unique model-transform job ID)}}',
    trainingJobName='{{(name of a completed SageMaker training job)}}',
    modelTransformOutputS3Location='s3://{{(your S3 bucket)}}/neptune-model-transform'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "trainingJobName" : "{{(name of a completed SageMaker training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-transform"
      }'
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "trainingJobName" : "{{(name of a completed SageMaker training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your S3 bucket)}}/neptune-model-transform"
      }'
```

------

사용자 지정 모델 구현을 사용하는 작업을 생성하는 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata start-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique model-transform job ID)}}" \
  --training-job-name "{{(name of a completed SageMaker training job)}}" \
  --model-transform-output-s3-location "s3://{{(your Amazon S3 bucket)}}/neptune-model-transform/" \
  --custom-model-transform-parameters '{
    "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
    "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
  }'
```

자세한 내용은 AWS CLI 명령 참조의 [start-ml-model-transform-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/start-ml-model-transform-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.start_ml_model_transform_job(
    id='{{(a unique model-transform job ID)}}',
    trainingJobName='{{(name of a completed SageMaker training job)}}',
    modelTransformOutputS3Location='s3://{{(your Amazon S3 bucket)}}/neptune-model-transform/',
    customModelTransformParameters={
        'sourceS3DirectoryPath': 's3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}',
        'transformEntryPointScript': '{{(your transform script entry-point name in the Python module)}}'
    }
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "trainingJobName" : "{{(name of a completed SageMaker training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your Amazon S3 bucket)}}/neptune-model-transform/",
        "customModelTransformParameters" : {
          "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
          "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
        }
      }'
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique model-transform job ID)}}",
        "trainingJobName" : "{{(name of a completed SageMaker training job)}}",
        "modelTransformOutputS3Location" : "s3://{{(your Amazon S3 bucket)}}/neptune-model-transform/",
        "customModelTransformParameters" : {
          "sourceS3DirectoryPath": "s3://{{(your Amazon S3 bucket)}}/{{(path to your Python module)}}",
          "transformEntryPointScript": "{{(your transform script entry-point name in the Python module)}}"
        }
      }'
```

------

**작업을 생성하는 `modeltransform` 파라미터**
+ **`id`**   –   (*선택 사항*) 새 작업의 고유 식별자입니다.

  *유형*: 문자열. *기본값*: 자동 생성된 UUID.
+ **`dataProcessingJobId`**   –   완료된 데이터 처리 작업의 작업 ID입니다.

  *유형*: 문자열.

  *참고*: `dataProcessingJobId` 및 `mlModelTrainingJobId` 모두 또는 `trainingJobName`를 포함해야 합니다.
+ **`mlModelTrainingJobId`**   –   완료된 모델 훈련 작업의 작업 ID입니다.

  *유형*: 문자열.

  *참고*: `dataProcessingJobId` 및 `mlModelTrainingJobId` 모두 또는 `trainingJobName`를 포함해야 합니다.
+ **`trainingJobName`** – 완료한 SageMaker AI 훈련 작업의 이름입니다.

  *유형*: 문자열.

  *참고*: `dataProcessingJobId` 및 `mlModelTrainingJobId` 파라미터 모두 또는 `trainingJobName` 파라미터를 포함해야 합니다.
+ **`sagemakerIamRoleArn`** – (*선택 사항*) SageMaker AI를 실행하기 위한 IAM 역할의 ARN입니다.

  *유형*: 문자열. *참고*: 이는 DB 클러스터 파라미터 그룹에 나열되어 있어야 합니다. 그렇지 않으면 오류가 발생합니다.
+ **`neptuneIamRoleArn`** – (*선택 사항*) SageMaker AI와 Amazon S3 리소스에 대한 Neptune의 액세스 권한을 제공하는 IAM 역할의 ARN입니다.

  *유형*: 문자열. *참고*: 이는 DB 클러스터 파라미터 그룹에 나열되어 있어야 합니다. 그렇지 않으면 오류가 발생합니다.
+ **`customModelTransformParameters `**   –   (*선택 사항*) 사용자 지정 모델을 사용한 모델 변환의 구성 정보입니다. `customModelTransformParameters` 객체에는 다음 필드가 포함되며, 이 필드는 훈련 작업에서 저장된 모델 파라미터와 호환되는 값을 가져야 합니다.
  + **`sourceS3DirectoryPath`**   –   (*필수*) 모델을 구현하는 Python 모듈이 위치한 Amazon S3 위치 경로입니다. 이는 최소한 훈련 스크립트, 변환 스크립트 및 `model-hpo-configuration.json` 파일을 포함하는 유효한 기존 Amazon S3 위치를 가리켜야 합니다.
  + **`transformEntryPointScript`**   –   (*선택 사항*) 모델 배포에 필요한 모델 아티팩트를 계산하기 위해 하이퍼파라미터 검색에서 최적의 모델을 식별한 후 실행해야 하는 스크립트의 모듈 내 진입점 이름입니다. 명령줄 인수 없이 실행할 수 있어야 합니다.

    *기본값*: `transform.py`.
+ **`baseProcessingInstanceType`**   –   (*선택 사항*) ML 모델 훈련 준비 및 관리에 사용되는 ML 인스턴스 유형입니다.

  *유형*: 문자열. *참고*: 변환 데이터 및 모델을 처리하는 데 필요한 메모리 요구 사항을 기반으로 선택된 CPU 인스턴스입니다. [모델 훈련 및 모델 변환용 인스턴스 선택](machine-learning-on-graphs-instance-selection.md#machine-learning-on-graphs-training-transform-instance-size)을(를) 참조하세요.
+ **`baseProcessingInstanceVolumeSizeInGB`**   –   (*선택 사항*) 훈련 인스턴스의 디스크 볼륨 크기입니다. 입력 데이터와 출력 모델 모두 디스크에 저장되므로, 볼륨 크기는 두 데이터 세트를 모두 담을 수 있을 만큼 커야 합니다.

  *유형*: 정수. *기본값*: `0`.

  *참고*: 지정하지 않거나 0인 경우 Neptune ML은 데이터 처리 단계에서 생성된 권장 사항에 따라 디스크 볼륨 크기를 선택합니다. [모델 훈련 및 모델 변환용 인스턴스 선택](machine-learning-on-graphs-instance-selection.md#machine-learning-on-graphs-training-transform-instance-size)을(를) 참조하세요.
+ **`subnets`**   –   (*선택 사항*) Neptune VPC의 서브넷 ID입니다.

  *유형*: 문자열 목록. *기본값*: *없음*.
+ **`securityGroupIds`**   –   (*선택 사항*) VPC 보안 그룹 ID입니다.

  *유형*: 문자열 목록. *기본값*: *없음*.
+ **`volumeEncryptionKMSKey`**   –   (*선택 사항*) SageMaker AI가 변환 작업을 실행하는 ML 컴퓨팅 인스턴스에 연결된 스토리지 볼륨의 데이터를 암호화하는 데 사용하는 AWS Key Management Service (AWS KMS) 키입니다.

  *유형*: 문자열. *기본값*: *없음*.
+ **`enableInterContainerTrafficEncryption`**   –   (*선택 사항*) 훈련 또는 하이퍼 파라미터 조정 작업에서 컨테이너 간 트래픽 암호화를 활성화하거나 비활성화합니다.

  *유형*: 부울. *기본값*: *True*.
**참고**  
이 `enableInterContainerTrafficEncryption` 파라미터는 [엔진 릴리스 1.2.0.2.R3](engine-releases-1.2.0.2.R3.md)에서만 사용할 수 있습니다.
+ **`s3OutputEncryptionKMSKey`**   –   (*선택 사항*) SageMaker AI가 처리 작업의 출력을 암호화하는 데 사용하는 AWS Key Management Service (AWS KMS) 키입니다.

  *유형*: 문자열. *기본값*: *없음*.

## Neptune ML `modeltransform` 명령을 사용하여 모델 변환 작업의 상태 가져오기
<a name="machine-learning-api-modeltransform-get-job-status"></a>

작업 상태를 나타내는 샘플 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata get-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the job ID)}}"
```

자세한 내용은 AWS CLI 명령 참조의 [get-ml-model-transform-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-ml-model-transform-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.get_ml_model_transform_job(
    id='{{(the job ID)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl -s \
  "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}}" \
  | python -m json.tool
```

------

**작업 상태를 나타내는 `modeltransform` 파라미터**
+ **`id`**   –   (*필수*) 모델 변환 작업의 고유 식별자입니다.

  *유형*: 문자열.
+ **`neptuneIamRoleArn`** – (*선택 사항*) SageMaker AI와 Amazon S3 리소스에 대한 Neptune의 액세스 권한을 제공하는 IAM 역할의 ARN입니다.

  *유형*: 문자열. *참고*: 이는 DB 클러스터 파라미터 그룹에 나열되어 있어야 합니다. 그렇지 않으면 오류가 발생합니다.

## Neptune ML `modeltransform` 명령을 사용하여 모델 변환 작업 중지
<a name="machine-learning-api-modeltransform-stop-job"></a>

작업 중지를 위한 샘플 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata cancel-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the job ID)}}"
```

Amazon S3 아티팩트를 정리하려면:

```
aws neptunedata cancel-ml-model-transform-job \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the job ID)}}" \
  --clean
```

자세한 내용은 AWS CLI 명령 참조의 [cancel-ml-model-transform-job](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/cancel-ml-model-transform-job.html)을 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.cancel_ml_model_transform_job(
    id='{{(the job ID)}}',
    clean=True
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

Amazon S3 아티팩트를 정리하려면:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}}?clean=true" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}}"
```

아니면 다음을 사용해도 됩니다.

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform/{{(the job ID)}}?clean=true"
```

------

**작업을 중지하는 `modeltransform` 파라미터**
+ **`id`**   –   (*필수*) 모델 변환 작업의 고유 식별자입니다.

  *유형*: 문자열.
+ **`neptuneIamRoleArn`** – (*선택 사항*) SageMaker AI와 Amazon S3 리소스에 대한 Neptune의 액세스 권한을 제공하는 IAM 역할의 ARN입니다.

  *유형*: 문자열. *참고*: 이는 DB 클러스터 파라미터 그룹에 나열되어 있어야 합니다. 그렇지 않으면 오류가 발생합니다.
+ **`clean`**   –   (*선택 사항*) 이 플래그는 작업이 중지될 때 모든 Amazon S3 아티팩트를 삭제하도록 지정합니다.

  *유형*: 부울. *기본값*: `FALSE`.

## Neptune ML `modeltransform` 명령을 사용하여 활성 모델 변환 작업 나열
<a name="machine-learning-api-modeltransform-list-jobs"></a>

활성 작업을 나열하기 위한 샘플 Neptune ML `modeltransform` 명령은 다음과 같습니다.

------
#### [ AWS CLI ]

```
aws neptunedata list-ml-model-transform-jobs \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}}
```

결과 수를 제한하려면:

```
aws neptunedata list-ml-model-transform-jobs \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --max-items 3
```

자세한 내용은 AWS CLI 명령 참조의 [list-ml-model-transform-jobs](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/list-ml-model-transform-jobs.html)를 참조하세요.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.list_ml_model_transform_jobs(
    maxItems=3
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

결과 수를 제한하려면:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform?maxItems=3" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform" | python -m json.tool
```

아니면 다음을 사용해도 됩니다.

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/modeltransform?maxItems=3" | python -m json.tool
```

------

**작업을 나열하는 `modeltransform` 파라미터**
+ **`maxItems`**   –   (*선택 사항*) 반환할 최대 항목 수입니다.

  *유형*: 정수. *기본값*: `10`. *최대 허용 값*: `1024`.
+ **`neptuneIamRoleArn`** – (*선택 사항*) SageMaker AI와 Amazon S3 리소스에 대한 Neptune의 액세스 권한을 제공하는 IAM 역할의 ARN입니다.

  *유형*: 문자열. *참고*: 이는 DB 클러스터 파라미터 그룹에 나열되어 있어야 합니다. 그렇지 않으면 오류가 발생합니다.