transformers icon indicating copy to clipboard operation
transformers copied to clipboard

fp16 is broken

Open zsk423200 opened this issue 7 years ago • 1 comments

run run_glue.py with the parameter of --fp16, and return error:

RuntimeError: Incoming model is an instance of torch.nn.parallel.DistributedDataParallel. Parallel wrappers should only be applied to the model(s) AFTER
the model(s) have been returned from amp.initialize.

i find the reason is the wrong order of amp.initialize and model = torch.nn.DataParallel, iIf DDP wrapping occurs before amp.initialize, amp.initialize will raise an error, and it worked after i change the order

zsk423200 avatar Jul 23 '19 08:07 zsk423200

Indeed, thanks! Fixed in master

thomwolf avatar Jul 23 '19 15:07 thomwolf