Fine-tuning Beta Release

What does this mean - “During the beta there is a limit of 10 fine-tuning runs per month”

@JasonW, I meant that you could use the playground to set up your desired prompt + completion to make sure it works fine, then add it to the fine-tuning file.
I can’t promise that it will work, but for me, it worked.
Generally speaking, you suppose to use fine-tuning to train GPT-3 to follow instructions better by providing many examples of prompts+completions.
My suggestion was to try to add more sophisticated prompts and completions that include the instructions within them so the model might also pick up the instructions and use more than just statistic completion.

1 Like

Tokens are what we really care about! If you have a requirement beyond that limit, feel free to reach out.

Hi Luke. I’ve applied for access to the Davinci fine-tuning service. I’ve tried curie and it simply doesn’t work for my use case. Is there a time frame in which I could expect a response? Is there a large queue?

1 Like

Can a fine-tuned model, belonging to one org be used by making calls with API keys from another org?

Never mind. This seems to be already tackled in a different post - Possible to share finetuned model with another user?

1 Like

I keep getting

“You requested a model that is not compatible with this engine at the moment. (Feel free to email support@openai.com if you need assistance.)”

trying to run a finetuned curie model, I’m assuming the error message is incorrect and that the model simply just isn’t ready? How long does it usually take for the model to be ready?

After your job first completes, it may take several minutes for your model to become ready to handle requests. If completion requests to your model time out, it is likely because your model is still being loaded. If this happens, try again in a few minutes.

1 Like

@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.

2 Likes

@luke Hi,
Am trying to finetune but getting error while preparing data, it’s giving sytax error.

openai tools fine_tunes.prepare_data -f \Users\username\Desktop\trial\local.csv
File “”, line 1
openai tools fine_tunes.prepare_data -f \Users\username\Desktop\trial\local.csv
^
SyntaxError: invalid syntax

Please do help me in fixing. Thanks.

It looks like you either haven’t installed openai or haven’t run import openai / or don’t have it in your PATH.

Personally, I think it’s easier to run python using anaconda, pycharm or vs code.

  1. What happens if you just run openai ? Do you get the same / similar error?
    ----a. If you do, then make sure you have installed openai by running,
pip install openai

Did you manage to install openai without any errors? Try run only openai again. You shouldn’t get a syntax error.

If it’s still not working, run

import openai

openai

Then you should an output similar to what you see in my image. Still no luck?

Then it would really help if you provide some more info. It’s very difficult to assist someone asking for help but not providing any or little info.

What OS are you running?
Python version?
Are you running in a terminal, powershell, similar or in something like anaconda, pycharm or vscode?

1 Like

@Yodapp Thanks for your response.
Am currently on:
OS: Windows 10
Python: 3.9.6

Tried from command line interface as well as from VS Code and powershell.

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.

Hello @diptimayee,

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:

image

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:

openai tools fine_tunes.prepare_data -f "C:\Users\<USERNAME>\Desktop\trial\local.csv"

Hope this helps! Let me know if you run into any issues.

2 Likes

@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.

Hello @diptimayee,

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

2 Likes

Thanks Nicholas for your response.

I’ve tried everything as you informed above, but nothing worked in my Windows system.

Lastly I tried by uploading the .jsonl file created in my windows system to Mac system, and it worked & the fine tune model generated.

Am really thankful to you for your support.

2 Likes

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.

Not really. But what you can do is just train a brand new model with a newer, larger dataset

Hey @kevin4 , Would you be able to provide a example just so I understand the formatting when passing the API key?

how to finetune codex ?

Hi there! Codex fine-tuning is not currently available.