Skip to content

Should batchnorm layers be updated after avg_checkpoints.py? #224

@hal-314

Description

@hal-314

Hello,

Reading the new Pytorch post about SWA released in 1.6, they recommend to update batch norm statistic after averaging the checkpoints. I notice that avg_checkpoints.py doesn't do it. With the reason that Pytorch team for updating bn statistics, it makes sense that avg_checkpoints.py does it.

The new torch.optim.swa_utils.update_bn is pretty straigh forward. So, it could be copied (I don't know if there is a license conflict) to avoid forcing version 1.6. If you are considering to upgrade to Pytorch 1.6, we could use the new AverageModel class to simplify the script.

Finally, I'm willing to make a PR for both approaches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions