PyTorch 1.7.0 Compatibility Updates (#1233)
* torch 1.7.0 compatibility updates * add inference verification
This commit is contained in:
1 parent
453acdec67
commit
c8c5ef36c9
4 files changed
+16
-2
No files matched your search
@@ -136,6 +136,13 @@ def attempt_load(weights, map_location=None):
|
||||
attempt_download(w)
|
||||
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
|
||||
|
||||
# Compatibility updates
|
||||
for m in model.modules():
|
||||
if type(m) in [nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6]:
|
||||
m.inplace = True # pytorch 1.7.0 compatibility
|
||||
elif type(m) is Conv:
|
||||
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility
|
||||
|
||||
if len(model) == 1:
|
||||
return model[-1] # return model
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user