Fix FLamby FedAdam NaN Issue on Eval #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is meant to address the issue we were seeing with Batch Normalization layers ending up with negative variance estimates due to momentum based aggregation in FedAdam. The effect is that sometimes the variance estimates for a batch normalization layer becomes negative. This causes failure in the forward pass during evaluation. The fix is to configure the batch normalization layers to not use training estimates of the batch mean and variance during evaluation, which means that the estimates tracked during training have no effect.
I've tested this fix for the Fed Isic 2019 EfficientNet model and it now appears to be avoiding NaN values in the eval stage throughout training. Will be post-processing the HP search and measuring performance tomorrow as long as the scripts run well through the night.