Are you using any .cuda() or to('cuda') operations inside the model’s forward method?
If so, you would have to remove them and use e.g. the .device attribute of an internal parameter or the input tensor.
nn.DataParallel will create model replicas on all devices, which would yield a device mismatch if you create tensors in the forward on the default device.