No module named ‘pytorch_lightning.utilities.distributed‘

在安装和运行stable-diffusion过程中遇到多个版本兼容性和模块导入问题,包括pytorch_lightning、omegaconf、piexif等的安装,以及fonts.ttf、Roboto模块缺失错误。尝试安装font-roboto和特定版本的gradio(3.32.0)以解决部分问题,但仍然遇到Unet中的Nan异常和图像生成问题。路径验证错误提示模型路径应正确设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在按照stable- diffusion中,需要安装很多依赖。如果版本不对,则不能成功运行,标题的问题就是如此。

相关参考:stable- diffusion V1效果咋样呢?V2呢?安装成功记录

解决方案:

 pip install pytorch_lightning==1.9
 pip install omegaconf
 pip install piexif

但此时还有问题:ModuleNotFoundError: No module named 'fonts.ttf'

这个fonts玩意从0.0.1版本到0.0.3版本都会出问题,卧槽。

ImportError: cannot import name 'Roboto' from 'fonts.ttf'

ModuleNotFoundError: No module named 'fonts'

有人说pip install font-roboto能解决问题,我这里还是不行。

然后再安装fonts解决:pip install fonts -i https://pypi.tuna.tsinghua.edu.cn/simple

继续安装其他依赖包:

pip install realesrgan
pip install inflection
pip install blendmodes
pip install timm
pip install lark

然后将misc文件中,增加如下代码:site-packages/basicsr/utils/misc.py

def get_device():
    if torch.cuda.is_available():
        return torch.device("cuda")
    else:
        return torch.device("cpu")

def gpu_is_available():
        return torch.cuda.is_available()

但是请求结果是404,我勒个去。

gradio版本变化太大了。

module 'gradio' has no attribute 'themes'

TypeError: launch() got an unexpected keyword argument 'ssl_verify'

安装指定版本解决此问题:pip install gradio==3.32.0

然而,modules.devices.NansException: 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.

如果增加--disable-nan-chec则生成的图全是黑色的,

modules.devices.NansException: A tensor with all NaNs was produced in Unet

这个问题真是难解决啊。我勒个去

暂时无法解决。

huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '../conf/models/chatglm2-6b/'. Use `repo_type` argument if needed.

这是路径不对,请仔细查看模型的位置及相对位置是否正确。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小李飞刀李寻欢

您的欣赏将是我奋斗路上的动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值