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
相关推荐
薄荷很无奈几秒前
CuML + Cudf (RAPIDS) 加速python数据分析脚本
python·机器学习·数据分析·gpu算力
yivifu6 分钟前
pyqt中以鼠标所在位置为锚点缩放图片
python·pyqt·以鼠标为锚点缩放图片
正在走向自律17 分钟前
AI数字人:繁荣背后的伦理困境与法律迷局(8/10)
人工智能·python·opencv·语音识别·ai数字人·ai伦理与法律
带刺的坐椅27 分钟前
开发 MCP Proxy(代理)也可以用 Solon AI MCP 哟!
java·ai·llm·solon·mcp·mcp-server·mcp-client
灏瀚星空32 分钟前
Python在AI虚拟教学视频开发中的核心技术与前景展望
人工智能·python·音视频
一个天蝎座 白勺 程序猿33 分钟前
Python爬虫(4)CSS核心机制:全面解析选择器分类、用法与实战应用
css·爬虫·python
进来有惊喜44 分钟前
深度学习:迁移学习
python·深度学习
@正在学习驰骋的小马1 小时前
九、小白如何用Pygame制作一款跑酷类游戏(添加前进小动物作为动态障碍物)
python·游戏·pygame
BXCQ_xuan1 小时前
Django API 响应格式:一个新手踩坑记
python·django·状态模式
Python×CATIA工业智造2 小时前
基于CATIA参数化管道建模的自动化插件开发实践——NX建模之管道命令的参考与移植
python·pycharm·catia二次开发