Java开发

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

2025-02-14 36 0

简介 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 的路径。例如:
    upfile

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

upfile

upfile

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

点赞 0

我的名片

网名:梦宇信息技术

职业:软件开发、Mes系统工程师

现居:福建省-福州市

QQ:703159

站点信息

  • 联系QQ:703159
  • 文章统计97篇文章
  • 标签总数6
  • 加我微信:扫码,加我微信