今天一位网友在用Python开发的AI绘画程序“Stable Diffusion”的时候,SD启动成功后,一生成图片就报错如下:
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
Commit hash: 22bcc7be428c94e9408f589966c2040187245d81
Installing requirements for Web UI
Launching Web UI with arguments: --theme dark --opt-sdp-attention --api --autolaunch
AUTOMATIC1111/stable-diffusion-webui packed by bilibili@秋葉aaaki
本整合包完全免费,严禁倒卖。若您付费获得本软件请立刻举报商家。
[AddNet] Updating model hashes...
[AddNet] Updating model hashes...
Loading weights [7f96a1a9ca] from C:\sd-webui-aki-v4\models\Stable-diffusion\anything-v5-PrtRE.safetensors
Creating model from config: C:\sd-webui-aki-v4\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\sd-webui-aki-v4\models\VAE\animevae.pt
Applying scaled dot product cross attention optimization.
Textual inversion embeddings loaded(1): EasyNegative
Model loaded in 4.7s (load weights from disk: 0.2s, create model: 0.5s, apply weights to model: 0.8s, apply half(): 0.9s, load VAE: 0.8s, move model to device: 1.1s, load textual inversion embeddings: 0.3s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 23.4s (import torch: 2.4s, import gradio: 1.5s, import ldm: 0.8s, other imports: 2.3s, setup codeformer: 0.1s, load scripts: 4.0s, load SD checkpoint: 4.9s, create ui: 6.8s, gradio launch: 0.5s).
rocBLAS error: Could not load C:\Users\Administrator\AppData\Local\Temp\593c345d-9b06-490e-acf2-b128717a6b13/TensileLibrary_lazy_gfx803.dat
rocBLAS error: Could not initialize Tensile library
--------
[程序异常退出,退出代码为 3 (0x00000003)]
原因:
这些错误信息来自 rocBLAS,这是 AMD 为其 GPU 提供的一套线性代数库。
以上重要的这两条错误信息可以翻译为:
1、rocBLAS error: Could not load C:\Users\Administrator\AppData\Local\Temp\593c345d-9b06-490e-acf2-b128717a6b13/TensileLibrary_lazy_gfx803.dat
rocBLAS 错误:无法加载 C:\Users\Administrator\AppData\Local\Temp\593c345d-9b06-490e-acf2-b128717a6b13/TensileLibrary_lazy_gfx803.dat
这条报错信息表示 rocBLAS 无法从指定的路径加载 TensileLibrary_lazy_gfx803.dat 文件。这可能是由于文件不存在、路径不正确或文件已损坏。
2、rocBLAS error: Could not initialize Tensile library
rocBLAS 错误:无法初始化 Tensile 库
这条报错信息表示 rocBLAS 无法初始化 Tensile 库。这可能是由于 Tensile 库未正确安装、缺失依赖项或与其他软件冲突。
解决方法
为了解决这些问题,你可以尝试以下步骤:
1、检查 C:\Users\Administrator\AppData\Local\Temp\593c345d-9b06-490e-acf2-b128717a6b13/TensileLibrary_lazy_gfx803.dat 文件是否存在。如果不存在,尝试重新安装 rocBLAS 或其相关组件。
2、确保你的系统满足 rocBLAS 和 Tensile 库的所有依赖项和兼容性要求。
3、查看系统日志或 rocBLAS 的日志以获取更多关于错误原因的详细信息。
谈谈我是如何帮这位网友解决“rocBLAS error: Could not initialize Tensile library”错误的?
1、首先,他的 TensileLibrary_lazy_gfx803.dat 文件是存的。
2、Stable Diffusion所有相关的都是正常的,不管是程序源码还是环境搭建、依赖等都是正常的。
3、通过“设备管理器”查看他的显卡,结果,他的显卡是“AMD Radeon RX 580 2048SP”。
AMD Radeon RX 580 2048SP是AMD公司生产的一款图形处理器,并不是NVIDIA显卡。而恰好,Stable Diffusion主要是支持NVIDIA显卡的,因此不能用,报rocBLAS错误也就很正常了。一个是A卡,一个是N卡,肯定是不行的。
4、要解决rocBLAS此错误,有一个方法,那就是运行Stable Diffusion的时候只用“CPU”,不用显卡GPU。
“Stable Diffusion - 高级选项 - 生成引擎”可以选择CPU即可解决此问题。
5、唯一需要注意的是,如果你用CPU来运行Stable Diffusion的话,生成图片估计会很慢,电脑也会很卡。
6、如果你想彻底解决此问题,还有一个方法,请参考“A卡跑Stable Diffusion教程”。