Curtis
Curtis

Reputation: 41

OpenAI Fine-Tuning error - 'fileName contains an invalid filename: wrong suffix.'

I am trying to fine-tune a GPT model through the Azure OpenAI API.

I now need to upload the file to openai using the code below:

file_name = "training_data_prepared.jsonl"

upload_response = openai.File.create(
  file=open(file_name, "rb"),
  purpose='fine-tune')

upload_response

However, when I run the code now, I get the following error:

InvalidRequestError: fileName contains an invalid filename: wrong suffix.

Everything is set up correctly on the API side, and I have converted a csv to jsonl using the 'openai tools fine_tunes.prepare_data' command and it correctly created the jsonl file. The configuration of the json file should be correct, and follows the openai guidelines for creating a fine-tuning dataset.

Upvotes: 3

Views: 1298

Answers (1)

RAJA KUMAR
RAJA KUMAR

Reputation: 11

I was facing same issue, but i added one more parameter and it works for me. the parameter was

training_response = openai.File.create(
    file=open(training_file_name, "r"), purpose="fine-tune",user_provided_filename=training_file_name
)

enter image description here

Upvotes: 1

Related Questions