Skip to content

预训练权重

约 114 个字 9 张图片 预计阅读时间 1 分钟

image-20250221104534879

image-20250221104549576

image-20250221104631382

image-20250221104819303

问题在于不能一一对应:

load_state_dict 中的 strict = True

image-20250221104957505

解决办法1

image-20250221105131601

torch.load_state_dict,加参数,strict=False

解决方法 2

加判断语句

image-20250221105656618

model_dict 是自己改的

ckpt 原始的

  • 在哪儿改?

image-20250221110820428

找到源码中 加载预训练权重的地方 ,修改为上面的判断语句代码

单 GPU 和多 GPU

image-20250221111510757

module. 替换成 '' 空,保证名字是一致的,可以加载预训练权重。

add_circle2025-02-21 10:44:15update2025-04-20 12:57:48