-
-
Notifications
You must be signed in to change notification settings - Fork 6
OpenAI.FineTuneJob
OpenAI.FineTuneJob
Protected Class FineTuneJob
This class represents a fine-tune job that is, has been, or will be run with one of the base AI models. Refer to the OpenAI documentation on the /v1/fine_tuning/jobs
endpoint for further details.
Fine tuning requires the creation of JSONL-formatted training files. Refer to the FineTuneData class to generate such files.
This example creates a new fine tuning job using a previously-uploaded JSONL training File:
OpenAI.APIKey = "YOUR API KEY"
Dim trainingfile As OpenAI.File = OpenAI.File.Lookup(0) ' a previously uploaded training file
Dim basemodel As OpenAI.Model = "gpt-3.5-turbo-1106" ' the model to be trained
Dim job As OpenAI.FineTuneJob = OpenAI.FineTuneJob.Create(trainingfile, basemodel, "test")
Dim jobID As String = job.ID ' e.g. "ftjob-cBiqPrOfW8sLZSSlMI2mLNYX"
Once the job is created it will take some time before it is finished running. You can check the status of a job by reading its Status
property. You can retrieve existing jobs by calling the Lookup()
shared method:
OpenAI.APIKey = "YOUR API KEY"
Dim job As OpenAI.FineTuneJob = OpenAI.FineTuneJob.Lookup("ftjob-cBiqPrOfW8sLZSSlMI2mLNYX")
Select Case job.Status
Case OpenAI.JobStatus.Succeeded
' finished running successfully
Case OpenAI.JobStatus.Failed
' finished running with errors
Else
' running or processing
End Select
After the fine-tune job has successfully completed, the resulting fine-tuned Model will be available for use with any compatible endpoint:
OpenAI.APIKey = "YOUR API KEY"
Dim job As OpenAI.FineTuneJob = OpenAI.FineTuneJob.Lookup("ftjob-cBiqPrOfW8sLZSSlMI2mLNYX")
If job.Status = OpenAI.JobStatus.Succeeded Then
Dim modelID As String = job.FineTunedModel.ID ' e.g. "ft:gpt-3.5-turbo-1106:personal:test:8dwvgMxW"
End If
Fine-tuned models are also listed alongside the base models:
OpenAI.APIKey = "YOUR API KEY"
Dim m As OpenAI.Model = "ft:gpt-3.5-turbo-1106:personal:test:8dwvgMxW"
Dim response As OpenAI.ChatCompletion = OpenAI.ChatCompletion.Create("user", "What time is it?", m)
Dim chatreply As String = response.GetResult()
- Created As Date
- ErrorCode As Integer
- ErrorMessage As String
- ErrorParam As String
- FineTunedModel As OpenAI.Model
- Finished As Date
- Hyperparameters As Dictionary
- ID As String
- Organization As String
- ResultFileCount As Integer
- Status As FineTuneJob.JobStatus
- TokenCount As Integer
- TrainingFile As OpenAI.File
- ValidationFile As OpenAI.File
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2023-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.