openai-apichatgpt-apifine-tuning

AttributeError: module ‘openai’ has no attribute ‘FineTuneingJob’


I am attempting to start a fine-tuning job using GPT 3.5-turbo via a Python call, using the format listed in the fine-tuning reference, essentially:

import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.FineTuningJob.create(training_file="file-abc123", model="gpt-3.5-turbo")

However, I am running into the AttributeError “module ‘openai’ has no attribute ‘FineTuneingJob’”.

I am running openai v0.27.8. In addition, I uploaded my training data successfully using

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

Any suggestions how to fix this? Thanks.


Solution

  • Finally I found the solution.

    I had an old version (0.27.8) of the openai module; however, the FineTuningJob function is available starting from version 0.27.9 of the module.

    So, you need to update the openai module with the following command:

    pip install --upgrade openai