- Fine-tuning: Text-to-text
-
若要微調 text-to-text 模型,請建立含有多JSON行的JSONL檔案,以準備訓練和選擇性驗證資料集。每JSON行都是同時包含prompt
和completion
欄位的範例。每個記號使用 6 個字元作為記號數量的近似值。格式如下所示。
{"prompt": "<prompt1>", "completion": "<expected generated text>"}
{"prompt": "<prompt2>", "completion": "<expected generated text>"}
{"prompt": "<prompt3>", "completion": "<expected generated text>"}
以下是問答任務的範例項目:
{"prompt": "what is AWS", "completion": "it's Amazon Web Services"}
- Fine-tuning: Text-to-image & Image-to-embeddings
-
若要微調 text-to-image 或 image-to-embedding 模型,請建立含有多JSON行的JSONL檔案,以準備訓練資料集。不支援驗證資料集。每一JSON行都是一個樣本image-ref
,其中包含一URI個圖像的 Amazon S3,caption
以及一個可能是提示圖像。
影像必須為JPEG或PNG格式。
{"image-ref": "s3://bucket/path/to/image001.png", "caption": "<prompt text>"}
{"image-ref": "s3://bucket/path/to/image002.png", "caption": "<prompt text>"}
{"image-ref": "s3://bucket/path/to/image003.png", "caption": "<prompt text>"}
以下是範例項目:
{"image-ref": "s3://amzn-s3-demo-bucket/my-pets/cat.png", "caption": "an orange cat with white spots"}
若要允許 Amazon 基岩存取映像檔,請在主控台中存取訓練和驗證檔案,以及在 S3 中寫入輸出檔案的權限為您設定的 Amazon 基岩模型自訂服務角色新增類似的IAM政策。您在訓練資料集中提供的 Amazon S3 路徑必須位於您在政策中指定的資料夾中。
- Continued Pre-training: Text-to-text
-
若要在 text-to-text 模型上執行「繼續預先訓練」,請透過建立具有多JSON行的JSONL檔案來準備訓練和選用的驗證資料集。因為繼續預先訓練涉及未標記的資料,因此每JSON行都是僅包含欄位的範例。input
每個記號使用 6 個字元作為記號數量的近似值。格式如下所示。
{"input": "<input text>"}
{"input": "<input text>"}
{"input": "<input text>"}
以下是可能位於訓練資料中的範例項目。
{"input": "AWS stands for Amazon Web Services"}
- Fine-tuning: Single-turn messaging
-
若要使用單回合傳訊格式微調 text-to-text 模型,請建立含有多JSON行的JSON檔案,以準備訓練和選擇性驗證資料集。兩個資料檔案的JSONL格式都必須是。每行都以 json 格式指定一個完整的數據樣本; 並且每個數據樣本必須格式化為 1 行(刪除每個樣本中的所有 '\ n')。具有多個數據樣本的一行或將數據樣本拆分為多行將不起作用。
欄位
規則
-
messages
陣列必須包含 2 則訊息
-
第一條消息必須有role
一個用戶
-
最後一條消息必須有role
一個助理
{"system": "<system message>","messages":[{"role": "user", "content": "<user query>"},{"role": "assistant", "content": "<expected generated text>"}]}
範例
{"system": "You are an helpful assistant.","messages":[{"role": "user", "content": "what is AWS"},{"role": "assistant", "content": "it's Amazon Web Services."}]}
- Fine-tuning: Multi-turn messaging
-
若要使用多回合傳訊格式微調 text-to-text 模型,請建立含有多JSON行的JSONL檔案,以準備訓練和選擇性驗證資料集。兩個資料檔案的JSONL格式都必須是。每行都以 json 格式指定一個完整的數據樣本; 並且每個數據樣本必須格式化為 1 行(刪除每個樣本中的所有 '\ n')。具有多個數據樣本的一行或將數據樣本拆分為多行將不起作用。
欄位
規則
{"system": "<system message>","messages":[{"role": "user", "content": "<user query 1>"},{"role": "assistant", "content": "<expected generated text 1>"}, {"role": "user", "content": "<user query 2>"},{"role": "assistant", "content": "<expected generated text 2>"}]}
範例
{"system": "system message","messages":[{"role": "user", "content": "Hello there."},{"role": "assistant", "content": "Hi, how can I help you?"},{"role": "user", "content": "what are LLMs?"},{"role": "assistant", "content": "LLM means large language model."},]}