Fine Tuning
Fine TuningJobs
Manage fine-tuning jobs to tailor a model to your specific training data.
resource openai_fine_tuning_job
required
The name of the model to fine-tune. You can select one of the supported models.
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.
The contents of the file should differ depending on if the model uses the chat, completions format, or if the fine-tuning method uses the preference format.
See the fine-tuning guide for more details.
optional
The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.
A string of up to 64 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-4o-mini:openai:custom-model-name:7p4lURel.
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.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
computed
The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
The current status of the fine-tuning job, which can be either validating_files, queued, running, succeeded, failed, or cancelled.
The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
openai_fine_tuning_job
resource "openai_fine_tuning_job" "example_fine_tuning_job" {
model = "gpt-4o-mini"
training_file = "file-abc123"
hyperparameters = {
batch_size = "auto"
learning_rate_multiplier = "auto"
n_epochs = "auto"
}
integrations = [{
type = "wandb"
wandb = {
project = "my-wandb-project"
entity = "entity"
name = "name"
tags = ["custom-tag"]
}
}]
metadata = {
foo = "string"
}
method = {
type = "supervised"
dpo = {
hyperparameters = {
batch_size = "auto"
beta = "auto"
learning_rate_multiplier = "auto"
n_epochs = "auto"
}
}
reinforcement = {
grader = {
input = "input"
name = "name"
operation = "eq"
reference = "reference"
type = "string_check"
}
hyperparameters = {
batch_size = "auto"
compute_multiplier = "auto"
eval_interval = "auto"
eval_samples = "auto"
learning_rate_multiplier = "auto"
n_epochs = "auto"
reasoning_effort = "default"
}
}
supervised = {
hyperparameters = {
batch_size = "auto"
learning_rate_multiplier = "auto"
n_epochs = "auto"
}
}
}
seed = 42
suffix = "x"
validation_file = "file-abc123"
}
data openai_fine_tuning_job
computed
The Unix timestamp (in seconds) for when the fine-tuning job is estimated to finish. The value will be null if the fine-tuning job is not running.
The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running.
The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running.
The current status of the fine-tuning job, which can be either validating_files, queued, running, succeeded, failed, or cancelled.
The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running.
The file ID used for training. You can retrieve the training data with the Files API.
The file ID used for validation. You can retrieve the validation results with the Files API.
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the Files API.
openai_fine_tuning_job
data "openai_fine_tuning_job" "example_fine_tuning_job" {
fine_tuning_job_id = "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
}
data openai_fine_tuning_jobs
optional
openai_fine_tuning_jobs
data "openai_fine_tuning_jobs" "example_fine_tuning_jobs" {
metadata = {
foo = "string"
}
}
Fine TuningJobsCheckpoints
Manage fine-tuning jobs to tailor a model to your specific training data.
data openai_fine_tuning_job_checkpoints
openai_fine_tuning_job_checkpoints
data "openai_fine_tuning_job_checkpoints" "example_fine_tuning_job_checkpoints" {
fine_tuning_job_id = "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
}
Fine TuningCheckpointsPermissions
Manage fine-tuning jobs to tailor a model to your specific training data.
resource openai_fine_tuning_checkpoint_permission
required
computed
openai_fine_tuning_checkpoint_permission
resource "openai_fine_tuning_checkpoint_permission" "example_fine_tuning_checkpoint_permission" {
fine_tuned_model_checkpoint = "ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd"
project_ids = ["string"]
}
data openai_fine_tuning_checkpoint_permission
optional
openai_fine_tuning_checkpoint_permission
data "openai_fine_tuning_checkpoint_permission" "example_fine_tuning_checkpoint_permission" {
fine_tuned_model_checkpoint = "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
after = "after"
limit = 0
order = "ascending"
project_id = "project_id"
}
data openai_fine_tuning_checkpoint_permissions
optional
openai_fine_tuning_checkpoint_permissions
data "openai_fine_tuning_checkpoint_permissions" "example_fine_tuning_checkpoint_permissions" {
fine_tuned_model_checkpoint = "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
project_id = "project_id"
}