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

Fix validation loss aggregation in VSUNet #202

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

ziw-liu
Copy link
Collaborator

@ziw-liu ziw-liu commented Nov 7, 2024

Fix a bug where the training loop does not clear loss/validate metrics after logging it. The logged metric will be the average of all the epochs, affecting checkpoint selection.

@ziw-liu ziw-liu added bug Something isn't working translation Image translation (VS) labels Nov 7, 2024
@ziw-liu ziw-liu marked this pull request as ready for review November 7, 2024 19:23
@ziw-liu
Copy link
Collaborator Author

ziw-liu commented Nov 7, 2024

This bug means that previously, as long as the loss of the new $N$-th epoch $l_N$ is lower than the average loss than the previous epochs, the new 'validation loss' logged (which is actually the average over $N$ epochs, $\overline{l}_{N}$), will appear to decrease:

$$\overline{l}_{N} - \overline{l}_{N-1} = \frac{\sum_{i=0}^N l_i}{N} - \frac{\sum_{i=0}^{N-1} l_i}{N-1} = \frac{1}{N} (l_N - \frac{1}{N-1} \sum_{i=0}^{N-1} l_i) = \frac{1}{N} (l_N - \overline{l}_{N-1})$$

@ziw-liu
Copy link
Collaborator Author

ziw-liu commented Nov 7, 2024

These being said, we also watch per-step validation losses. They are a bit noisy, but I don't think our models have major overfitting issues.

Copy link
Contributor

@edyoshikun edyoshikun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more users more bugs! thanks for the fix.

@ziw-liu ziw-liu merged commit db80819 into main Nov 8, 2024
4 checks passed
@ziw-liu ziw-liu deleted the fix-validation-loss-logging branch November 8, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working translation Image translation (VS)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants