从 *.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)
I have a .pth file created with Pytorch with weights. How would I be able to view the weights from this file?
I tried this code to load and view but it was not working (as a newbie, I might be entirely wrong)-
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(验证并确认)
(Verify and confirm)