使用 Neptune ML 训练模型 - Amazon Neptune

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Neptune ML 训练模型

处理完从 Neptune 导出的用于模型训练的数据后,可以使用 curl(或 awscurl)命令启动模型训练任务,如下所示:

curl \ -X POST https://(your Neptune endpoint)/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" }'

modeltraining 命令中解释了如何使用此命令的详细信息,以及有关如何获取正在运行的任务的状态、如何停止正在运行的任务以及如何列出所有正在运行的任务的信息。

您还可以提供 previousModelTrainingJobId 以使用已完成的 Neptune ML 模型训练任务中的信息,从而在新的训练任务中加快超参数搜索的速度。这在对新的图形数据进行模型再训练以及对相同图形数据进行增量训练期间非常有用。使用如下命令:

curl \ -X POST https://(your Neptune endpoint)/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" "previousModelTrainingJobId" : "(the model-training job-id of a completed job)" }'

您可以通过提供 customModelTrainingParameters 对象在 Neptune ML 训练基础设施上训练自己的模型实现,如下所示:

curl \ -X POST https://(your Neptune endpoint)/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 命令。有关如何实现和使用自定义模型的信息,请参阅Neptune ML 中的自定义模型