Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataset validation failed: {consecutive_turns: [73]} error while tuning gemini-1.0-pro-002

I created a jsonl file dataset to fine tune gemini 1.0. But my attempts result in the error with this message. I did my best to follow the documentation. The format of messages are like this:

...
{"messages": [{"role": "user", "content": "some message"}, {"role": "model", "content": "some response"}]}
{"messages": [{"role": "user", "content": some message"}, {"role": "model", "content": "some response"}]}
{"messages": [{"role": "user", "content": "some message"}, {"role": "model", "content": "some response"}]}
{"messages": [{"role": "user", "content": "some message"}, {"role": "model", "content": "some response"}]}
{"messages": [{"role": "user", "content": some message"}, {"role": "model", "content": "some response"}]}
{"messages": [{"role": "user", "content": "some message"}, {"role": "model", "content": "some response"}]}
...

0 1 356
1 REPLY 1

Here are a few steps to troubleshoot and fix the issue:

Check for Proper JSON Formatting:
Ensure that each JSON object is correctly formatted. For example, the second message you posted has an unquoted "some message" string:

{"role": "user", "content": some message"}

This should be:

{"role": "user", "content": "some message"}

Inspect Line 73:
Specifically look at the line 73 of your JSONL file. There might be an issue with this line or its adjacent lines.

Make sure it follows the correct format:

{"messages": [{"role": "user", "content": "some message"}, {"role": "model", "content": "some response"}]}

Ensure each message follows the structure of an array of message objects, each containing a role and content key. There should not be any missing braces or commas.

Make sure all string values are enclosed in double quotes. JSON does not allow single quotes or unquoted strings.

Check that no content fields are empty, as this could also cause validation issues.

Here's an example of a properly formatted JSONL snippet:

Show More
{"messages": [{"role": "user", "content": "Hello, how are you?"}, {"role": "model", "content": "I am good, thank you!"}]}
{"messages": [{"role": "user", "content": "What's the weather like today?"}, {"role": "model", "content": "It's sunny and warm."}]}

By fixing these common issues, you should be able to resolve the validation error. If the problem persists, you might want to share the specific line 73 (and a few lines before and after it) for a more detailed inspection.