View a markdown version of this page

Addestramento di un modello con Neptune ML. - Amazon Neptune

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Addestramento di un modello con Neptune ML.

Dopo aver elaborato i dati esportati da Neptune per l'addestramento dei modelli, puoi avviare un processo di addestramento dei modelli utilizzando un comando come il seguente:

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"

Per ulteriori informazioni, vedere start-ml-model-training-job nel Command Reference. AWS CLI

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" }'
Nota

Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci us-east-1 con la regione del tuo 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" }'

I dettagli su come utilizzare questo comando sono illustrati in Comando modeltraining, insieme a informazioni su come recuperare lo stato di un processo in esecuzione, come arrestare un processo in esecuzione e come elencare tutti i processi in esecuzione.

È inoltre possibile fornire un previousModelTrainingJobId per usare le informazioni provenienti dal processo di addestramento di un modello Neptune ML completato per accelerare la ricerca degli iperparametri in un nuovo processo di addestramento. Questo è utile durante il riaddestramento del modello su nuovi dati del grafo, nonché per l'addestramento incrementale sugli stessi dati del grafo. Usa un comando come questo:

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)"

Per ulteriori informazioni, vedere start-ml-model-training-job nel Command Reference. AWS CLI

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)" }'
Nota

Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci us-east-1 con la regione del tuo 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)" }'

Puoi addestrare l'implementazione di un modello personalizzato sull'infrastruttura di addestramento di Neptune ML specificando un oggetto customModelTrainingParameters, in questo modo:

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)" }'

Per ulteriori informazioni, vedere start-ml-model-training-job nel Command Reference. AWS CLI

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)" } }'
Nota

Questo esempio presuppone che le AWS credenziali siano configurate nel proprio ambiente. Sostituisci us-east-1 con la regione del tuo 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)" } }'

Per ulteriori informazioni, ad esempio su come recuperare lo stato di un processo in esecuzione, su come arrestare un processo in esecuzione e su come elencare tutti i lavori in esecuzione, consulta Comando modeltraining. Per ulteriori informazioni su come implementare e usare un modello personalizzato, consulta Modelli personalizzati in Neptune ML..