Method: projects.locations.collections.dataStores.trainCustomModel

訓練自訂模型。

HTTP 要求

POST https://discoveryengine.googleapis.com/v1alpha/{dataStore=projects/*/locations/*/collections/*/dataStores/*}:trainCustomModel

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
dataStore

string

這是必要旗標,資料儲存庫的資源名稱,例如 projects/*/locations/global/collections/default_collection/dataStores/default_data_store。這個欄位用於識別訓練模型時使用的資料儲存庫。

要求主體

要求主體包含下列結構的資料:

JSON 表示法
{
  "modelType": string,
  "errorConfig": {
    object (ImportErrorConfig)
  },
  "modelId": string,

  // Union field training_input can be only one of the following:
  "gcsTrainingInput": {
    object (GcsTrainingInput)
  }
  // End of list of possible types for union field training_input.
}
欄位
modelType

string

要訓練的模型。支援的值如下:

  • search-tuning:根據提供的資料微調搜尋系統。
errorConfig

object (ImportErrorConfig)

資料擷取和訓練期間發生錯誤的所需位置。

modelId

string

如未提供,系統會產生 UUID。

聯集欄位 training_input。模型訓練輸入內容。training_input 只能是下列其中一項:
gcsTrainingInput

object (GcsTrainingInput)

Cloud Storage 訓練輸入內容。

回應主體

如果成功,回應主體會包含 Operation 的執行個體。

授權範圍

需要下列其中一種 OAuth 範圍:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.readwrite

詳情請參閱Authentication Overview

IAM 權限

需要 dataStore 資源的下列 IAM 權限:

  • discoveryengine.dataStores.trainCustomModel

詳情請參閱 IAM 說明文件

GcsTrainingInput

Cloud Storage 訓練資料輸入。

JSON 表示法
{
  "corpusDataPath": string,
  "queryDataPath": string,
  "trainDataPath": string,
  "testDataPath": string
}
欄位
corpusDataPath

string

可與訓練資料建立關聯的 Cloud Storage 語料庫資料。資料路徑格式為 gs://<bucket_to_data>/<jsonl_file_name>。以換行符號分隔的 jsonl/ndjson 檔案。

如果是搜尋微調模型,每行應包含 ID、標題和文字。範例:{"Id": "doc1", title: "relevant doc", "text": "relevant text"}

queryDataPath

string

可與訓練資料建立關聯的 gcs 查詢資料。資料路徑格式為 gs://<bucket_to_data>/<jsonl_file_name>。以換行符號分隔的 jsonl/ndjson 檔案。

如果是搜尋微調模型,每行都應包含 ID 和文字。示例:{"Id": "query1", "text": "example query"}

trainDataPath

string

Cloud Storage 訓練資料路徑,格式應為 gs://<bucket_to_data>/<tsv_file_name>。檔案必須是 TSV 格式。每行應包含 docId、queryId 和分數 (數字)。

如果是搜尋調整模型,則應以查詢 ID、語料庫 ID 和分數做為 TSV 檔案標頭。分數應為 [0, inf+) 中的數字。數字越大,表示該配對的關聯性越高。範例:

  • query-id\tcorpus-id\tscore
  • query1\tdoc1\t1
testDataPath

string

Cloud Storage 測試資料。格式與 trainDataPath 相同。如未提供,系統會對 trainDataPath 執行隨機 80/20 的訓練/測試分割。