翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
modeltraining コマンドを使用したモデルトレーニング
Neptune ML modeltraining コマンドを使用すると、モデルトレーニングジョブを作成したり、そのステータスを確認したり、停止したり、アクティブなモデルトレーニングジョブをすべて一覧表示したりできます。
Neptune ML modeltrainingコマンドを使用したモデルトレーニングジョブの作成
まったく新しいジョブを作成するための Neptune ML modeltraining コマンドは次のようになります。
- AWS CLI
-
aws neptunedata start-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(a unique model-training job ID)" \
--data-processing-job-id "(the data-processing job-id of a completed job)" \
--train-model-s3-location "s3://(your S3 bucket)/neptune-model-graph-autotrainer"
詳細については、 AWS CLI 「 コマンドリファレンス」のstart-ml-model-training-job」を参照してください。
- 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_training_job(
id='(a unique model-training job ID)',
dataProcessingJobId='(the data-processing job-id of a completed job)',
trainModelS3Location='s3://(your S3 bucket)/neptune-model-graph-autotrainer'
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining \
--region us-east-1 \
--service neptune-db \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your S3 bucket)/neptune-model-graph-autotrainer"
}'
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。us-east-1 を Neptune クラスターのリージョンに置き換えます。
- curl
-
curl \
-X POST https://your-neptune-endpoint:port/ml/modeltraining \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your S3 bucket)/neptune-model-graph-autotrainer"
}'
インクリメンタルモデルトレーニングの更新ジョブを作成するための Neptune ML modeltraining コマンドは、次のようになります。
- AWS CLI
-
aws neptunedata start-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(a unique model-training job ID)" \
--data-processing-job-id "(the data-processing job-id of a completed job)" \
--train-model-s3-location "s3://(your S3 bucket)/neptune-model-graph-autotrainer" \
--previous-model-training-job-id "(the job ID of a completed model-training job to update)"
詳細については、 AWS CLI 「 コマンドリファレンス」のstart-ml-model-training-job」を参照してください。
- 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_training_job(
id='(a unique model-training job ID)',
dataProcessingJobId='(the data-processing job-id of a completed job)',
trainModelS3Location='s3://(your S3 bucket)/neptune-model-graph-autotrainer',
previousModelTrainingJobId='(the job ID of a completed model-training job to update)'
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining \
--region us-east-1 \
--service neptune-db \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your S3 bucket)/neptune-model-graph-autotrainer",
"previousModelTrainingJobId" : "(the job ID of a completed model-training job to update)"
}'
この例では、 AWS 認証情報が 環境で設定されていることを前提としています。us-east-1 を Neptune クラスターのリージョンに置き換えます。
- curl
-
curl \
-X POST https://your-neptune-endpoint:port/ml/modeltraining \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your S3 bucket)/neptune-model-graph-autotrainer",
"previousModelTrainingJobId" : "(the job ID of a completed model-training job to update)"
}'
ユーザー指定のカスタムモデル実装で新しいジョブを作成するための Neptune ML modeltraining コマンドは次のようになります。
- AWS CLI
-
aws neptunedata start-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(a unique model-training job ID)" \
--data-processing-job-id "(the data-processing job-id of a completed job)" \
--train-model-s3-location "s3://(your Amazon S3 bucket)/neptune-model-graph-autotrainer" \
--model-name "custom" \
--custom-model-training-parameters '{
"sourceS3DirectoryPath": "s3://(your Amazon S3 bucket)/(path to your Python module)",
"trainingEntryPointScript": "(your training script entry-point name in the Python module)",
"transformEntryPointScript": "(your transform script entry-point name in the Python module)"
}'
詳細については、 AWS CLI 「 コマンドリファレンス」のstart-ml-model-training-job」を参照してください。
- 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_training_job(
id='(a unique model-training job ID)',
dataProcessingJobId='(the data-processing job-id of a completed job)',
trainModelS3Location='s3://(your Amazon S3 bucket)/neptune-model-graph-autotrainer',
modelName='custom',
customModelTrainingParameters={
'sourceS3DirectoryPath': 's3://(your Amazon S3 bucket)/(path to your Python module)',
'trainingEntryPointScript': '(your training script entry-point name in the Python module)',
'transformEntryPointScript': '(your transform script entry-point name in the Python module)'
}
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining \
--region us-east-1 \
--service neptune-db \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your Amazon S3 bucket)/neptune-model-graph-autotrainer",
"modelName": "custom",
"customModelTrainingParameters" : {
"sourceS3DirectoryPath": "s3://(your Amazon S3 bucket)/(path to your Python module)",
"trainingEntryPointScript": "(your training script entry-point name in the 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/modeltraining \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique model-training job ID)",
"dataProcessingJobId" : "(the data-processing job-id of a completed job)",
"trainModelS3Location" : "s3://(your Amazon S3 bucket)/neptune-model-graph-autotrainer",
"modelName": "custom",
"customModelTrainingParameters" : {
"sourceS3DirectoryPath": "s3://(your Amazon S3 bucket)/(path to your Python module)",
"trainingEntryPointScript": "(your training script entry-point name in the Python module)",
"transformEntryPointScript": "(your transform script entry-point name in the Python module)"
}
}'
modeltraining ジョブ作成のパラメータ
-
id — (オプション) 新しいジョブの一意の識別子。
タイプ: 文字列。デフォルト値: 自動生成された UUID。
-
dataProcessingJobId — (必須) トレーニングで使用するデータを作成した、完了したデータ処理ジョブのジョブ ID。
タイプ: 文字列。
-
trainModelS3Location — (必須) モデルアーティファクトが保存される Amazon S3 内の場所。
タイプ: 文字列。
-
previousModelTrainingJobId — (オプション) 更新されたデータに基づいて段階的に更新する、完了したモデルトレーニングジョブのジョブ ID。
タイプ: 文字列。デフォルト: なし。
-
sagemakerIamRoleArn — (オプション) SageMaker AI 実行のための IAM ロールの ARN。
タイプ: 文字列。注意: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーが発生します。
-
neptuneIamRoleArn — (オプション) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。
タイプ: 文字列。注意: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーが発生します。
-
modelName — (オプション) トレーニングのモデルタイプ。デフォルトでは、modelType に基づき ML モデルは自動的にデータ処理で使用されますが、ここで別のモデルタイプを指定できます。
タイプ: 文字列。デフォルト値: rgcn の場合異種グラフと kge の場合ナレッジグラフ。有効な値: 異種グラフの場合: rgcn。kge グラフの場合: transe、distmult または rotate。カスタムモデル実装の場合: custom。
-
baseProcessingInstanceType — (オプション) ML モデルのトレーニングの準備と管理に使用される ML インスタンスのタイプ。
タイプ: 文字列。注意: これは、トレーニングデータとモデルの処理に必要なメモリに基づいて選択された CPU インスタンスです。「モデルトレーニングとモデル変換のインスタンスの選択」を参照してください。
-
trainingInstanceType — (オプション) モデルトレーニングに使用される ML インスタンスのタイプ。すべてのNeptune ML モデルは、CPU、GPU、MultiGPU トレーニングをサポートしています。
タイプ: 文字列。デフォルト: ml.p3.2xlarge。
注意: トレーニングに適したインスタンスタイプは、タスクタイプ、グラフサイズ、および予算によって異なります。「モデルトレーニングとモデル変換のインスタンスの選択」を参照してください。
-
trainingInstanceVolumeSizeInGB — (オプション) トレーニングインスタンスのディスクボリュームサイズ。入力データと出力モデルの両方がディスクに保存されるため、ボリュームサイズは両方のデータセットを保持するのに十分な大きさでなければなりません。
タイプ: 整数。デフォルト: 0。
注意: 指定しない場合、または 0 の場合、Neptune ML はデータ処理ステップで生成された推奨に基づいてディスクボリュームサイズを選択します。「モデルトレーニングとモデル変換のインスタンスの選択」を参照してください。
-
trainingTimeOutInSeconds — (オプション) トレーニングジョブの秒単位で指定したタイムアウト。
タイプ: 整数。デフォルト: 86,400 (日単位)
-
maxHPONumberOfTrainingJobs — ハイパーパラメータ調整ジョブで開始するトレーニングジョブの最大総数。
タイプ: 整数。デフォルト: 2。
注意: Neptune ML は、機械学習モデルのハイパーパラメーターを自動的に調整します。うまく機能するモデルを得るには、少なくとも 10 個のジョブを使用します (つまり、maxHPONumberOfTrainingJobs を 10 と設定)。一般的に、チューニングの実行が多いほど、結果は良くなります。
-
maxHPOParallelTrainingJobs — ハイパーパラメータ調整ジョブで開始する並列トレーニングジョブの最大総数。
タイプ: 整数。デフォルト: 2。
注意: 実行できる並列ジョブの数は、トレーニングインスタンスで使用可能なリソースによって制限されます。
-
subnets — (オプション) Neptune VPC 内のサブネットの ID。
タイプ: 文字列のリスト。デフォルト: なし。
-
securityGroupIds — (オプション) VPC セキュリティグループ ID。
タイプ: 文字列のリスト。デフォルト: なし。
-
volumeEncryptionKMSKey – (オプション) トレーニングジョブを実行する ML コンピューティングインスタンスにアタッチされたストレージボリュームのデータを暗号化するために SageMaker AI が使用する AWS Key Management Service (AWS KMS) キー。
タイプ: 文字列。デフォルト: なし。
-
s3OutputEncryptionKMSKey – (オプション) SageMaker AI が処理ジョブの出力を暗号化するために使用する AWS Key Management Service (AWS KMS) キー。
タイプ: 文字列。デフォルト: なし。
-
enableInterContainerTrafficEncryption — (オプション) トレーニングジョブまたはハイパーパラメータチューニングジョブでのコンテナ間トラフィック暗号化を有効または無効にします。
タイプ:ブール値 デフォルト: true。
-
enableManagedSpotTraining — (オプション) Amazon Elastic Compute Cloud スポットインスタンスを使用して、機械学習モデルのトレーニングのコストを最適化します。詳細については、Amazon SageMaker でのマネージドスポットトレーニングを参照してください。
タイプ: ブール値。デフォルト: False。
-
customModelTrainingParameters — (オプション) カスタムモデルトレーニングの設定。これは、次の構造を持つ JSON オブジェクトです。
sourceS3DirectoryPath — (必須) モデルを実装する Python モジュールがある Amazon S3 の場所へのパス。これは、少なくともトレーニングスクリプト、変換スクリプト、および model-hpo-configuration.json ファイルを含む有効な既存の Amazon S3 の場所を指定しなければなりません。
-
trainingEntryPointScript — (オプション) モデルトレーニングを実行し、固定ハイパーパラメーターを含むコマンドライン引数としてハイパーパラメーターを取るスクリプトのモジュール内のエントリポイントの名前。
デフォルト: training.py。
-
transformEntryPointScript — (オプション) モデルのデプロイに必要なモデルアーティファクトを計算するために、ハイパーパラメーター検索の最適なモデルが特定された後に実行されるスクリプトのモジュール内のエントリポイントの名前。コマンドライン引数なしで実行できるはずです。
デフォルト: transform.py。
-
maxWaitTime — (オプション) スポットインスタンスを使用してモデルトレーニングを実行する場合の最大待機時間 (秒単位)。trainingTimeOutInSeconds より大きくなければなりません。
タイプ: 整数。
Neptune ML modeltraining コマンドを使用したデータ処理ジョブのステータスの取得
ジョブのステータスのサンプル Neptune ML modeltraining コマンドは、次のようになります。
- AWS CLI
-
aws neptunedata get-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(the job ID)"
詳細については、 AWS CLI 「 コマンドリファレンス」のget-ml-model-training-job」を参照してください。
- 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_training_job(
id='(the job ID)'
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining/(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/modeltraining/(the job ID)" \
| python -m json.tool
modeltraining ジョブステータスのパラメータ
-
id — (必須) モデルトレーニングジョブの一意の識別子。
タイプ: 文字列。
-
neptuneIamRoleArn — (オプション) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。
タイプ: 文字列。注意: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーが発生します。
Neptune ML modeltraining コマンドを使用したモデルトレーニングジョブの停止
ジョブのを停止するサンプル Neptune ML modeltraining コマンドは、次のようになります。
- AWS CLI
-
aws neptunedata cancel-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(the job ID)"
Amazon S3 アーティファクトもクリーンアップするには:
aws neptunedata cancel-ml-model-training-job \
--endpoint-url https://your-neptune-endpoint:port \
--id "(the job ID)" \
--clean
詳細については、 AWS CLI 「 コマンドリファレンス」のcancel-ml-model-training-job」を参照してください。
- 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_training_job(
id='(the job ID)',
clean=True
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining/(the job ID) \
--region us-east-1 \
--service neptune-db \
-X DELETE
Amazon S3 アーティファクトもクリーンアップするには:
awscurl "https://your-neptune-endpoint:port/ml/modeltraining/(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/modeltraining/(the job ID)"
または、このようになります。
curl -s \
-X DELETE "https://your-neptune-endpoint:port/ml/modeltraining/(the job ID)?clean=true"
modeltraining 停止ジョブのパラメータ
-
id — (必須) モデルトレーニングジョブの一意の識別子。
タイプ: 文字列。
-
neptuneIamRoleArn — (オプション) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。
タイプ: 文字列。注意: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーが発生します。
-
clean — (オプション) このフラグは、ジョブが停止したときにすべての Amazon S3 アーティファクトを削除する必要があることを指定します。
タイプ: ブール値。デフォルト: FALSE。
Neptune ML modeltraining コマンドを使用したアクティブなモデルトレーニングジョブの一覧表示
アクティブジョブの一覧表示のサンプル Neptune ML modeltraining コマンドは、次のようになります。
- AWS CLI
-
aws neptunedata list-ml-model-training-jobs \
--endpoint-url https://your-neptune-endpoint:port
結果の数を制限するには:
aws neptunedata list-ml-model-training-jobs \
--endpoint-url https://your-neptune-endpoint:port \
--max-items 3
詳細については、 AWS CLI 「 コマンドリファレンス」のlist-ml-model-training-jobs」を参照してください。
- 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_training_jobs(
maxItems=3
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/modeltraining \
--region us-east-1 \
--service neptune-db \
-X GET
結果の数を制限するには:
awscurl "https://your-neptune-endpoint:port/ml/modeltraining?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/modeltraining" | python -m json.tool
または、このようになります。
curl -s "https://your-neptune-endpoint:port/ml/modeltraining?maxItems=3" | python -m json.tool
modeltraining ジョブの一覧表示のパラメータ
-
maxItems — (オプション) 返される項目の最大数。
タイプ: 整数。デフォルト: 10。最大許容値: 1024。
-
neptuneIamRoleArn — (オプション) SageMaker AI および Amazon S3 リソースへの Neptune アクセスを提供する IAM ロールの ARN。
タイプ: 文字列。注意: これは DB クラスターパラメータグループに一覧表示されている必要があります。そうしないと、エラーが発生します。