m2安装stable-diffusion报错及解决方案

这篇具有很好参考价值的文章主要介绍了m2安装stable-diffusion报错及解决方案。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

背景:自己的电脑是macbookpro m2,之前装很多软件都遇到各种问题,不出意外,装这个stable-diffusion一样遇到各种问题,现在总结一下安装过程中遇到的问题。

报错一:
Launching Web UI with arguments: --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate
no module 'xformers'. Processing without...
No SDP backend available, likely because you are running in pytorch versions < 2.0. In fact, you are using PyTorch 1.12.1. You might want to consider upgrading.
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
Style database not found: /Users/wuzhanxi/stable-diffusion-webui/styles.csv
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
==============================================================================
You are running torch 1.12.1.
The program is tested to work with torch 2.0.0.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.

Use --skip-version-check commandline argument to disable this check.
==============================================================================
Downloading: "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.safetensors" to /Users/wuzhanxi/stable-diffusion-webui/models/Stable-diffusion/v1-5-pruned-emaonly.safetensors

WARNING:modules.mac_specific:MPS garbage collection failed
Traceback (most recent call last):
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/mac_specific.py", line 38, in torch_mps_gc
    from torch.mps import empty_cache
ModuleNotFoundError: No module named 'torch.mps'

原因:torch 的版本不对
解决方案:在安装目录stable-diffusion-webui 下,编辑webui-macos-env.sh 文件
我的原来的配置文件如下;

export install_dir="$HOME"
export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate"
export TORCH_COMMAND="pip install torch==1.12.1 torchvision==0.13.1"
export K_DIFFUSION_REPO="https://github.com/brkirch/k-diffusion.git"
export K_DIFFUSION_COMMIT_HASH="51c9778f269cedb55a4d88c79c0246d35bdadb71"
export PYTORCH_ENABLE_MPS_FALLBACK=1

修改好的配置文件如下;1.在COMMANDLINE_ARGS 参数的后面添加了–reinstall-torch
2.export TORCH_COMMAND=“pip install torch2.0.1 torchvision0.15.2”,将torch的版本修改成2.0的

export install_dir="$HOME"
export COMMANDLINE_ARGS="--skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate --reinstall-torch"
export TORCH_COMMAND="pip install torch==2.0.1 torchvision==0.15.2"
#export TORCH_COMMAND="pip install torch==1.12.1 torchvision==0.13.1"
export K_DIFFUSION_REPO="https://github.com/brkirch/k-diffusion.git"
export K_DIFFUSION_COMMIT_HASH="51c9778f269cedb55a4d88c79c0246d35bdadb71"
export PYTORCH_ENABLE_MPS_FALLBACK=1
报错二:
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 4.4s (prepare environment: 0.9s, import torch: 1.2s, import gradio: 0.4s, setup paths: 0.5s, other imports: 0.4s, load scripts: 0.3s, create ui: 0.2s, gradio launch: 0.3s).
Creating model from config: /Users/wuzhanxi/stable-diffusion-webui/configs/v1-inference.yaml
creating model quickly: OSError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/initialize.py", line 147, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/shared_items.py", line 128, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/sd_models.py", line 531, in get_sd_model
    load_model()
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/sd_models.py", line 634, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 563, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 630, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/encoders/modules.py", line 104, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "/opt/homebrew/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1809, in from_pretrained
    raise EnvironmentError(
OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

Failed to create model quickly; will retry using slow method.
loading stable diffusion model: OSError
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 973, in _bootstrap
    self._bootstrap_inner()
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/python@3.10/3.10.13_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/initialize.py", line 147, in load_model
    shared.sd_model  # noqa: B018
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/shared_items.py", line 128, in sd_model
    return modules.sd_models.model_data.get_sd_model()
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/sd_models.py", line 531, in get_sd_model
    load_model()
  File "/Users/wuzhanxi/stable-diffusion-webui/modules/sd_models.py", line 643, in load_model
    sd_model = instantiate_from_config(sd_config.model)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 563, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 630, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py", line 89, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/Users/wuzhanxi/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/modules/encoders/modules.py", line 104, in __init__
    self.tokenizer = CLIPTokenizer.from_pretrained(version)
  File "/opt/homebrew/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1809, in from_pretrained
    raise EnvironmentError(
OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.

原因:clip-vit-large-patch14 国内已经不能访问了
需要手动创建openai 目录并把 下载后解压的资源拖入到openai目录下面
安装sd的时候,本地你自己的目录下会同时生成一个sd的目录,我的是这样的
/Users/wuzhanxi/stable-diffusion-webui,在这个目录下手动创建一个openai目录
可以用的模型的代码:
链接: https://pan.baidu.com/s/1EBptJ2v9inq9A5LEYFfBMg 提取码: dh2b

报错三: Couldn’t install gfpgan.

在执行完 ./webui.sh 后报 “RuntimeError: Couldn’t install gfpgan.”

其实是因为没有下载下来 gfpgan。我们可以从报错信息中找到下载链接,如下图中横线部分。
然后 copy 这个链接到浏览器中进行下载,然后将下载好的 zip 文件加压,并将目录名改成 GFPGAN,然后拖到 stable-diffusion-webui 这个目录下就好了。

当再次执行 ./webui.sh 时,发现已经跨过下载 GFPGAN,继续下载其他依赖了。文章来源地址https://www.toymoban.com/news/detail-829464.html

到了这里,关于m2安装stable-diffusion报错及解决方案的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

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

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

相关文章

  • 安装stable-diffusion

    下载stable-diffusion源码 安装python 添加host 打开C:WindowsSystem32driversetchost 添加 修改launch.py 运行stable-diffusion-webui-1.2.1目录下webui-user.bat 安装时长较长,耐心等待 安装成功日志,主要是出现了地址“http://127.0.0.1:7860” 打开chrome,输入http://127.0.0.1:7860 python版本要为3.10.6版本,不

    2024年02月09日
    浏览(33)
  • stable-diffusion安装教程推荐

     总结: 安装的时候VPN最重要,安装完成 启动使用stable-diffusion关闭vpn 安装报错都是因为vpn问题,各种安装不了,报错基本上百度都有解决方法 安装看下面两基本上够了 Windows安装Stable Diffusion WebUI及问题解决记录_暂时先用这个名字的博客-CSDN博客 Stable-Diffusion和ControlNet插件安

    2024年02月06日
    浏览(45)
  • CentOS7上部署langchain-chatglm或stable-diffusion可能遇到的Bug的解决方案

    进入你的代码目录下 下载依赖 这里可能有的朋友会有问题会出现某些包下载不了,这里建议直接使用阿里源即可,在确定你的cuda版本之后(使用nvidia-smi确定cuda版本) 命令行执行 卸载掉刚才pip安装的版本!!!!因为此处安装的版本还缺少cuda的支持,确定卸载掉之后 执行 此处X为

    2024年02月16日
    浏览(30)
  • stable-diffusion安装controlnet插件

    1)extensions → install from URL → install 然后填入:https://github.com/Mikubill/sd-webui-controlnet 2)installed → apply and restart UI 下载controlnet模型(50G左右)到 E:stable-diffusion-webuiextensionssd-webui-controlnetmodels 目录下: lllyasviel/ControlNet at main 把所有8个模型放到models文件夹下 (待续)

    2024年02月12日
    浏览(36)
  • stable-diffusion安装和简单测试

    参考: https://github.com/CompVis/stable-diffusion 理解DALL·E 2, Stable Diffusion和 Midjourney的工作原理 Latent Diffusion Models论文解读 【生成式AI】淺談圖像生成模型 Diffusion Model 原理 【生成式AI】Stable Diffusion、DALL-E、Imagen 背後共同的套路 Stable Diffuson是潜在扩散模型(LDM)的文本转图像模型通

    2024年02月05日
    浏览(28)
  • 安装stable-diffusion时gfpgan安装失败

    错误代码如下: 下载gfpgan:  解压至:D:Lightdiffusionstable-diffusionvenvScripts,并打开命令行窗口  接着键入命令:d:\\\\Lightdiffusionstable-diffusionvenvScriptspython.exe -m pip install basicsr facexlib,安装gfpgan依赖  遇到这种情况,关闭代理,重新输入 键入命令:d:\\\\Lightdiffusionstable-diffus

    2024年02月11日
    浏览(31)
  • 安装stable-diffusion的错误 xformers 安装解决

    1、xformers是SD的加速模块,没有他可以继续运行,可以正常生成图片。只是xformers可以帮助提升图片的生成速度。 2、安装完SD后,启动出现xformers未安装的情况 No module \\\'xformers\\\'. Proceeding without it. 可以单独pip 安装xformers模块,命令: pip install xformer 3、注意这里的版本,如果安装

    2024年02月15日
    浏览(28)
  • 玩转stable-diffusion之xformers安装

    1、xformers是SD的加速模块,没有他可以继续运行,可以正常生成图片。只是xformers可以帮助提升图片的生成速度。 2、安装完SD后,启动出现xformers未安装的情况 可以单独pip 安装xformers模块,命令: 3、注意这里的版本,如果安装的版本不对,会卸载你的原安装正常的pytorch版本

    2024年02月06日
    浏览(34)
  • AMD安装Stable-Diffusion步骤笔记

    CPU AMD 5950X GPU AMD 6700XT Win 11且全程魔法上网 参考文档 下载并安装 Python 3.10.6 必须使用此版本 下载并安装 git 全程Next 确认安装路径,安装路径要求无中文,这里我以 C:UsersmikizDownloadsAI 为例 打开运行命令窗口: WIN + R 键入 cmd 打开cmd命令窗口 使用 cd 命令指定Stable-Diffusion安

    2024年02月09日
    浏览(42)
  • mac m1安装stable-diffusion

    查询是否安装 安装 使用brew下载python 下载完后后续会放入sd models目录下 下载链接选择safetensors 新建一个目录 mkdir stable-diffusion-webui clone 把下载的model放到stable-diffusion-webui/models/Stable-diffusion下 到当前sd目录下执行shell 执行shell遇到的问题: ** error 128 443;install gfpan 卡住 需要使

    2024年02月09日
    浏览(28)

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

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

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

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

二维码1

领取红包

二维码2

领红包