this is a known limitation of the tracing / jit at the moment – that it doesn’t support nn.DataParallel right now.
What you can do is to trace your model inside of DataParallel.
For example:
traced_script_module = torch.jit.trace(model.module, example)