Sense-X / UniFormer

[ICLR2022] official implementation of UniFormer
Apache License 2.0
812 stars 111 forks source link

K400上预训练的权重,如何在sthv2微调训练时正确加载 #94

Closed LEM0NTE closed 1 year ago

LEM0NTE commented 1 year ago

嗨~我使用您发布的K400_S16x8权重文件, 放在sthv2数据集里进行训练, 得到了预期的结果。 即我在另一个问题中的提问https://github.com/Sense-X/UniFormer/issues/92#issuecomment-1309856281 但是当我使用我自己的预训练权重到sthv2下进行微调训练时发生了问题。比如我的权重文件是epoch00090.pth。我将其重命名为epoch00001.pth,然后放在sthv2下指定的输出文件夹里,来使其加载该权重继续训练。但是提示start epoch 91。 因此我加载了权重,并手动将checkpoints【‘epoch’】置为0。请问这样是可以的嘛,如果不可以的话,正确的加载K400训练权重,并在sthv2数据集下继续训练的方式应该是怎样的呢?

LEM0NTE commented 1 year ago

我进行了尝试,似乎不行。提示错误 RuntimeError: The size of tensor a (400) must match the size of tensor b (174) at non-singleton dimension 0 但我加载您提供的K400_s16x8, 然后放进sthv2中就可以正常训练。 希望尽快得到您的帮助!十分感谢

LEM0NTE commented 1 year ago

我进行了尝试,似乎不行。提示错误 RuntimeError: The size of tensor a (400) must match the size of tensor b (174) at non-singleton dimension 0 但我加载您提供的K400_s16x8, 然后放进sthv2中就可以正常训练。 希望尽快得到您的帮助!十分感谢

最新进展。我注意到模型的保存除了参数外,还保存了模型结构等所有信息。因此我取其中的checkpoints['model_state']保存到一个新的00001.pth文件。然后加载该文件可以正常训练了。但还不知道结果怎样,希望顺利

Andy1621 commented 1 year ago

可以的,不过可以直接修改model_path,见https://github.com/Sense-X/UniFormer/issues/92#issuecomment-1313051176