Stable Diffusion / huggingface 相干设置标题汇总

[复制链接]
发表于 2026-2-27 03:52:58 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
笔者在设置SD的时间遭遇了许多bug,特此汇总如下:
1 OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'.

报错

完备报错如下:
  1. 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.
复制代码
这是由于 huggingface 网站上不去导致的。
办理方法

方法1——手动下载

在本地新建文件夹 openai/clip-vit-large-patch14,将官网对应位置下面的文件全部下下来放进去即可123。
官方网址:https://huggingface.co/openai/clip-vit-large-patch14/tree/main
国内镜像:

  • https://www.modelscope.cn/models/AI-ModelScope/clip-vit-large-patch14/files
  • https://hf-mirror.com/openai/clip-vit-large-patch14/tree/main
大概百度网盘:
链接: https://pan.baidu.com/s/1pmOuyaRnLcc8ee-8_jtb1g?pwd=ukyi 提取码: ukyi 复制这段内容后打开百度网盘手机App,利用更方便哦
–来自百度网盘超等会员v9的分享
方法2——自动下载

在本地新建文件夹 openai 之后,在该路径下利用 git clone https://www.modelscope.cn/AI-ModelScope/clip-vit-large-patch14.git 自动下载4,但是注意到此时会报错 safetensors_rust.SafetensorError,具体如下:
  1.   File "/home/xxx/.conda/envs/xxx/lib/python3.10/site-packages/transformers/modeling_utils.py", line 3503, in from_pretrained
  2.     with safe_open(resolved_archive_file, framework="pt") as f:
  3. safetensors_rust.SafetensorError: Error while deserializing header: HeaderTooLarge
复制代码
缘故原由是几个大一点文件没有完备下载,必要重新手动下载并覆盖。
其他方法(待研究)


  • 在transformers/utils/hub.py的源码中,将’_default_endpoint’的值改为国内镜像https://hf-mirror.com即可5 (实测未乐成)
  • 安装依靠包 pip install -U huggingface_hub,然后修改HF_ENDPOINT 情况变量6 (未验证)
    1. export HF_ENDPOINT=https://hf-mirror.com  # Linux
    2. set HF_ENDPOINT=https://hf-mirror.com  # Windows
    3. huggingface-cli download --resume-download InstantX/InstantID --local-dir checkpoints
    复制代码
2 huggingface_hub.utils._errors.LocalEntryNotFoundError:

报错

出现如下报错:
  1. File "/home/xxx/.conda/envs/xxx/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1371, in hf_hub_download
  2.     raise LocalEntryNotFoundError(
  3. huggingface_hub.utils._errors.LocalEntryNotFoundError: An error happened while trying to locate the file on the Hub and we cannot find the requested files in the local cache. Please check your connection and try again or make sure your Internet connection is on.
复制代码
还是网络的标题。
办理方法

参考博文:【秒办理!!huggingface_hub.utils._errors.LocalEntryNotFoundError】,将 huggingface 网站 改成其镜像站:


  • 方法1:在代码开头设置情况变量
    1. import os
    2. os.environ["HF_ENDPOINT"] = "https://hf-mirror.com"
    复制代码
  • 方法2:在下令行中设置情况变量 HF_ENDPOINT=https://hf-mirror.com python xxx.py

   

  • OSError: Can‘t load tokenizer for ‘openai/clip-vit-large-patch14‘. ↩︎
  • Stable-diffusion安装时Can‘t load tokenizer for ‘openai/clip-vit-large-patch14‘标题办理 ↩︎
  • 【debug】OSError: Can‘t load tokenizer for ‘XXX‘. If you were trying to load it from ‘https://huggingf ↩︎
  • StableDiffusion搭建[报错] OSError openai/clip-vit-large-patch14 ↩︎
  • 办理diffusion摆设时,无法从‘huggingface.co‘下载‘openai/clip-vit-large-patch14‘导致的报错 ↩︎
  • Huggingface 镜像站利用方法! ↩︎
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表