Enable apex O2 + dp (#493)

* remove O2 crash

* remove O2 crash

* bananas
This commit is contained in:
William Falcon
2019-11-11 22:58:11 -05:00
committed by GitHub
parent 8ea74733c1
commit e350a7db07
+9 -6
View File
@@ -87,12 +87,15 @@ class TrainerDPMixin(object):
# check for this bug (amp + dp + !01 doesn't work)
# https://github.com/NVIDIA/apex/issues/227
if self.use_dp and self.use_amp:
m = f"""
Amp level {self.amp_level} with DataParallel is not supported.
See this note from NVIDIA for more info: https://github.com/NVIDIA/apex/issues/227.
We recommend you switch to ddp if you want to use amp
"""
raise MisconfigurationException(m)
if self.amp_level == 'O2':
m = f"""
Amp level {self.amp_level} with DataParallel is not supported.
See this note from NVIDIA for more info: https://github.com/NVIDIA/apex/issues/227.
We recommend you switch to ddp if you want to use amp
"""
raise MisconfigurationException(m)
else:
model, optimizers = model.configure_apex(amp, model, self.optimizers, self.amp_level)
# create list of device ids
device_ids = self.data_parallel_device_ids