stable-diffusion接入chatGpt报错处理

97次阅读

问题 1、module 'openai' has no attribute 'ChatCompletion'

stable-diffusion接入chatGpt报错处理插图

原因:openai 库的版本较老或者较新!

处理方式:找到调用 openai 的 python 代码,修改对应的调用方法名,

文件位置和文件名:stable-diffusion-webui\extensions\stable-diffusion-webui-chatgpt-utilities\scripts\chatgpt_utils.py

找到最后的调用方法,将代码中的 ChatCompletion 更改为 Completion

completion = openai.ChatCompletion .create(model="gpt-3.5-turbo", messages=messages, temperature=temperature)

改为

completion = openai.Completion.create(model="gpt-3.5-turbo", messages=messages, temperature=temperature)

重启 stable-diffusion 服务,尝试输入 prompt,结果继续报错 = =!

重新阅读了下,发现 gpt-3.5 模型,必须使用 0.27 版本以上的 openai。于是删除了本地旧版本的 openai 库,更新到了最新的 0.27.2。再重启了电脑(是的,不知道为啥只重启 webUi 没有效果),就能正常使用 prompt 了。

问题 2、Request timed out

处理方式:使用魔法 = =

stable-diffusion接入chatGpt报错处理插图1

原文链接:https://www.bilibili.com/read/cv22691828/

正文完
 
不知道
版权声明:本站原创文章,由 不知道 2023-08-07发表,共计708字。
转载说明:声明:本站内容均来自互联网,归原创作者所有,如有侵权必删除。 本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。