AttributeError: module ‘openai’ has no attribute ‘FineTuneingJob’

题意 :尝试访问的 FineTuneingJob 属性在 openai 模块中不存在

问题背景:

I am attempting to start a fine-tuning job using GPT 3.5-turbo via a Python call, using the format listed in the fine-tuning reference, essentially:

我正在尝试通过Python调用使用GPT 3.5-turbo启动一个微调任务,使用微调参考中列出的格式,基本上是这样的:

python 复制代码
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.FineTuningJob.create(training_file="file-abc123", model="gpt-3.5-turbo")

However, I am running into the AttributeError "module 'openai' has no attribute 'FineTuneingJob'".

然而,我遇到了 AttributeError:"module 'openai' has no attribute 'FineTuneingJob'"。

I am running openai v0.27.8. In addition, I uploaded my training data successfully using

我正在运行 openai 的 v0.27.8 版本。此外,我已经成功上传了我的训练数据,使用的是

python 复制代码
openai.File.create(
    file=open("train_chat_gpt.jsonl", "rb"),
    purpose='fine-tune'
)

Any suggestions how to fix this? Thanks.

关于如何解决这个问题,有什么建议吗?谢谢。

问题解决:

Finally I found the solution.

最后我找到了解决方案。

I had an old version (0.27.8) of the openai module; however, the FineTuningJob function is available starting from version 0.27.9 of the module.

我使用的 openai 模块是旧版本(0.27.8),但是 FineTuningJob 函数从该模块的 0.27.9 版本开始才可用。

So, you need to update the openai module with the following command:

所以,你需要使用以下命令来更新 openai 模块:

python 复制代码
pip install --upgrade openai
相关推荐
奕成则成10 分钟前
Python 创建虚拟环境
开发语言·python
lambo mercy1 小时前
python入门
前端·数据库·python
0和1的舞者1 小时前
Python函数与列表元组全解析
python·学习·学习方法·知识
2401_841495641 小时前
【机器学习】限制性玻尔兹曼机(RBM)
人工智能·python·深度学习·神经网络·机器学习·无监督学习·限制性玻尔兹曼机
我送炭你添花1 小时前
Pelco KBD300A 模拟器:06+3.从教学级到企业级工程化转型(二次迭代)
python·测试工具·运维开发
不要em0啦2 小时前
从0开始学python:简单的练习题4
开发语言·python
小李云雾2 小时前
Python 多任务编程入门:进程的创建、同步与进程池使用
开发语言·数据库·python·oracle
AI Echoes2 小时前
LangChain中的工具与工具包
人工智能·python·langchain·prompt·agent
浔川python社2 小时前
浔川社团 2026 更新程序安排
python
彼岸花开了吗2 小时前
构建AI智能体:七十二、交叉验证:从模型评估的基石到大模型时代的演进
人工智能·python·llm