both files appear corrupted
See original GitHub issueI’ve tried to use any of the pkl
files you have uploaded, but they all appear corrupted.
I tried both as a model and as a weights file:
import torch
import torch.nn as nn
model = torch.load("resnet50_ft_weight.pkl")
print(model)
import torch
import torch.nn as nn
import torchvision.models as models
model = models.resnet50()
model.load_state_dict(torch.load("resnet50_ft_weight.pkl"))
print(model)
The output is:
RuntimeError: Invalid magic number; corrupt file?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:6
Top Results From Across the Web
How to Fix Corrupted Files - Lifewire
If you're desperate to fix the file and recover your information, try a file repair utility. There are both free and paid tools,...
Read more >What Does It Mean When Your File Is Corrupt?
A file typically becomes corrupted when a problem occurs during saving. If your computer loses power or crashes as you save a file,...
Read more >What Is A Corrupted File And How To Fix It? - Techslang
Corrupted files are computer files that become unusable or inoperable. Want to know how to fix them like a pro?
Read more >Corrupted Windows Files: What They Are and How to Fix Them
A corrupted file is one that is damaged, and does not perform properly. This can apply to any type of file, from program...
Read more >What Are Corrupted Windows Files and How to Fix Them
A corrupted file is simply a file that is damaged and not performing as it should. This can happen to any type of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This works:
try this:
import pickle with open(‘senet50_ft_weight.pkl’, ‘rb’) as f: obj = f.read() weights = pickle.loads(obj, encoding=‘latin1’)