Hello - new to fine-tuning GPT3.5-turbo and having an issue uploading my .JSONL dataset.
The full output of the command is:
$ ./fine_tuning_steps_updated.sh
Uploaded file. Received TRAINING_FILE_ID: file-872Htvk4v7WH9YoyigUe8fNj
Waiting for the file to be ready for fine-tuning...
JOB_RESPONSE: {
"error": {
"message": "file-872Htvk4v7WH9YoyigUe8fNj has 4 example(s), but must have at least 10 examples",
"type": "invalid_request_error",
"param": null,
"code": "invalid_n_examples"
}
}
The data set is a set of 100 email threads, with inquiries and replies.
I am confused about the āHas 4 examples, but must have at least 10 examplesā and I can find no reference to this anywhere in the forums or general web searches.
I have manually confirmed the structure of the dataset is ideal, Iāve counted 100 examples in the data set, and still Iām getting the same error with no idea what to do next.
Any guidance would be appreciated, Iāve consulted the API documentation on fine tuning time and time again, but I just canāt make sense of the issue.
Edit:
Wanted to add my full fine-tuning script.sh
#!/bin/bash
# Define variables
API_KEY="*****************OMITTED***********"
TRAINING_FILE_PATH="converted_data.jsonl"
# Step 1: Upload the file to OpenAI
UPLOAD_RESPONSE=$(curl -v https://api.openai.com/v1/files \
-H "Authorization: Bearer $API_KEY" \
-F "purpose=fine-tune" \
-F "file=@$TRAINING_FILE_PATH")
TRAINING_FILE_ID=$(echo $UPLOAD_RESPONSE | jq -r '.id')
echo "Uploaded file. Received TRAINING_FILE_ID: $TRAINING_FILE_ID"
echo "Full upload response: $UPLOAD_RESPONSE"
# Step 2: Create a Fine-Tuning Job
JOB_RESPONSE=$(curl -s https://api.openai.com/v1/fine_tuning/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"training_file": "'$TRAINING_FILE_ID'",
"model": "gpt-3.5-turbo-0613"
}')
JOB_ID=$(echo $JOB_RESPONSE | jq -r '.id')
echo "Fine-tuning job initiated with JOB_ID: $JOB_ID"
# Step 3: Periodically check the status of the fine-tuning job
while true; do
STATUS_RESPONSE=$(curl -s https://api.openai.com/v1/fine_tuning/jobs/$JOB_ID \
-H "Authorization: Bearer $API_KEY")
STATUS=$(echo $STATUS_RESPONSE | jq -r '.status')
if [[ $STATUS == "succeeded" ]]; then
MODEL_ID=$(echo $STATUS_RESPONSE | jq -r '.fine_tuned_model')
echo "Fine-tuning succeeded! Fine-tuned Model ID: $MODEL_ID"
break
elif [[ $STATUS == "failed" ]]; then
echo "Fine-tuning failed. Exiting."
exit 1
else
echo "Job status: $STATUS. Waiting for 5 minutes before checking again..."
sleep 300 # Wait for 5 minutes
fi
done