Stable diffusion加载safetensors 模型出现Exception: device privateuseone:0 is invalid

这篇具有很好参考价值的文章主要介绍了Stable diffusion加载safetensors 模型出现Exception: device privateuseone:0 is invalid。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、问题

      博主用CPU硬解 Stable diffusion,sd-v1-4.ckpt能跑,但换成v1-5-pruned-emaonly.safetensors等最新格式的模型就出现Exception: device privateuseone:0 is invalid错误。

(automatic) C:\Users\tangtang1600>python "F:\ai\stable_diffusion\stable-diffusion-webui-directml\webui.py" --precision full --no-half  --lowram --use-cpu all 
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
No module 'xformers'. Proceeding without it.
Error setting up CodeFormer:
Traceback (most recent call last):
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\codeformer_model.py", line 38, in setup_model
    from facelib.utils.face_restoration_helper import FaceRestoreHelper
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\repositories\CodeFormer\facelib\utils\face_restoration_helper.py", line 7, in <module>
    from facelib.detection import init_detection_model
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\repositories\CodeFormer\facelib\detection\__init__.py", line 10, in <module>
    from .retinaface.retinaface import RetinaFace
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\repositories\CodeFormer\facelib\detection\retinaface\retinaface.py", line 14, in <module>
    from basicsr.utils.misc import get_device
ImportError: cannot import name 'get_device' from 'basicsr.utils.misc' (D:\Users\tangtang1600\Anaconda3\envs\lib\site-packages\basicsr\utils\misc.py)

Error loading script: bilingual_localization_helper.py
Traceback (most recent call last):
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\extensions\sd-webui-bilingual-localization\scripts\bilingual_localization_helper.py", line 13, in <module>
    I18N_DIRS = { k: str(Path(v).relative_to(ROOT_DIR).as_posix()) for k, v in localization.localizations.items() }
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\extensions\sd-webui-bilingual-localization\scripts\bilingual_localization_helper.py", line 13, in <dictcomp>
    I18N_DIRS = { k: str(Path(v).relative_to(ROOT_DIR).as_posix()) for k, v in localization.localizations.items() }
  File "D:\Users\tangtang1600\Anaconda3\envs\automatic\lib\pathlib.py", line 818, in relative_to
    raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: 'F:\\ai\\stable_diffusion\\stable-diffusion-webui-directml\\extensions\\sd-webui-bilingual-localization\\localizations\\zh_CN.json' is not in the subpath of 'C:\\Users\\tangtang1600' OR one path is relative and the other is absolute.

Checkpoint sd-v1-4.ckpt [fe4efff1e1] not found; loading fallback other\chilloutmix_NiPrunedFp16Fix.safetensors [f78ded1eda]
Loading weights [f78ded1eda] from F:\ai\stable_diffusion\stable-diffusion-webui-directml\models\Stable-diffusion\other\chilloutmix_NiPrunedFp16Fix.safetensors
loading stable diffusion model: Exception
Traceback (most recent call last):
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\webui.py", line 135, in initialize
    modules.sd_models.load_model()
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\sd_models.py", line 383, in load_model
    state_dict = get_checkpoint_state_dict(checkpoint_info, timer)
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\sd_models.py", line 238, in get_checkpoint_state_dict
    res = read_state_dict(checkpoint_info.filename)
  File "F:\ai\stable_diffusion\stable-diffusion-webui-directml\modules\sd_models.py", line 217, in read_state_dict
    pl_sd = safetensors.torch.load_file(checkpoint_file, device=device)
  File "D:\Users\tangtang1600\Anaconda3\envs\automatic\Lib\site-packages\safetensors\torch.py", line 98, in load_file
    with safe_open(filename, framework="pt", device=device) as f:
Exception: device privateuseone:0 is invalid

 二、解决

       原因是在启动参数中使用了底运存命令--lowram,这个参数似乎会让device指向gpu,电脑是amd的集显,所以出现找不到GPU的情况。文章来源地址https://www.toymoban.com/news/detail-505608.html

python "F:\ai\stable_diffusion\stable-diffusion-webui-directml\webui.py" --precision full --no-half   --use-cpu all

到了这里,关于Stable diffusion加载safetensors 模型出现Exception: device privateuseone:0 is invalid的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

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

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

相关文章

  • 请问Stable diffusion出现这个错误怎么解决

    Loading weights [495901d34f] from D:aimodelsStable-diffusionelegantHanfuRuqun_v10.safetensors loading stable diffusion model: RuntimeError Traceback (most recent call last):   File \\\"D:aiwebui.py\\\", line 195, in initialize     modules.sd_models.load_model()   File \\\"D:aimodulessd_models.py\\\", line 424, in load_model     state_dict = get_checkpoint

    2024年02月09日
    浏览(23)
  • 运行stable-diffusion出现的问题(1)

    Checkout your internet connection or see how to run the library in offline mode at ‘https://huggingface.co/docs/transformers/installation#offline-mode’. 原因:网络不好,无法进入huggingface下载模型 解决:下载后离线,步骤如下 1.进入网址:https://huggingface.co/docs/transformers/installation#offline-mode 2.点击红框所示

    2024年04月23日
    浏览(25)
  • stable-diffusion-webui 加载失败 卡在这里求助

    C:UsersClackDesktopNeonMindAI_894978NeonMind AIstable-diffusion-webuicall webui.bat venv \\\"C:UsersClackDesktopNeonMindAI_894978NeonMind AIstable-diffusion-webuivenvScriptsPython.exe\\\" Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] Version: v1.3.2 Commit hash: baf6946e06249c5af9851c60171692c44ef633e0 Inst

    2024年02月04日
    浏览(34)
  • Stable Diffusion动态加载Lora过程中的实验、原理与说明

    使用 StableDiffusionXLPipeline.from_pretrained() 方法SDXL半精度加载显存占用约7G左右。 使用 load_lora_weights() 加载了5个Lora模型后显存提升到8G,平均每个Lora的大小在200M左右。 使用 unload_lora_weights() 后显存没有发生变化,还是8G,说明该方法不会清空已经加载到显存的Lora模型,但 这时

    2024年02月04日
    浏览(35)
  • 安装stable-diffusion出现问题,求大佬看一下怎么解决

    Installing requirements for CodeFormer Traceback (most recent call last):   File \\\"/Users/mac/stable-diffusion-webui/launch.py\\\", line 48, in module     main()   File \\\"/Users/mac/stable-diffusion-webui/launch.py\\\", line 39, in main     prepare_environment()   File \\\"/Users/mac/stable-diffusion-webui/modules/launch_utils.py\\\", line 389, in prepare_environme

    2024年02月08日
    浏览(58)
  • MacOS13+系统运行Stable Diffusion出现的问题及解决方法汇总

    目录      先睹为快   开发环境 问题一,点“生成”按钮就退出程序 问题二、生成的图片是马赛克 第一步:解决环境问题 第二步:更新指定的torch版本包 步骤一:更新指定的torch包: 步骤二:重新安装pytorch-nightly版本的包: 问题三:正确的启动webui.sh       硬件:基于

    2024年02月16日
    浏览(35)
  • 【Stable Diffusion】Stable Diffusion各类模型描述

    Stable Diffusion 是一种新型的生成模型,它可以用于生成高质量的图像、文本和音频等多种形式的数据。目前已经出现了许多基于 Stable Diffusion 模型的变种,下面简单介绍其中几种比较流行的模型: 模型链接:https://huggingface.co/stabilityai DDIM 是 Stable Diffusion 的第一个应用,它采用

    2024年02月16日
    浏览(34)
  • 记录安装stable diffusion webui时,出现的gfpgan安装卡住的问题

    参考链接:(145条消息) 使用stable diffusion webui时,安装gfpgan失败的解决方案(windows下的操作)_新时代原始人的博客-CSDN博客  

    2024年02月16日
    浏览(29)
  • stable diffusion webui安装和运行中出现的bug及解决方式

    webui的运行实在名为 venv 的虚拟环境中进行的,所以通过 launch.py 运行的时候,一定要先通过 source venv/bin/activate 激活虚拟环境 venv 。 1、报错:Couldn’t install gfpgan 原因: 代理的问题,应该是安装的时候挂了代理,所以没办法直接安装。 解决: 感觉停用代理应该可以,但是我

    2024年02月11日
    浏览(23)
  • Stable Diffusion教程之使用Stable Diffusion改进图像分割模型

    作为 ML 工程师,Edge Analytics和Infinity AI的团队非常熟悉与为计算机视觉应用程序获取高质量标记图像相关的挑战。随着生成图像模型的发布,例如来自Stability AI的开源Stable Diffusion,我们探索了使用生成模型来提高特定语义分割模型的性能。 Stable Diffusion是 Stability AI 在今年早些

    2024年02月10日
    浏览(29)

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

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

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

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

二维码1

领取红包

二维码2

领红包