Documentation
¶
Overview ¶
Package fine-tuning provides bindings for the finetunes endpoint. Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: Fine-tune models.
Index ¶
Constants ¶
const Endpoint = common.BaseURL + "fine_tuning/jobs"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreationRequest ¶
type CreationRequest struct { // The name of the model to fine-tune. You can select one of the supported [models]. // // [models]: https://platform.openai.com/docs/models/overview Model string `json:"model,omitempty"` // The ID of an uploaded file that contains training data. // // See [upload file] for how to upload a file. // // Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose fine-tune. // // See the [fine-tuning guide] for more details. // // [upload file]: https://beta.openai.com/docs/api-reference/files/upload // [fine-tuning guide]: https://beta.openai.com/docs/guides/fine-tuning/creating-training-data TrainingFile string `json:"training_file,omitempty"` // The hyperparameters used for the fine-tuning job. Hyperparams HyperParameters `json:"hyperparameters"` // A string of up to 18 characters that will be added to your fine-tuned model name. // // For example, a suffix of "custom-model-name" would produce a model name like // ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel. Suffix *string `json:"suffix,omitempty"` // The ID of an uploaded file that contains validation data. // // If you provide this file, the data is used to generate validation metrics periodically // during fine-tuning. These metrics can be viewed in the fine-tuning results file. The // same data should not be present in both train and validation files. // // Your dataset must be formatted as a JSONL file. You must upload your file with the // purpose fine-tune. // // See the [fine-tuning guide] for more details. // // [fine-tuning results]: https://beta.openai.com/docs/guides/fine-tuning/analyzing-your-fine-tuned-model // [fine-tuning guide]: https://beta.openai.com/docs/guides/fine-tuning/creating-training-data ValidationFile *string `json:"validation_file,omitempty"` }
Request structure for the "create" fine-tune endpoint.
type DeleteResponse ¶
type DeleteResponse struct { ID int64 `json:"id"` Object string `json:"object"` Deleted bool `json:"deleted"` Error *common.ResponseError `json:"error,omitempty"` }
func MakeDeleteRequest ¶
func MakeDeleteRequest(fineTuneModel string, organizationID *string) (*DeleteResponse, error)
Delete a fine-tuned model. You must have the Owner role in your organization.
type FineTune ¶
type FineTune struct { ID string `json:"id"` CreatedAt uint64 `json:"created_at"` Error *common.ResponseError `json:"error,omitempty"` FineTunedModel string `json:"fine_tuned_model"` FinishedAt uint64 `json:"finished_at"` Hyperparams HyperParameters `json:"hyperparameters"` Model string `json:"model"` Object string `json:"object"` OrganizationID string `json:"organization_id"` ResultFiles []string `json:"result_files"` Status string `json:"status"` TrainedTokens uint64 `json:"trained_tokens"` TrainingFile string `json:"training_file"` ValidationFile string `json:"validation_file"` }
Response structure for the "create" fine-tune endpoint.
func MakeCancelRequest ¶
Immediately cancel a fine-tune job.
func MakeCreationRequest ¶
func MakeCreationRequest(request *CreationRequest, organizationID *string) (*FineTune, error)
Creates a job that fine-tunes a specified model from a given dataset.
Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
type FineTuneEvent ¶
type HyperParameters ¶
type HyperParameters struct { // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. BatchSize uint64 `json:"batch_size"` // Scaling factor for the learning rate. A smaller learning rate may be // useful to avoid overfitting. LearningRateMultiplier float64 `json:"learning_rate_multiplier"` // The number of epochs to train the model for. An epoch refers to one // full cycle through the training dataset. NEpochs uint64 `json:"n_epochs"` }
type ListEventsResponse ¶
type ListEventsResponse struct { Object string `json:"object"` Data []FineTuneEvent `json:"data"` Error *common.ResponseError `json:"error,omitempty"` HasMore bool `json:"has_more"` }
func MakeListEventsRequest ¶
func MakeListEventsRequest(fineTuneID string, limit *uint64, after, organizationID *string) (*ListEventsResponse, error)
Get fine-grained status updates for a fine-tune job.
type ListResponse ¶
type ListResponse struct { Object string `json:"object"` Data []FineTune `json:"data"` Error *common.ResponseError `json:"error,omitempty"` HasMore bool `json:"has_more"` }
func MakeListRequest ¶
func MakeListRequest(limit *uint64, after, organizationID *string) (*ListResponse, error)
List your organization's fine-tuning jobs