Skip to content

Changing CustomDataParallel to DistributedDataParallel#487

Open
adrianosantospb wants to merge 1 commit into
zylo117:masterfrom
adrianosantospb:1.3
Open

Changing CustomDataParallel to DistributedDataParallel#487
adrianosantospb wants to merge 1 commit into
zylo117:masterfrom
adrianosantospb:1.3

Conversation

@adrianosantospb

Copy link
Copy Markdown

Changing the previous CustomDataParallel to DistributedDataParallel to improve the training speed.

Comment thread train.py
def save_checkpoint(model, name):
if isinstance(model, CustomDataParallel):
if isinstance(model, torch.nn.parallel.DistributedDataParallel):
torch.save(model.module.model.state_dict(), os.path.join(opt.saved_path, name))

@zylo117 zylo117 Aug 25, 2020

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if DDP's module is the real model like DP

@zylo117 zylo117 Aug 25, 2020

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASAIK, it's model.model.state_dict() for DDP like the ordinary model. Or both are ok?

@zylo117

zylo117 commented Aug 25, 2020

Copy link
Copy Markdown
Owner

Hi, thanks for your contribution.
Have you tested it by training and loading the last training weights successfully? I think the weights saving & loading could be a problem.
And my another concern is that the printing will be showed for N times (N for number of gpus) and tensorboard will be recorded for N times too.

@adrianosantospb

adrianosantospb commented Aug 25, 2020

Copy link
Copy Markdown
Author

It's a pleasure. You did a great job. Yes. I've tested in the afternoon, but I'm training a big model now. Tomorrow I will do more tests to see; this model is running on my machine (job).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants