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
相关推荐
阿里-于怀3 分钟前
Dify 官方上架 Higress 插件,轻松接入 AI 网关访问模型服务
网络·人工智能·ai·dify·higress
Faker66363aaa8 分钟前
Faster-RCNN改进一基于R50-FPG的人脸与垃圾物体检测识别_crop640-50e_COCO
python
kaizq11 分钟前
Windows下基于Python构造Dify可视应用环境[非Dock]
windows·python·dify·大语言模型llm·人工智能ai·智能体agent
kyle~1 小时前
Python---Flask 轻量级Web框架
开发语言·python·flask
xinhuanjieyi1 小时前
python获取股票分红
chrome·python·elasticsearch
喵手2 小时前
Python爬虫实战:小红书热门笔记爬虫实战 - 搜索关键词驱动的内容采集指南!
爬虫·python·爬虫实战·零基础python爬虫教学·小红书热门笔记·搜索关键词·采集小红书热门笔记数据
阿杰学AI3 小时前
AI核心知识105—大语言模型之 Multi-Agent Architect(简洁且通俗易懂版)
人工智能·ai·语言模型·自然语言处理·agent·智能体·多智能体架构师
nita张3 小时前
战略定位实战:案例分享与经验总结
大数据·人工智能·python
MadPrinter3 小时前
Python 异步爬虫实战:FindQC 商品数据爬取系统完整教程
爬虫·python·算法·自动化
清水白石0083 小时前
Python 函数式编程实战:从零构建函数组合系统
开发语言·python