Skip to content

Instantly share code, notes, and snippets.

@fsndzomga
Created March 5, 2024 21:08
Show Gist options
  • Save fsndzomga/c937b26bb7dc06b9569e6512c90b3a70 to your computer and use it in GitHub Desktop.
Save fsndzomga/c937b26bb7dc06b9569e6512c90b3a70 to your computer and use it in GitHub Desktop.
training_response = openai.File.create(
file=open(training_file_name, "rb"), purpose="fine-tune"
)
training_file_id = training_response["id"]
validation_response = openai.File.create(
file=open(validation_file_name, "rb"), purpose="fine-tune"
)
validation_file_id = validation_response["id"]
print("Training file ID:", training_file_id)
print("Validation file ID:", validation_file_id)
response = openai.FineTuningJob.create(
training_file=training_file_id,
validation_file=validation_file_id,
model="gpt-3.5-turbo",
suffix="franckwole-rep",
)
job_id = response["id"]
print("Job ID:", response["id"])
print("Status:", response["status"])
response = openai.FineTuningJob.retrieve(job_id)
fine_tuned_model_id = response["fine_tuned_model"]
if fine_tuned_model_id is None:
raise RuntimeError("Fine-tuned model ID not found. Your job has likely not been completed yet.")
print("Fine-tuned model ID:", fine_tuned_model_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment