欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 手游 > Mac M1 ComfyUI 中 AnyText插件安装问题汇总?

Mac M1 ComfyUI 中 AnyText插件安装问题汇总?

2025/2/5 13:29:20 来源:https://blog.csdn.net/qq_42393720/article/details/145444758  浏览:    关键词:Mac M1 ComfyUI 中 AnyText插件安装问题汇总?

Q1:NameError: name ‘PreTrainedTokenizer’ is not defined ?

在这里插入图片描述
该项目最近更新日期为2024年12月,该时间段的transformers 版本由PyPI 上的 transformers 页面 可知为4.47.1.

A1: transformers 版本不满足要求,必须降级transformors ?

(1)查看 transformers 版本
pip index versions transformers 

发现是最新版4.48.2,降级到4.46.2

pip install transformers==4.46.2

Q2:“ComfyUI/custom_nodes/ComfyUI_Anytext/Image_Generation_AnyText/Site_Packages/AnyTextControlDiffusion/ldm/modules/encoders/modules.py” AssertionError: Torch not compiled with CUDA enabled". ?

A2: 将modules.py文件里下面这行代码:

tokens = tokens.to(self.device)

修改为如下内容:

self.device = torch.device("mps" if torch.backends.mps.is_available() else "cpu")
tokens = tokens.to(self.device)

Q3:‘ComfyUI_Anytext/Image_Generation_AnyText/Site_Packages/AnyTextControlDiffusion/cldm/ddim_hacked.py’ AssertionError: Torch not compiled with CUDA enabled?

A3:

在 ddim_hacked.py 文件中,将 register_buffer 方法里这行代码
attr = attr.to(torch.device("cuda"))

修改为

if torch.backends.mps.is_available():attr = attr.to(torch.device("mps"))
else:attr = attr.to(torch.device("cpu"))

Q4: ComfyUI/custom_nodes/ComfyUI_Anytext/Image_Generation_AnyText/Site_Packages/AnyTextControlDiffusion/cldm/ddim_hacked.py", line 22, in register_buffer attr = attr.to(torch.device(“mps”)) TypeError: Cannot convert a MPS Tensor to float64 dtype as the MPS framework doesn’t support float64. Please use float32 instead?

A4:

在 ddim_hacked.py 文件中,将 register_buffer 方法里这行代码
if torch.backends.mps.is_available():attr = attr.to(torch.device("mps"))
else:attr = attr.to(torch.device("cpu"))

修改为:

if attr.dtype == torch.float64:attr = attr.to(torch.float32)
if torch.backends.mps.is_available():attr = attr.to(torch.device("mps"))
else:attr = attr.to(torch.device("cpu"))

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com