MAC缓解WebUI提示词反推

当前环境信息:

在mac上安装好stable diffusion后,能做图片生成了之后,遇到一些图片需要做提示词反推,这个时候需要下载一个插件,参考:

https://gitcode.net/ranting8323/stable-diffusion-webui-wd14-tagger

安装完成后,可以在这个位置使用,这里是给了一个图片来反推提示词。

使用过程中遇到了一些错误记录如下:

Loading wd14-vit-v2-git model file from SmilingWolf/wd-v1-4-vit-tagger-v2

'(MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /SmilingWolf/wd-v1-4-vit-tagger-v2/resolve/main/model.onnx (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x1622bcc40>, 'Connection to huggingface.co timed out. (connect timeout=10)'))"), '(Request ID: 008f823b-7a19-4899-bbed-3bacbe0bfee2)')' thrown while requesting HEAD https://huggingface.co/SmilingWolf/wd-v1-4-vit-tagger-v2/resolve/main/model.onnx

这个错误是访问huggingface被拦截,需要科学上网。

还有一个错误,安装onnxruntime失败:

RuntimeError: Couldn't install onnxruntime.

Command: "/Users/xxxx/aigc/stable-diffusion-webui/venv/bin/python3" -m pip install onnxruntime-gpu --prefer-binary

Error code: 1

stdout: Looking in indexes: https://mirrors.aliyun.com/pypi/simple/

我这台电脑的解决方案是,修改webui的代码,如下:

文件名:interrogator.py

复制代码
    def load(self) -> None:
        model_path, tags_path = self.download()

        # only one of these packages should be installed at a time in any one environment
        # https://onnxruntime.ai/docs/get-started/with-python.html#install-onnx-runtime
        # TODO: remove old package when the environment changes?
        from launch import is_installed, run_pip
        if not is_installed('onnxruntime'):
            package = os.environ.get(
                'ONNXRUNTIME_PACKAGE',
#                 'onnxruntime-gpu'
                'onnxruntime'
            )

修改代码后重新启动 webui,就能正常的反推提示词了;

将反推的提示词重新生成图片,效果如下:

相关推荐
8***84829 小时前
macOs安装docker且在docker上部署nginx+php
nginx·macos·docker
Aurora-silas9 小时前
Mac 本地运行 Hugging Face 大模型完全指南:PyTorch (MPS) vs Apple MLX
人工智能·pytorch·macos
8***848210 小时前
macOS安装Redis
数据库·redis·macos
小镇学者11 小时前
【PHP】macos 系统 git pull 时 报错File name too long问题
git·macos·php
m0_4885732321 小时前
简易编译器C++
macos·objective-c·cocoa
00后程序员张1 天前
iOS App 如何上架,从准备到发布的完整流程方法论
android·macos·ios·小程序·uni-app·cocoa·iphone
Ujimatsu1 天前
AMD锐龙H 255 + 780M核显 虚拟机安装macOS 15 Sequoia(2025.11)(可登录Apple ID)
macos·vmware·虚拟机·amd·sequoia·h 255
benxin12341 天前
macOS 上使用 Homebrew 安装和配置 PostgreSQL 的详细步骤
macos·postgresql·策略模式
他们都不看好你,偏偏你最不争气1 天前
【iOS】TableView的优化
macos·ios·objective-c·cocoa
雪花凌落的盛夏1 天前
电脑安装黑苹果教程,MacOS教程(未验证版)
macos·电脑·mac