feat(training): speedup multiscale loss#1212
Draft
cathalobrien wants to merge 7 commits into
Draft
Conversation
This reverts commit 1de56c9.
Member
|
Nice! Should we consider adding the CRPS loss as a default compile option in (probably need to revisit compile defaults when observations are merged, specifically dynamic=False) |
Member
|
I had this in a branch to allow for directly creating the matrix in csr ; which is relevant when creating large matrices. Can you check how this would fit here as well? |
Member
|
just for context, we're still doing loss correctness tests on this branch and I will post the mlflows here once we have the comparisons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR introduces a few changes to various losses with the aim of speeding up the multiscale loss in the temporal downscaler.
The main change is grouping the N sparse matmuls in sparse_projector.py to 1 large sparse matmul. the multi scale loss was having to load the projection matrix into L2 memory with each call to sparse matmul.
Additionally the projection matrices are now converted to CSR format during multiscale loss init time. This further speeds up the loading of the projection matrices, as well as reducing peak memory usage.
After these changes, the individual CRPS loss computations begin to dominate. Compiling them gives another speedup (that's set in the config not in this PR)
some rough timings for the loss alone, using a standalone bm script.
The results roughly match what I see in the traces from full training runs. The end-to-end throughput of a full training run has gone from 0.22 it/s to 0.62 it/s (0.55 without compiling)