解决comfyui的animatediff v3_sd15_mm.ckpt 模型报错要求`weights_only=True`

报错信息:

 (1) Re-running `torch.load` with `weights_only` set to `False` will likely succeed, but it can result in arbitrary code execution. Do it only if you got the file from a trusted source.

 (2) Alternatively, to load with `weights_only=True` please check the recommended steps in the following error message.

 WeightsUnpickler error: Unsupported global: GLOBAL omegaconf.dictconfig.DictConfig was not an allowed global by default. Please use `torch.serialization.add_safe_globals([DictConfig])` to allowlist this global if you trust this class/function.

今天把玩animatediff时,使用v3_sd15_mm.ckpt模型,出现上述错误信息。经过翻阅资料,大概意思是:

  • Dec 18, 2023 官方放出的模型出现这个报错,但是之前的预览版模型没有这个问题。
  • Dec 19, 2023 官方重新发布了模型,修复了该问题。
  • 现在从官方下载v3模型已经不会出现这个问题。

v3模型下载地址:https://huggingface.co/guoyww/animatediff/tree/main

另外,comfyui中早先animatediff的模型和lora模型都放在插件的目录下,现在comfyui在models目录下添加了animatediff_models和animatediff_motion_lora 两个目录,对模型统一管理,避免操作插件目录覆盖或影响模型文件。

解决comfyui的animatediff v3_sd15_mm.ckpt 模型报错要求`weights_only=True`