Hi,
Currently I am using this code below in Python to wait until the model is trained. I could not figure how to use events in Python’s API for that. It works. Maybe there is a better way?
api_key = "..."
print("Started Training ...")
id = fine_tune_response.id
error = False
while True:
cmd = "openai -k " + api_key + " api fine_tunes.get -i " + id
result = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True)
if "\"status\": \"succeeded\"" in str(result.stdout):
print("Succeeded")
break
if result.stderr !=None:
print("Error in cmd!")
error = True
break
if "\"status\": \"failed\"" in str(result.stdout):
print("Failed remote job!")
error = True
break
time.sleep(20)
print("Still training ...")
print("Done Training")
if error == False:
#retrieve model
#test with different prompts