智能

Stable Diffusion 系列教程(问题篇) —— 运行问题记录

波比AI · 5月2日 · 2025年本文共3007个字 · 预计阅读11分钟2次已读

后续发现出现如下这些问题的原因是,在debian12安装过路中,选择需要安装的软件时,只勾选了 ssh server,把 stardant system unity 给取消了,导致服务器时间没有同步,也就是时间不对造成了如下问题,现在记录下。

  • warnings.warn(f”Importing from {name} is deprecated, please import via timm.layers”, FutureWarning)

Stable Diffusion 系列教程(问题篇) —— 运行问题记录

解决:

import warnings

warnings.filterwarnings("ignore", category=FutureWarning)

warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
  • creating model quickly: SSLError
    解决:
  • 环境缺少证书,尝试安装或更新
sudo apt update
sudo apt install ca-certificates
  • 使用代理 如果你在防火墙或需要代理的环境中,确保设置了正确的代理(我就是在安装过程中,使用了代理)
export http_proxy="http://your_proxy:port"
export https_proxy="http://your_proxy:port"

# 可在代码查看是否使用了代理
cat /etc/apt/apt.conf
  • creating model quickly: OSError : Can’t load tokenizer for ‘openai/clip-vit-large-patch14’
    解决:
  • 安装 transformers: 确保你已安装最新版本的 transformers 库,可以使用以下命令进行更新
pip install --upgrade transformers
  • 检查依赖库: 某些模型可能依赖于特定版本的库,确保其他相关库(如 torchtokenizers 等)也是最新的
pip install --upgrade torch tokenizers
  • requests.exceptions.SSLError: (MaxRetryError(‘HTTPSConnectionPool(host=\’huggingface.co\’, port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/resolve/main/vocab.json (Caused by SSLError(SSLCertVerificationError(1, “[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for \’huggingface.co\’. (_ssl.c:1007)”)))’), ‘(Request ID: f3169335-ee3b-49f9-b7bc-fc0d9cb725fb)’)
    解决:
  • 主要原因是时间设置不对和根证书缺失导致
sudo timedatectl set-ntp true
sudo apt update
sudo apt install --reinstall ca-certificates
  • Failed to enable unit: Refusing to operate on alias name or linked unit file: ntp.service
    解决:
  • 时间设置问题
sudo systemctl enable systemd-timesyncd
sudo systemctl start systemd-timesyncd

sudo systemctl status systemd-timesyncd
# 确认时间同步
timedatectl
  • 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.
    解决:
  • 清理本地缓存
rm -rf ~/.cache/hugginbobyaigfacelaoxiongb2c/transformers/openai/clip-vit-large-patch14
  • 手动下载 Tokenizer
    如果网络不稳定,可以尝试手动下载 Tokenizer:
  1. 访问 Hugging Face 的模型页面,下载相关文件。
  2. 将这些文件放到本地目录中,例如 /path/to/local/clip-vit-large-patch14
from transformers import CLIPTokenizer

tokenizer = CLIPTokenizer.from_pretrained("/path/to/local/clip-vit-large-patch14")
  • 更新 transformers库
pip install --upgrade transformers
  • 检查依赖库
pip install --upgrade torch tokenizers
  • 确保SSL证书
sudo apt update
sudo apt install --reinstall ca-certificates

openssl s_client -connect huggingface.co:443

pip install --upgrade certifi

sudo systemctl restart systemd-timesyncd  # 如果使用 NTP
sudo systemctl restart ntp  # 如果使用 ntp 服务

  • requests.exceptions.SSLError: (MaxRetryError(‘HTTPSConnectionPool(host=\’huggingface.co\’, port=443): Max retries exceeded with url: /openai/clip-vit-large-patch14/laoxiongb2cresolve/main/added_tokens.json (Caused by SSLError(SSLCertVerificationError(1, “[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for \’huggingface.co\’. (_ssl.c:1007)”)))’), ‘(Request ID: f5791be6-2164-40af-a875-c9ff6c53e49c)’)
    解决:
    我是dns问题
sudo nano /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

总结

参考

  • [ 1 ]
  • [ 2 ]
  • [ 3 ]
  • [ 4 ]

其他

[Total: 0 Average: 0]
0 条回应

必须 注册 为本站用户, 登录 后才可以发表评论!