Stable diffusion 本地部署加载模型报 openai/clip-vit-large-patch14 错误的解决方法

1. 报错描述

本地部署好 Stable diffusion 以后,点击加载模型时报 openai/clip-vit-large-patch14 错误,具体报错信息如下:

raise EnvironmentError(

OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer. Failed to create model quickly; will retry using slow method.

loading stable diffusion model: OSError

2. 报错原因

连不上huggingface,无法下载模型。

3. 解决方法

1)手动下载 clip-vit-large-patch14 相关文件,可以直接在网盘下载,也可以去官网下载。网盘下载地址为:https://pan.quark.cn/s/220913e4ac3a

2)在本地磁盘中创建 openai 目录;

3)将下载的文件解压缩放入 openai 目录中;

4)打开本地安装目录中的 tokenization_utils_base.py 文件,文件路径为:\stable-diffusion-webui\venv\Lib\site-packages\transformers 

5)在文件中搜索 pretrained_model_name_or_path =,修改等号后面的路径为第 3 步中 clip-vit-large-patch14 的路径。例如:

6)打开 \stable-diffusion-webui\repositories\stable-diffusion-stability-ai\ldm\modules\encoders 路径下的 modules.py 文件,修改路径,具体如下(有两处):

第 1 处:

第 2 处:

7. 重启 SD ,重启后再次加载模型,已经可以加载出来了:

#Stable diffusion

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值