Coder Social home page Coder Social logo

Comments (4)

KaimingHe avatar KaimingHe commented on July 20, 2024 2

The running_mean and running_std are not used by training; they are only used for inference. The motivation of having running_mean and running_std is to have an approximate estimation of the statistics of the training samples. This estimation can happen in any sequence of random samples, and when the model converges, this estimation should tend to be the same regardless of the sequence. So it is not necessary to sync the running_mean and running_std; it is sufficient to use them from any of the GPUs.

from moco.

KaimingHe avatar KaimingHe commented on July 20, 2024

What you described is Sync SGD; it has nothing to do with SyncBN. BN can be applied with DDP training. DDP training is by default Sync SGD training.

from moco.

Ze-Yang avatar Ze-Yang commented on July 20, 2024

As I know, the original BN only compute the mean and variance for each process (GPU) separately and does not communicate accross GPUs. That's why SyncBN arises to enable the mean and variance being computed on all batch samples.

In detectron2, defaults.py L457-L458 allow us to choose BN from (FrozenBN, GN, "SyncBN", "BN"). Here I focus on "BN" case. As you mention that Sync SGD can ensure the gradients of the affine weights and bias will be synchronized across GPUs. But what about the running_mean and running_var? Note that they do not belong to model weights and have nothing to do with SGD. Will they also be synchronized in original "BN"? Thanks.

from moco.

Ze-Yang avatar Ze-Yang commented on July 20, 2024

Thanks a lot for rectifying my misunderstanding of BN. Originally, I thought that the running_mean and running_var were also used in training phase, which confused me a lot.

from moco.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.