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~文章来源地址https://www.toymoban.com/news/detail-516561.html

到了这里,关于Stable Diffusion 运行报错 TypeError: unsupported operand type(s) for |: ‘type‘ and ‘type‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Stable Diffusion图生图报错TypeError: argument of type ‘NoneType‘ is not iterable如何解决?

    之前运行都没事,突然莫名开始报错,试了很多方法找不到原因,求大神指路~    

    2024年02月04日
    浏览(36)
  • Stable Diffusion运行Deforum报错问题解决

    运行Deforum时,需要在线下载dpt_large-midas-2f21e586.pt 可能会遇到报错信息Check your schedules/ init values please. Also make sure you don\\\'t have a backwards slash in any of your PATHs - use / instead of . 根据log提示,修改C:sd-webui-akisd-webui-aki-v4.1extensionsdeforum-for-automatic1111-webuiscriptsdeforum_helpers目录下的

    2024年02月12日
    浏览(27)
  • Postman报错 “status“: 415, “error“: “Unsupported Media Type“

    使用Postman 报错415 不支持报文格式,明显我们上送的不是Json格式,修改报文格式为Json即可 { “timestamp”: “2023-03-03T13:49:40.055+00:00”, “status”: 415, “error”: “Unsupported Media Type”, “message”: “”, “path”: “/user/save” } 在postman位置可以选择报文的格式,修改即可

    2024年02月12日
    浏览(100)
  • Stable Diffusion web UI 运行报错 Error while deserializing header: MetadataIncompleteBuffer

    1、改成手动下载文件,注意要想删除 D:codeaisd.webuiwebuimodelsStable-diffusionv1-5-pruned-emaonly.safetensors 文件,每个人路径不一样,看上面的错误日志是上面地址。 2、删除后手动下载,并移动到 D:codeaisd.webuiwebuimodelsStable-diffusion 路径下,同样要根据日志改成你的地址。 3、

    2024年02月13日
    浏览(44)
  • Python报错:TypeError: Cannot interpret ‘1‘ as a data type

    在使用np.zeros()创建新数组的时候,我传入的参数是如下代码: 运行报错: 报错原因是我们给zeros()函数传入的参数发生问题: 我传入的参数是(layers_dims[l],1),这是不对的,因为zeros只需要传入一个参数,就是shape。所以我们应该更改为: 把(layers_dims[l],1)用括号括起来

    2024年02月13日
    浏览(31)
  • python 报错TypeError: object of type ‘NoneType‘ has no len()处理

    在编程过程中,我们经常会遇到各种异常情况。其中之一就是TypeError异常,它表示操作或函数应用于了错误的数据类型。在本文中,我们将重点讨论TypeError异常中的一种常见情况:当对象为NoneType时,调用len()函数会引发TypeError异常。 在Python中,NoneType是一个特殊的数据类型,

    2024年02月06日
    浏览(33)
  • npm 安装自定义组件的时候报错 Unsupported URL Type "workspace:": workspace:^如何解决

    这个错误信息提示你在 npm 命令中使用了一个不支持的 URL 类型 \\\"workspace:\\\". 在 npm 中,\\\"workspace:\\\" 前缀用于表示当前的工作空间中的某个软件包。 通常,在使用 npm 命令安装软件包时,你需要提供软件包的名称或者软件包的发布地址(例如,npm install express 或者 npm install https://gi

    2024年02月12日
    浏览(33)
  • 解决报错TypeError: Object of type int32 is not JSON serializable

    当我们尝试将 numpy int32 对象转换为 JSON 字符串时,会出现 Python“TypeError: Object of type int32 is not JSON serializable”。 要解决该错误,请先将 numpy int 转换为 Python 整数,然后再将其转换为 JSON,例如 下面是错误如何发生的示例。 我们尝试将 numpy int32 对象传递给 json.dumps() 方法,但

    2024年02月06日
    浏览(45)
  • 解决npm install报错npm ERR Unsupported URL Type “npm:“: npm:vue-loader@^16.1.0 问题

    node版本以及npm版本太旧会造成这个问题 1.下载安装nvm 网址:Releases · coreybutler/nvm-windows · GitHub 2.安装 后使用nvm命令安装切换node版本 安装node版本: 等待安装完成,使用命令切换版本 3.如遇到切换完版本idea提示无法识别npm命令,重启idea即可

    2024年04月15日
    浏览(72)
  • 解决 TypeError: save_pil_to_file(stable diffusion使用sadtalker 插件)

    在使用Stable Diffusion时,您可能会遇到使用SadTalker插件时出现的报错问题。其中,常见的报错是TypeError: save_pil_to_file() got an unexpected keyword argument ‘format’ 报错如下: 1、在Stable Diffusion安装目录下,找到 requirements_versions.txt文件 2、替换 gradio 的版本为 gradio==3.31.0 3、当启动Sta

    2024年02月13日
    浏览(29)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包