本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
準備用於微調影像和文字處理模型的資料
注意
如需微調 Amazon Nova 模型的資訊,請參閱微調 Amazon Nova 模型。
對於微調影像文字轉文字模型,每個 JSON 物件都是一個範例,其中包含以 messages 陣列為結構的對話,由代表使用者輸入和助理回應的交替 JSON 物件所組成。使用者輸入可以同時包含文字和影像,而助理回應一律為文字。此結構支援單回合和多回合對話流程,讓模型能夠有效地處理各種任務。Meta Llama-3.2 11B Vision Instruct 和 Meta Llama-3.2 90B Vision
Instruct 支援的影像格式包括:gif、jpeg、png 和 webp。
若要允許 Amazon Bedrock 存取影像檔案,請在主控台中,將類似於 存取 S3 中訓練和驗證檔案以及寫入輸出檔案的許可 中的 IAM 政策新增到您設定的 Amazon Bedrock 模型自訂服務角色或自動為您設定的角色。您在訓練資料集中提供的 Amazon S3 路徑必須位於您在政策中指定的資料夾中。
單回合對話
單回合對話的每個 JSON 物件都包含使用者訊息和助理訊息。使用者訊息包含設為使用者的角色欄位,以及包含陣列的內容欄位,其中包含描述輸入模式 type 的欄位 (文字或影像)。對於文字輸入,content 欄位包含具有使用者問題或提示 text 的欄位。對於影像輸入,content 欄位會指定影像 format (例如 jpeg、png) 及其 source,其中的 uri 指向影像的 Amazon S3 位置。uri 代表存放在 Amazon S3 儲存貯體中影像的唯一路徑,通常格式為 s3://<bucket-name>/<path-to-file>。助理訊息包含以下欄位:設為助理的 role 欄位;content 欄位,其中包含 type 欄位設為文字的陣列;以及內含助理所產生回應的 text 欄位。
範例格式
{ "schemaVersion": "bedrock-conversation-2024", "system": [{ "text": "You are a smart assistant that answers questions respectfully" }], "messages": [{ "role": "user", "content": [{ "text": "What does the text in this image say?" }, { "image": { "format": "png", "source": { "s3Location": { "uri": "s3://your-bucket/your-path/your-image.png", "bucketOwner": "your-aws-account-id" } } } } ] }, { "role": "assistant", "content": [{ "text": "The text in the attached image says 'LOL'." }] } ] }
多回合對話
多回合對話的每個 JSON 物件都包含一系列具有交替角色的訊息,其中使用者訊息和助理訊息的結構一致,以允許有一致的交換。使用者訊息包含設為使用者的 role 欄位集,以及描述輸入模式的 content 欄位。對於文字輸入,content 欄位包含一個具有使用者問題或後續追蹤的 text 欄位,而對於影像輸入,它指定影像 format 及其 source,其中的 uri 指向影像的 Amazon S3 位置。uri 做為唯一識別碼,採用 s3://<bucket-name>/<path-to-file> 格式,並允許模型從指定的 Amazon S3 儲存貯體存取影像。助理訊息包含以下欄位:設為助理的 role 欄位;content 欄位,其中包含 type 欄位設為文字的陣列;以及內含助理所產生回應的 text 欄位。對話可以跨越多個交換,讓助理能夠維護內容並在整個過程中傳遞一致的回應。
範例格式
{ "schemaVersion": "bedrock-conversation-2024", "system": [{ "text": "You are a smart assistant that answers questions respectfully" }], "messages": [{ "role": "user", "content": [{ "text": "What does the text in this image say?" }, { "image": { "format": "png", "source": { "s3Location": { "uri": "s3://your-bucket/your-path/your-image.png", "bucketOwner": "your-aws-account-id" } } } } ] }, { "role": "assistant", "content": [{ "text": "The text in the attached image says 'LOL'." }] }, { "role": "user", "content": [{ "text": "What does the text in this image say?" } ] }, { "role": "assistant", "content": [{ "text": "The text in the attached image says 'LOL'." }] } ] }