1. 报错信息

Error: Weights only load failed. This file can still be loaded, to do so you have two options, do those steps only if you trust the source of the checkpoint.

错误:仅加载权重失败。此文件仍然可以加载,为此您有两个选择,只有当您信任检查点的来源时,才能执行这些步骤。

2. 解决方案

在检查点恢复模型进行resume时,由于存在某些安全问题,因此需要在代码端更改。
代码中搜索torch.load,更改参数。原代码为:

checkpoint = torch.load(os.path.join(ckpt_path, "trainer.ckpt"))

修改为:

checkpoint = torch.load(os.path.join(ckpt_path, "trainer.ckpt"), weights_only=False)

问题解决。