Model parallel get network name pytorch

I’m using nn.Dataparallel and tried to get its name by model.class.base
but it does not work with nn.Dataparallel which only gives string (DataParallel)

is there any solution without changing the model’s status?

After wrapping a model in nn.DataParallel, you can access it as model.module.
So you might need to add this additional .module keyword to your call.

Let me know, if that would work.

I totally forgot that!
So dataparallel is a wrapper?
May I ask you what it really does and HOW it distributes data to several gpus if you are available?

nn.DataParallel will create model replica on all specified devices. During the forward pass, the data will be split in dim0 and each chunk will be sent to the corresponding device.
This tutorial gives you more information regarding the shapes and this blog post explains the overall work flow as well as some disadvantages.

1 Like

Thanks! U r the best