使用訓練後的模型來產生新的模型成品 - Amazon Neptune

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用訓練後的模型來產生新的模型成品

使用 Neptune ML 模型轉換命令,您可以使用預先訓練的模型參數計算模型成品,例如在處理後的圖形資料上進行節點嵌入。

用於增量推論的模型轉換

增量模型推論工作流程中,於處理了您從 Neptune 匯出的更新圖形資料之後,您可以使用如下的 curl (或 awscurl) 命令啟動模型轉換工作:

curl \ -X POST https://(your Neptune endpoint)/ml/modeltransform -H 'Content-Type: application/json' \ -d '{ "id" : "(a unique model-training job ID)", "dataProcessingJobId" : "(the data-processing job-id of a completed job)", "mlModelTrainingJobId": "(the ML model training job-id)", "modelTransformOutputS3Location" : "s3://(your Amazon S3 bucket)/neptune-model-transform/" }'

然後,您可以將此工作的 ID 傳遞至 create-endpoints API 呼叫,以建立新端點,或使用此工作產生的新模型成品更新現有端點。這可讓新的或更新的端點,為更新的圖形資料提供模型預測。

任何訓練工作的模型轉換

您也可以提供 trainingJobName 參數,為 Neptune ML 模型訓練期間啟動的任何 SageMaker 訓練工作產生模型成品。由於 Neptune ML 模型訓練工作可能會啟動許多 SageMaker 訓練工作,因此這可讓彈性地根據其中任何一個 SageMaker 訓練工作建立推論端點。

例如:

curl \ -X POST https://(your Neptune endpoint)/ml/modeltransform -H 'Content-Type: application/json' \ -d '{ "id" : "(a unique model-training job ID)", "trainingJobName" : "(name a completed SageMaker training job)", "modelTransformOutputS3Location" : "s3://(your Amazon S3 bucket)/neptune-model-transform/" }'

如果原始訓練工作是針對使用者提供的自訂模型,您必須在調用模型轉換時包含 customModelTransformParameters 物件。如需如何實作並使用自訂模型的相關資訊,請參閱 Neptune ML 中的自訂模型

注意

modeltransform 命令一律會在該訓練的最佳 SageMaker 訓練工作上執行模型轉換。

如需模型轉換工作的詳細資訊,請參閱 modeltransform 命令