Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Combining sync batchnorm with DeepSpeed? #502

Open
Parskatt opened this issue Nov 4, 2020 · 3 comments
Open

[Question] Combining sync batchnorm with DeepSpeed? #502

Parskatt opened this issue Nov 4, 2020 · 3 comments

Comments

@Parskatt
Copy link

Parskatt commented Nov 4, 2020

Hi,

I'm not sure how to combine synchronized batchnormalization with deepspeed.
Using model_engine.module = torch.nn.SyncBatchNorm.convert_sync_batchnorm(model_engine.module)
Gives me the error: AttributeError: SyncBatchNorm is only supported within torch.nn.parallel.DistributedDataParallel

Is there another way of making my batchnorms synchronized?

@Parskatt
Copy link
Author

Parskatt commented Nov 6, 2020

I solved it (I think) by just requiring dist_init_required=True in the initialization step.

@Parskatt Parskatt closed this as completed Nov 6, 2020
@Parskatt
Copy link
Author

Parskatt commented Nov 9, 2020

Nevermind, that was simply because I was using a single GPU, its still not working for multiple GPUs for me.

@Parskatt Parskatt reopened this Nov 9, 2020
@Parskatt
Copy link
Author

Parskatt commented Jan 4, 2023

Not sure what I was doing when I typed this, but nowadays it works by doing

model = nn.SyncBatchNorm.convert_sync_batchnorm(model)
model_engine, _, _, _ = deepspeed.initialize(model = model, ...)

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

No branches or pull requests

1 participant