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à.
Creazione di un endpoint di inferenza per l'esecuzione di query
Un endpoint di inferenza consente di eseguire query su un modello specifico creato dal processo di addestramento del modello. L'endpoint si collega al modello con le migliori prestazioni di un tipo specifico che il processo di addestramento è riuscito a generare. L'endpoint può quindi accettare le query Gremlin di Neptune e restituire le previsioni di quel modello per gli input nelle query. Dopo aver creato l'endpoint di inferenza, questo rimane attivo finché non viene eliminato.
Gestione degli endpoint di inferenza per Neptune ML
Dopo aver completato l'addestramento del modello sui dati esportati da Neptune, puoi creare un endpoint di inferenza utilizzando un comando come il seguente:
- AWS CLI
-
aws neptunedata create-ml-endpoint \
--endpoint-url https://your-neptune-endpoint:port \
--id "(a unique ID for the new endpoint)" \
--ml-model-training-job-id "(the model-training job-id of a completed job)"
Per ulteriori informazioni, vedere create-ml-endpointnel 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.create_ml_endpoint(
id='(a unique ID for the new endpoint)',
mlModelTrainingJobId='(the model-training job-id of a completed job)'
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/endpoints \
--region us-east-1 \
--service neptune-db \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique ID for the new endpoint)",
"mlModelTrainingJobId": "(the model-training job-id of a completed job)"
}'
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/endpoints \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique ID for the new endpoint)",
"mlModelTrainingJobId": "(the model-training job-id of a completed job)"
}'
Puoi anche creare un endpoint di inferenza da un modello creato da un processo di trasformazione del modello completato, più o meno allo stesso modo:
- AWS CLI
-
aws neptunedata create-ml-endpoint \
--endpoint-url https://your-neptune-endpoint:port \
--id "(a unique ID for the new endpoint)" \
--ml-model-transform-job-id "(the model-transform job-id of a completed job)"
Per ulteriori informazioni, vedere create-ml-endpointnel AWS CLI Command Reference.
- 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.create_ml_endpoint(
id='(a unique ID for the new endpoint)',
mlModelTransformJobId='(the model-transform job-id of a completed job)'
)
print(response)
- awscurl
-
awscurl https://your-neptune-endpoint:port/ml/endpoints \
--region us-east-1 \
--service neptune-db \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique ID for the new endpoint)",
"mlModelTransformJobId": "(the model-transform job-id of a completed job)"
}'
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/endpoints \
-H 'Content-Type: application/json' \
-d '{
"id" : "(a unique ID for the new endpoint)",
"mlModelTransformJobId": "(the model-transform job-id of a completed job)"
}'
I dettagli su come usare questi comandi sono spiegati in Comando endpoints, insieme alle informazioni su come recuperare lo stato di un endpoint, come eliminare un endpoint e come elencare tutti gli endpoint di inferenza.