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,就能正常的反推提示词了;

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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值