Skip to content

Receive Fine tuning format error when trying to fine tune using the console

0

I keep getting the following error when kicking off a fine tuning job: Unable to parse S3 file due to invalid data schema/format. For more information on training dataset format requirements, see the Amazon Bedrock User Guide. (Service: BedrockMetadata, Status Code: 400, Request ID: f6b5feef-5c34-47e7-9fad-326020c1cd82) (SDK Attempt Count: 1)

As far as I can tell the format exactly matches what is called for in the User Guide for a Nova Pro fine tuning job. Here are the first 3 lines within the jsonl file: // train.jsonl {"schemaVersion": "bedrock-conversation-2024", "system": [{"text": "You are a digital assistant with a friendly personality"}], "messages": [{"role": "user", "content": [{"text": "What is the first step I must take before proceeding to change any information?"}]}, {role": "assistant", "content": [{"text": "You must coordinate with all those who need access."}]}]} {"schemaVersion": "bedrock-conversation-2024", "system": [{"text": "You are a digital assistant with a friendly personality"}], "messages": [{"role": "user", "content": [{"text": "Before I dive into tweaking details, what is the first step I need to take?"}]}, {role": "assistant", "content": [{"text": "You must coordinate with all those who need access."}]}]}

I checked two different online jsonl validators and they think that is valid jsonl. Does any have an example file or can output an example that works?

1 Answer
0
Accepted Answer

The error you're encountering is likely due to formatting issues in your JSONL file. Looking at the example you provided, there are a few problems:

  1. The file appears to contain comments (the line starting with //), which are not valid in JSONL format.

  2. There's a syntax error in your JSON objects - in both examples, you're missing a quotation mark before "role" in the assistant's response. It should be {"role": "assistant"... instead of {role": "assistant"....

  3. JSONL requires each JSON object to be on a single line with no additional new lines or empty lines.

For fine-tuning models in Amazon Bedrock, each line must be a valid JSON object. Make sure:

  • Remove any comments or header lines
  • Fix the missing quotation marks
  • Ensure each JSON object is complete and properly formatted
  • Verify there are no additional new lines between records

The JSONL file should look like this (with each JSON object on a single line):

{"schemaVersion": "bedrock-conversation-2024", "system": [{"text": "You are a digital assistant with a friendly personality"}], "messages": [{"role": "user", "content": [{"text": "What is the first step I must take before proceeding to change any information?"}]}, {"role": "assistant", "content": [{"text": "You must coordinate with all those who need access."}]}]}
{"schemaVersion": "bedrock-conversation-2024", "system": [{"text": "You are a digital assistant with a friendly personality"}], "messages": [{"role": "user", "content": [{"text": "Before I dive into tweaking details, what is the first step I need to take?"}]}, {"role": "assistant", "content": [{"text": "You must coordinate with all those who need access."}]}]}

Even if online JSONL validators accept your file, Amazon Bedrock has specific formatting requirements for fine-tuning jobs.
Sources
Troubleshooting model customization issues - Amazon Bedrock
Prepare your training datasets for fine-tuning and continued pre-training - Amazon Bedrock

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.