Stable Diffusion 运行报错 TypeError: unsupported operand type(s) for |: ‘type‘ and ‘type‘

Stable Diffusion 运行报错 TypeError: unsupported operand type(s) for |: ‘type‘ and ‘type‘

    正在检查是否收录...

MacOS 上使用 python 3.8 版本安装运行 Stable Diffusion 时,有如下报错

Error loading script: lora_script.py Traceback (most recent call last): File "/Users/admin/diy/stable-diffusion-webui/modules/scripts.py", line 256, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "/Users/admin/diy/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "<frozen importlib._bootstrap_external>", line 850, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "/Users/admin/diy/stable-diffusion-webui/extensions-builtin/Lora/scripts/lora_script.py", line 4, in <module> import lora File "/Users/admin/diy/stable-diffusion-webui/extensions-builtin/Lora/lora.py", line 238, in <module> def lora_apply_weights(self: torch.nn.Conv2d | torch.nn.Linear | torch.nn.MultiheadAttention): TypeError: unsupported operand type(s) for |: 'type' and 'type'

这是因为之前老版本的 python 3.8 的兼容问题。

解决办法:

1. 方法一:升级 python 版本至 3.9+

2. 方法二:在 `lora.py` 文件中增加代码:from __future__ import annotations:

from __future__ import annotations import glob import os import re import torch from modules import shared, devices, sd_models, errors 

Problem solved~

scriptdiffusiondiywebuiwebcodepythonrapstable diffusionmacosmacappshareurl
  • 本文作者:李琛
  • 本文链接: https://wapzz.net/post-1312.html
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
本站部分内容来源于网络转载,仅供学习交流使用。如涉及版权问题,请及时联系我们,我们将第一时间处理。
文章很赞!支持一下吧 还没有人为TA充电
为TA充电
还没有人为TA充电
0
  • 支付宝打赏
    支付宝扫一扫
  • 微信打赏
    微信扫一扫
感谢支持
文章很赞!支持一下吧
关于作者
2.3W+
5
0
1
WAP站长官方

史上最强小爱!小爱同学大模型文章摘要来了:英文文章秒看懂

上一篇

Stable Diffusion Web UI的原理与使用

下一篇
  • 复制图片
按住ctrl可打开默认菜单