Is there somebody can help me
I am writing the fine-tuning code, all the parameters are set correctly. I have also checked the jsonl file, which is correct and can be uploaded normally. But when creating a fine-tuning project, an error will be reported.
Here is my code to create a fine-tuning project:
import openai
import logging
# Set API Key
openai.api_key = "sk-XXXXXXXXXXXX"
logging.basicConfig(level=logging.DEBUG)
# Create a fine-tuning task
try:
response = openai.FineTune.create(
training_file="file-XXXXXXXX",
model="gpt-3.5-turbo",
suffix="my-model"
)
print("Fine-tune job created successfully:")
print(response)
except openai.error.InvalidRequestError as e:
print(f"InvalidRequestError: {e}")
except openai.error.OpenAIError as e:
print(f"OpenAIError: {e}")
(My api key and file ID are filled in correctly, and the XXX in the code is a demonstration.)
The following is the error message returned after running:
DEBUG:openai:message='Request to OpenAI API' method=post path=https://api.openai.com/v1/fine-tunes
DEBUG:openai:api_version=None data='{"training_file": "file-XXXXX", "model": "gpt-3.5-turbo", "suffix": "my-model"}' message='Post details'
DEBUG:urllib3.util.retry:Converted retries value: 2 -> Retry(total=2, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.openai.com:443
DEBUG:urllib3.connectionpool:https://api.openai.com:443 "POST /v1/fine-tunes HTTP/1.1" 404 None
DEBUG:openai:message='OpenAI API response' path=https://api.openai.com/v1/fine-tunes processing_ms=None request_id=None response_code=404
OpenAIError: HTTP code 404 from API
(<html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
)
My test version information is as follows:
OpenAI SDK version: 0.28.0
Python version: 3.11.5
API Base: correctly set to https://api.openai.com
API Key: correctly set
Model name: gpt-3.5-turbo
File ID: correct and the file status is processed
The result of running print(hasattr(openai, 'FineTune')) is Ture.
At the same time, I also tried the cURL method, the code is as follows:
curl https://api.openai.com/v1/fine-tunes
-H "Content-Type: application/json"
-H "Authorization: Bearer sk-XXXXXX"
-d "{\"training_file\": \"file-XXXX\", \"model\": \"gpt-3.5-turbo\", \"suffix\": \"my-model\"}"
But the following error was returned:
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
I have checked all the steps and can’t find any problem, can anyone help me?