Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.
Entraînement d'un modèle à l'aide de Neptune ML
Après avoir traité les données que vous avez exportées depuis Neptune pour l'entraînement des modèles, vous pouvez démarrer une tâche d'entraînement des modèles à l'aide d'une commande telle que la suivante :
- 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"
Pour plus d'informations, consultez start-ml-model-training-job dans le manuel de référence des AWS CLI commandes.
- 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"
}'
Cet exemple suppose que vos AWS informations d'identification sont configurées dans votre environnement. Remplacez us-east-1 par la région de votre cluster 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"
}'
Les détails de l'utilisation de cette commande sont expliqués dans Commande modeltraining, avec d'autres informations sur la façon d'obtenir le statut d'une tâche en cours d'exécution, d'arrêter une tâche en cours d'exécution et de répertorier toutes les tâches en cours d'exécution.
Vous pouvez également fournir un identifiant previousModelTrainingJobId pour utiliser les informations issues d'une tâche d'entraînement de modèle Neptune ML terminée, afin d'accélérer la recherche d'hyperparamètres dans une nouvelle tâche d'entraînement. Cela est utile lors du réentraînement de modèle sur de nouvelles données de graphe, ainsi que lors de l'entraînement incrémentiel sur les mêmes données de graphe. Utilisez une commande comme celle-ci :
- 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 model-training job-id of a completed job)"
Pour plus d'informations, consultez start-ml-model-training-job dans le manuel de référence des AWS CLI commandes.
- 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 model-training job-id of a completed job)'
)
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 model-training job-id of a completed job)"
}'
Cet exemple suppose que vos AWS informations d'identification sont configurées dans votre environnement. Remplacez us-east-1 par la région de votre cluster 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 model-training job-id of a completed job)"
}'
Vous pouvez entraîner votre propre implémentation de modèle sur l'infrastructure d'entraînement Neptune ML en fournissant un objet customModelTrainingParameters tel que celui-ci :
- 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)"
}'
Pour plus d'informations, consultez start-ml-model-training-job dans le manuel de référence des AWS CLI commandes.
- 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)"
}
}'
Cet exemple suppose que vos AWS informations d'identification sont configurées dans votre environnement. Remplacez us-east-1 par la région de votre cluster 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)"
}
}'
Consultez Commande modeltraining pour plus d'informations, notamment sur la façon d'obtenir le statut d'une tâche en cours d'exécution, la façon d'arrêter une tâche en cours d'exécution et la façon de répertorier toutes les tâches en cours d'exécution. Consultez Modèles personnalisés dans Neptune ML pour en savoir plus sur la façon d'implémenter et d'utiliser un modèle personnalisé.