updates
This commit is contained in:
parent
3cfc84a183
commit
ce4ea0c332
1
train.py
1
train.py
|
@ -162,6 +162,7 @@ def train(cfg,
|
||||||
# Mixed precision training https://github.com/NVIDIA/apex
|
# Mixed precision training https://github.com/NVIDIA/apex
|
||||||
if mixed_precision:
|
if mixed_precision:
|
||||||
model, optimizer = amp.initialize(model, optimizer, opt_level='O1', verbosity=0)
|
model, optimizer = amp.initialize(model, optimizer, opt_level='O1', verbosity=0)
|
||||||
|
print('Using Apex')
|
||||||
|
|
||||||
# Initialize distributed training
|
# Initialize distributed training
|
||||||
if torch.cuda.device_count() > 1:
|
if torch.cuda.device_count() > 1:
|
||||||
|
|
|
@ -16,17 +16,11 @@ def select_device(force_cpu=False):
|
||||||
if not cuda:
|
if not cuda:
|
||||||
print('Using CPU')
|
print('Using CPU')
|
||||||
if cuda:
|
if cuda:
|
||||||
try: # Mixed precision training https://github.com/NVIDIA/apex
|
|
||||||
from apex import amp
|
|
||||||
apex_str = 'Apex '
|
|
||||||
except:
|
|
||||||
apex_str = ''
|
|
||||||
|
|
||||||
torch.backends.cudnn.benchmark = True # set False for reproducible results
|
torch.backends.cudnn.benchmark = True # set False for reproducible results
|
||||||
c = 1024 ** 2 # bytes to MB
|
c = 1024 ** 2 # bytes to MB
|
||||||
ng = torch.cuda.device_count()
|
ng = torch.cuda.device_count()
|
||||||
x = [torch.cuda.get_device_properties(i) for i in range(ng)]
|
x = [torch.cuda.get_device_properties(i) for i in range(ng)]
|
||||||
cuda_str = 'Using CUDA ' + apex_str
|
cuda_str = 'Using CUDA '
|
||||||
for i in range(0, ng):
|
for i in range(0, ng):
|
||||||
if i == 1:
|
if i == 1:
|
||||||
# torch.cuda.set_device(0) # OPTIONAL: Set GPU ID
|
# torch.cuda.set_device(0) # OPTIONAL: Set GPU ID
|
||||||
|
|
Loading…
Reference in New Issue