

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

# 資料集檔案類型與輸入資料格式
<a name="autopilot-llms-finetuning-data-format"></a>

指令微調使用標記資料集來改善預先訓練的 LLM 在特定自然語言處理 (NLP) 任務上的效能。帶有標籤的範例的格式會設定為提示-回應配對，並依照指示的用詞表達。



若要瞭解支援的資料集檔案類型，請參閱[支援的資料集檔案類型](#autopilot-llms-finetuning-dataset-format)。

若要瞭解輸入資料格式，請參閱[指令微調的輸入資料格式](#autopilot-llms-finetuning-input-format)。

## 支援的資料集檔案類型
<a name="autopilot-llms-finetuning-dataset-format"></a>

Autopilot 支援格式化為 CSV 檔案 (預設) 或 Parquet 檔案的指令微調資料集。
+ **CSV** (逗號分隔值) 是一種基於行的文件格式，以人類可讀的純文字格式存放資料，這是資料交換的流行選擇，因其具備廣泛的應用程式支援。
+ **Parquet** 是一種二進位欄型檔案格式，其資料存放和處理比 CSV 等人類可讀的檔案格式更有效率。這使其成為解決巨量資料問題的更好選擇。

**注意**  
資料集可能包含多個檔案，每個檔案都必須符合特定的範本。如需關於格式化您的輸入資料的相關資訊，請參閱[指令微調的輸入資料格式](#autopilot-llms-finetuning-input-format)。

## 指令微調的輸入資料格式
<a name="autopilot-llms-finetuning-input-format"></a>

資料集的每個檔案都必須遵循下列格式：
+ 資料集必須只包含兩個以逗號分隔且具名的資料欄，分別為`input`和`output`。Autopilot 不允許任何額外的資料欄。
+ `input`欄位包含提示，其對應的`output`列包含預期的答案。`input`和`output`都是字串格式。

以下範例說明了在 Autopilot 中進行指令微調的輸入資料格式。

```
input,output
"<prompt text>","<expected generated text>"
```

**注意**  
我們建議使用至少 1000 列的資料集，以確保模型的最佳學習和效能。

此外，Autopilot 會根據所使用的模型類型，設定資料集中資料列數和內容長度的最大限制。
+ 資料集中的列數限制適用於資料集內所有檔案 (包括多個檔案) 的累計列數。如果定義了兩種[通道類型](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_AutoMLChannel.html) (一個用於訓練，另一個用於驗證)，則限制會套用至兩個通道中所有資料集的總列數。當資料列數目超過臨界值時，任務會失敗，並顯示驗證錯誤。
+ 當資料集中資料列的輸入或輸出長度超過語言模型上下文所設定的限制時，系統會自動截斷該資料列。如果資料集中超過 60% 的資料列在輸入或輸出中遭到截斷，Autopilot 都會因驗證錯誤而終止任務。

下表顯示每個模型的各項限制。


| JumpStart 模型 ID | API 請求中的 `BaseModelName` | 資料列限制 | 上下文長度限制 | 
| --- | --- | --- | --- | 
| huggingface-textgeneration-dolly-v2-3b-bf16 | Dolly3B | 10,000 列 | 1024 個標記 | 
| huggingface-textgeneration-dolly-v2-7b-bf16 | Dolly7B | 10,000 列 | 1024 個標記 | 
| huggingface-textgeneration-dolly-v2-12b-bf16 | Dolly12B | 10,000 列 | 1024 個標記 | 
| huggingface-llm-falcon-7b-bf16 | Falcon7B | 1,000 列 | 1024 個標記 | 
| huggingface-llm-falcon-7b-instruct-bf16 | Falcon7BInstruct | 1,000 列 | 1024 個標記 | 
| huggingface-llm-falcon-40b-bf16 | Falcon40B | 10,000 列 | 1024 個標記 | 
| huggingface-llm-falcon-40b-instruct-bf16 | Falcon40BInstruct | 10,000 列 | 1024 個標記 | 
| huggingface-text2text-flan-t5-large | FlanT5L | 10,000 列 | 1024 個標記 | 
| huggingface-text2text-flan-t5-xl | FlanT5XL | 10,000 列 | 1024 個標記 | 
| huggingface-text2text-flan-t5-xxll | FlanT5XXL | 10,000 列 | 1024 個標記 | 
| meta-textgeneration-llama-2-7b | Llama2-7B | 10,000 列 | 2048 個標記 | 
| meta-textgeneration-llama-2-7b-f | Llama2-7BChat | 10,000 列 | 2048 個標記 | 
| meta-textgeneration-llama-2-13b | Llama2-13B | 7,000 列 | 2048 個標記 | 
| meta-textgeneration-llama-2-13b-f | Llama2-13BChat | 7,000 列 | 2048 個標記 | 
| huggingface-llm-mistral-7b | Mistral7B | 10,000 列 | 2048 個標記 | 
| huggingface-llm-mistral-7b-instruct | Mistral7BInstruct | 10,000 列 | 2048 個標記 | 
| huggingface-textgeneration1-mpt-7b-bf16 | MPT7B | 10,000 列 | 1024 個標記 | 
| huggingface-textgeneration1-mpt-7b-instruct-bf16 | MPT7BInstruct | 10,000 列 | 1024 個標記 | 