Add nn.SiLU inplace in attempt_load() (#1940)

* sleep 3 sec to load data .

* Update train.py

* Add nn.SiLU inplace in attempt_load()

Co-authored-by: wangliang <wangliang@codingapi.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
lorne 2021-01-16 01:58:41 +08:00 committed by GitHub
parent 777032efbc
commit 03ebe6ea14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,7 +119,7 @@ def attempt_load(weights, map_location=None):
# Compatibility updates
for m in model.modules():
if type(m) in [nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6]:
if type(m) in [nn.Hardswish, nn.LeakyReLU, nn.ReLU, nn.ReLU6, nn.SiLU]:
m.inplace = True # pytorch 1.7.0 compatibility
elif type(m) is Conv:
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatibility