大家好,我是超人小飞侠007,小飞侠好久没玩SD了,这不在国庆期间对SD进行软件升级又发现各种问题,今天就我出现的问题一一记录。
主要针对很多小白不熟悉操作,所以讲的比较细。
升级步骤:
1. 在sd项目下打开终端窗口;或者使用终端命令cd至sd项目路径下。
在终端输入cd命令:cd stable-diffusion-webui-04
每个安装项目的位置不一样,所以大家按照自己实际的路径来
2.在终端窗口输入升级命令:git pull
问题1:致命错误,无法访问
以后看到“致命错误,无法访问”就表示是网络问题,多试几次。方案如下:
(1)不行就用外网梯子,再多试几次,多等等命令执行。
(2)还不行就重启电脑,再多试几次,多等等命令执行。(有时重启电脑真的有用)
git pull执行完毕之后,又报出新的问题。
问题2:Git代码冲突。改动原项目文件之后,使用git pull拉下新代码报错
懂git的都知道,这是git代码冲突。上图出现的冲突文件就是这个launch.py。
至于为什么咱会报错呢?
大家还记得咱四月份在安装旧版本的时候改动了这个launch.py文件,所以现在更新项目有代码冲突了。
解决方法:
我们要对我们之前改动的文件进行还原。
(1)在终端窗口执行命令: git checkout -- launch.py
执行完命令之后,继续执行:git pull
看到如图显示,则表示更新项目成功!
启动项目
我们之前部署旧版本的时候已经把项目相关的环境都搞了一遍,所以接下来我们只需要直接执行启动项目的命令:./webui.sh
启动项目时会遇到的常见报错:
1.致命错误:无法访问
致命错误:无法访问 'https://github.com/Stability-AI/generative-models.git/':Failed to connect to github.com port 443 after 75076 ms: Couldn't connect to server
Traceback (most recent call last):
File "/Users/mac/stable-diffusion-webui-04/launch.py", line 48, in <module>
main()
File "/Users/mac/stable-diffusion-webui-04/launch.py", line 39, in main
prepare_environment()
File "/Users/mac/stable-diffusion-webui-04/modules/launch_utils.py", line 381, in prepare_environment
git_clone(stable_diffusion_xl_repo, repo_dir('generative-models'), "Stable Diffusion XL", stable_diffusion_xl_commit_hash)
File "/Users/mac/stable-diffusion-webui-04/modules/launch_utils.py", line 186, in git_clone
run(f'"{git}" clone "{url}" "{dir}"', f"Cloning {name} into {dir}...", f"Couldn't clone {name}", live=True)
File "/Users/mac/stable-diffusion-webui-04/modules/launch_utils.py", line 115, in run
raise RuntimeError("\n".join(error_bits))
RuntimeError: Couldn't clone Stable Diffusion XL.
解决方案:(1)多试几次,多等等
(2)用外网梯子,多试试
(3)手动下载,参考我之前的文章
2.Installing requirements 卡住报错
关键错误 :TimeoutError: The read operation timed out。读取超时
ERROR: Exception:
Traceback (most recent call last):
File "/Users/mac/anaconda3/lib/python3.10/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
yield
File "/Users/mac/anaconda3/lib/python3.10/site-packages/pip/_vendor/urllib3/response.py", line 561, in read
data = self._fp_read(amt) if not fp_closed else b""
File "/Users/mac/anaconda3/lib/python3.10/site-packages/pip/_vendor/urllib3/response.py", line 527, in _fp_read
return self._fp.read(amt) if amt is not None else self._fp.read()
File "/Users/mac/anaconda3/lib/python3.10/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 90, in read
data = self.__fp.read(amt)
File "/Users/mac/anaconda3/lib/python3.10/http/client.py", line 465, in read
s = self.fp.read(amt)
File "/Users/mac/anaconda3/lib/python3.10/socket.py", line 705, in readinto
return self._sock.recv_into(b)
File "/Users/mac/anaconda3/lib/python3.10/ssl.py", line 1274, in recv_into
return self.read(nbytes, buffer)
File "/Users/mac/anaconda3/lib/python3.10/ssl.py", line 1130, in read
return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
.......................
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
解决方案:因为是读取超时,所以和1的方案是一样。
3.Torch版本过低:报torch模块ModuleNotFoundError找不到
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.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
WARNING:modules.mac_specific:MPS garbage collection failed
Traceback (most recent call last):
File "/Users/mac/stable-diffusion-webui/modules/mac_specific.py", line 37, in torch_mps_gc
from torch.mps import empty_cache
ModuleNotFoundError: No module named 'torch.mps'
WARNING:modules.mac_specific:MPS garbage collection failed
Traceback (most recent call last):
File "/Users/mac/stable-diffusion-webui/modules/mac_specific.py", line 37, in torch_mps_gc from torch.mps import empty_cache
ModuleNotFoundError: No module named 'torch.mps'
WARNING:modules.mac_specific:MPS garbage collection failed
Traceback (most recent call last):
File "/Users/mac/stable-diffusion-webui/modules/mac_specific.py", line 37, in torch_mps_gc from torch.mps import empty_cache ModuleNotFoundError: No module named 'torch.mps'
0%| | 0/20 [00:00<?, ?it/s]/AppleInternal/Library/BuildRoots/9941690d-bcf7-11ed-a645863efbbaf80d/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:794: failed assertion `[MPSNDArray, initWithBuffer:descriptor:] Error: buffer is not large enough. Must be 2621440 bytes ./webui.sh: line 255: 924 Abort trap: 6 "${python_cmd}" -u "${LAUNCH_SCRIPT}" "$@"
/opt/homebrew/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown warnings.warn('resource_tracker: There appear to be %d '
因此我们要对Torch进行升级!
解决方案:
此时打开访达进入SD主目录,选择webui-macos-env.sh文件,右键以文本编辑方式打开,
在export COMMANDLINE_ARGS....这一行的最后这里,加上--reinstall-torch 修改后保存并退出。记得在前面多加一个空格
4.项目启动成功之后,无法正常出图,提示NansException: A tensor with all NaNs was produced in Unet
这个问题在mac电脑中也是比较常见的
这通常出现详细提示:
A tensor with all NaNs was produced in Unet. This could be either because there's not enough precision to represent the picture, or because your video card does not support half type. Try setting the "Upcast cross attention layer to float32" option in Settings > Stable Diffusion or using the --no-half commandline argument to fix this. Use -- disable-nan-check commandline argument to disable this check.
网上一般解释为描述词精确度不足或显卡兼容问题,与mac的MI显卡兼容性的关系更大,但咱可以通过设置简单解决。
最后成功升级完成,自动访问SD页面
美佳好物测评分享 2024-11-20
_音为有你_ 2024-11-20
宽博显示屏厂家 2024-11-20