Pytorch 中的 .ckpt 和 .pth 文件有什么区别?

问题描述 投票:0回答:1

我正在关注 GitHub 上使用 Pytorch 的代码。 模型使用以下方式保存:

model.save(ARGS.working_dir + '/model_%d.ckpt' % (epoch+1)).  

在 Pytorch 中使用

.pth
.ckpt
有什么区别?

pytorch
1个回答
11
投票

没有什么区别。您看到的 Pytorch 模型中的扩展是随机的。你可以选择任何东西。
人们通常使用

pth
来表示 PyTorcH 模型(因此也使用
.pth
)。但话又说回来,这完全取决于您想要如何保存模型。

旁注:
有些人可能会使用

.ckpt
来表示
checkpoint
,其中包含恢复训练所需的其他对象,例如
optimizers, schedulers, etc
,而普通
.pth
仅指模型权重,适合推理。

© www.soinside.com 2019 - 2024. All rights reserved.