@luke, Does your application need to be approved for this to work? I’m getting API key errors? I’ve stared out the response below.
C:\Users\KevinM\AppData\Local\Programs\Python\Python39\Scripts>py openai api fine_tunes.create -t C:\Users\KevinM\AppData\Local\Programs\Python\Python39\upload.json -m curie
←[91mError:←[0m Incorrect API key provided: “******************************************”. You can find your API key at https://beta.openai.com. (HTTP status code: 401)
Solution
I had used Set OPENAI_API_KEY="<OPENAI_API_KEY>" before running (on Windows). This didn’t work, use the -k flag to pass in the API Key directly.
Thanks to @m-a.schenk for the 2nd time helping me out here.
openai installation successful and even tried ```
response = openai.Completion.create(engine=“davinci”, prompt=“This is a test”, max_tokens=5)
print(response)
giving response properly.
But in next step when trying to upload the training data csv file, it’s giving syntax error as mentioned earlier.
I may be able to help you out. If you’re getting errors right at the beginning of that command, then it sounds like you may not have the Python 3.9 path set in your Environmental Variables so that Command Prompt will find ‘openai’ and run it properly. ‘openai’ is located at [Python install path]\Scripts\openai, as shown below:
Make sure in your Environmental Variables you have this:
Where ‘iadmin’ is your username. This will allow your system to find that ‘openai’ file and you’ll be able to use it accordingly. However, have a look at my post discussing the best way to use the ‘openai’ tool with Windows here. Basically, using Command Prompt and PowerShell is problematic with the ‘openai’ command, but downloading Git Bash or any terminal with Bash shell support in Windows is the way to go. This is because the ‘openai’ file is designed to work with Linux’s Bash shell primarily and since it doesn’t technically have an extension, using the ‘openai’ commands within Command Prompt and PowerShell will result in those terminals asking you which program you’re trying to open ‘openai’ with instead of actually running the command as desired.
I recommend Git Bash simply because as soon as you install it you can run it and start using the ‘openai’ command.
Lastly, I see you reference the path as: \Users\username\Desktop\trial\local.csv
but you should really reference any file within quotations and ensure that you have the full path: "C:\Users\<USERNAME>\Desktop\trial\local.csv"
so the correct command you’d run in Git Bash or any terminal with Bash shell support in Windows is:
@DutytoDevelop
Hi Nicholas,
Thanks for your nice response. I tried with adding path in Environmental Variables and adding openai tools fine_tunes.prepare_data -f “C:\Users<USERNAME>\Desktop\trial\local.csv”
In CLI & PowerShell, it didn’t work. But I tried by installing git Bash and successfully created .jsonl
Then when I tried to create the model using
openai api fine_tunes.create -t “C:\Users<USERNAME>\Desktop\trial\local_prepared.jsonl”
It’s giving API Key authentication error. Can you please help me in fixing it. Thanks.
Nice, glad to hear that Git Bash worked successfully!
If you get the OpenAI API key error, then you need to ensure that:
The environmental variable ‘OPENAI_API_KEY’ is set correctly with the correct OpenAI API key listed on the API key page (‘SK-…’) and that you also restarted your system after that to access the environmental key. NOTE: Do not add quotes to the API key if you’re adding it as an environmental variable.
Let me know if that doesn’t work because I believe you can also manually set the api_key variable by running:
# Confirmed this is correct (Line 161 in OpenAI module -> util.py file)
openai.api_key = "SK-..." # Quotes around API key is needed in this scenario.
Then try to create a fine_tune and let me know if it works after that!
Edit: Also ensure that you’ve completely upgraded the openai-python module by running the ‘pip install --upgrade openai’ command
Does anyone know if there is a way to continue fine-tuning an already fine-tuned model? Can’t find anything to that extent in the documentation. I have some time-dependent data, so I’d like to train on the first set, see how it performs on the second set, then train on the second set, see how it performs on the third set etc. etc.
Hi Dave, I am creating a great tool to help prepare data for fine-tuning. Seem like I might be a little late here. But let me know if I can contribute. Ray