小编use*_*484的帖子

从 *.pth 文件查看 Pytorch 权重

我有一个使用 Pytorch 创建的带有权重的.pth文件。我如何才能查看该文件中的权重?

我尝试加载和查看此代码,但它不起作用(作为新手,我可能完全错了)-

import torch
import torchvision.models as models

torch.save('weights\kharif_crops_final.pth')

models.load_state_dict(torch.load('weights\kharif_crops_final.pth'))
models.eval()
print(models)
Run Code Online (Sandbox Code Playgroud)

python machine-learning prediction torch pytorch

4
推荐指数
1
解决办法
8014
查看次数

标签 统计

machine-learning ×1

prediction ×1

python ×1

pytorch ×1

torch ×1