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
相关推荐
ㄟ留恋さ寂寞4 分钟前
Golang怎么限制请求Body大小_Golang如何防止客户端发送过大的请求体【避坑】
jvm·数据库·python
Chase_______8 分钟前
【Java杂项】0.1 + 0.2 为什么不等于 0.3?IEEE 754 与 BigDecimal 精度避坑
java·开发语言·python
风之所往_8 分钟前
Python 3.2 新特性全面总结
python
jaccen10 分钟前
为了写AI知识产权,我造了一个AI知产Agent Skill(无广告)
ai
geovindu10 分钟前
python: Monitor Pattern
开发语言·python·设计模式·监控模式
Naisu Xu12 分钟前
Mac上安装Homebrew、Git、Python等环境记录
git·python·macos·终端·brew
老纪15 分钟前
CSS Flex布局中如何实现导航栏与Logo的左右分布_利用justify-content- space-between
jvm·数据库·python
哥布林学者18 分钟前
深度学习进阶(二十三)偏置型 RPE
机器学习·ai
小郑加油21 分钟前
python学习Day14:实际应用——pandas的筛选与保存
python·学习·pandas
郭龙_Jack26 分钟前
Java 17 到 Java 25:LTS 升级的全面收益与迁移指南
java·开发语言·python