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

Can't use one GPU? #47

Closed
HymEric opened this issue Jul 4, 2020 · 8 comments
Closed

Can't use one GPU? #47

HymEric opened this issue Jul 4, 2020 · 8 comments

Comments

@HymEric
Copy link

HymEric commented Jul 4, 2020

If I want to use one or two GPUs in one server? What should I do?

@KaimingHe
Copy link
Contributor

We exploit the fact that by default BN is split into multiple GPUs in which mean/std is independently computed. To run on one GPU, you may implement BN split along the N (batch) dimension to mimic this effect (see NaiveBatchNorm in Detectron2). You also need to change the lr (e.g., linearly) if you change the batchsize to fit memory. To run on 2 GPUs, try --lr 0.0075 --batch-size 64.

@rbgirshick
Copy link

implement BN split along the N (batch) dimension to mimic this effect

There is an implementation of split (aka sub-batch) BN for video (3d) models that might be helpful to you:
https://github.com/facebookresearch/SlowFast/blob/master/slowfast/models/batchnorm_helper.py#L37-L46

This can easily be adapted to the the 2d BN case.

@JaejinCho
Copy link

@rbgirshick Thanks for the link. I actually needed this and am writing a code myself starting from there. BTW, if you know, It would be great if you could answer this question, which is regarding the code snippet. facebookresearch/SlowFast#357 (comment)

@JingLiJJ
Copy link

@rbgirshick Thanks for the link. I actually needed this and am writing a code myself starting from there. BTW, if you know, It would be great if you could answer this question, which is regarding the code snippet. facebookresearch/SlowFast#357 (comment)

@rbgirshick Thanks for the link. I actually needed this and am writing a code myself starting from there. BTW, if you know, It would be great if you could answer this question, which is regarding the code snippet. facebookresearch/SlowFast#357 (comment)

Hello, have you realized this? I also want to implement MOCO on a single GPU.

@DiaosWang
Copy link

@JingLiJJ maybe you can see https://github.com/leftthomas/MoCo

@solauky
Copy link

solauky commented Nov 13, 2023 via email

@athenacon
Copy link

@JingLiJJ maybe you can see https://github.com/leftthomas/MoCo

Hey! I would really want to run it on a single GPU, but I am not sure if I understand how this implementation works for a single GPU, could you please explain?

@solauky
Copy link

solauky commented Mar 9, 2024 via email

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

8 participants