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
相关推荐
happylifetree16 分钟前
Python18(补充):练习
python
weixin_4166679641 分钟前
银河麒麟V10看门狗试验-1
网络·chrome·python
古城小栈1 小时前
Pydantic 从入门到实践全讲解
python
happylifetree1 小时前
Python18:核心语法-数据存储与运算-运算符-算术运算符
python
打工仔折腾 AI1 小时前
从Attention到BERT:双向预训练语言模型到底解决了什么问题
人工智能·后端·python·深度学习·语言模型·bert
迅猛龙办公室2 小时前
实现第一个python程序(HelloWorld)
开发语言·python
最强小杰2 小时前
gpt一直报 怎么办?不是 超限——R桶和桶独立触发,排查方法和 完全不同
ai
拉格朗日(Lagrange)2 小时前
【第2 章】WorkBuddy 从入门到高手
开发语言·python
老歌老听老掉牙3 小时前
斜抛运动问题分析:给定最大高度与墙面位置的轨迹与时间求解
python·斜抛运动
言乐63 小时前
Python自动去除水印
开发语言·python·django·virtualenv·pygame