Rick-29 commited on
Commit
c08a343
·
verified ·
1 Parent(s): affd330

Fix to the efficientnet loading error

Browse files
Files changed (1) hide show
  1. model.py +8 -0
model.py CHANGED
@@ -1,4 +1,12 @@
1
 
 
 
 
 
 
 
 
 
2
  import torch
3
  import torchvision
4
 
 
1
 
2
+ from torchvision.models._api import WeightsEnum
3
+ from torch.hub import load_state_dict_from_url
4
+
5
+ def get_state_dict(self, *args, **kwargs):
6
+ kwargs.pop("check_hash")
7
+ return load_state_dict_from_url(self.url, *args, **kwargs)
8
+ WeightsEnum.get_state_dict = get_state_dict
9
+
10
  import torch
11
  import torchvision
12