Kevin57:

I wrap the visual network in using DataParallel, and the visual network is included in the final actor-critic model. However, when I export the final model to onnx, it gave an error a NoneType error when reading.


Hey @Kevin57, could you please create an issue on PyTorch github with the error log? And please also add an onnx label to that issue. Thanks!

I read from other posts and understand that if I wrap the final model into DataParallel, I could call the module attribute. However, I don’t know what exactly I should do when part of the model is wrapped in DataParallel and I couldn’t find similar issues online.

Could you please show a code snippet? Is it sth like:
class MyModule(nn.Module):
  def __init__(self):
    self.l1 = nn.Linear(20, 20)
    self.l2 = DataParallel(nn.Linear(20, 20))

If this is the case, does the following work?
net = MyModule()
net.l2.module # this should returns the non-DataParallel linear module 

cc @VitalyFedyunin