Repository navigation
Add Tensor Metrics system for training - #6552
Closed
philipcmonk wants to merge 5 commits into
Closed
philipcmonk wants to merge 5 commits into
philipcmonk wants to merge 5 commits into
Conversation
Signed-off-by: Philip Monk <pmonk@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
Author
|
/ok to test |
Signed-off-by: Philip Monk <pmonk@nvidia.com>
Signed-off-by: Philip Monk <pmonk@nvidia.com>
4 of 6 tasks
Contributor
|
I think this needs to be split up, just based on the 8.9k LOC difference. :d |
Contributor
Author
|
I think the natural boundaries are probably these:
We could make those as four separate PRs or combine some of the training PRs since they'll probably have the same reviewers. |
Signed-off-by: Philip Monk <pmonk@nvidia.com>
Signed-off-by: Philip Monk <pmonk@nvidia.com>
Contributor
Author
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.
This PR introduces a general training metrics subsystem. This is a reimplementation and generalization of #5492.
There are dozens of metrics that we want to keep track of during training, and currently we have to thread each one separately through the model. This is bug-prone and delicate, and it multiplies the complexity of making other changes that affect the sharding of tensors.
Here, we add a system that decouples obtaining a tensor from the metric computation itself. This lets users easily add metrics without changes to MCore.
Check the committed README at megatron/training/tensor_metrics.md for an overview of the system and how to add metrics.
This is a large PR, I recommend it be reviewed in pieces (in whatever order is natural to you):
megatron/training/tensor_metrics/{core,observer}.py: The core system, with Observer and Executor implementations plus the TensorMetric interface.megatron/training/tensor_metrics/{definitions,examples,router_metrics}.py: Initial set of implemented metrics.megatron/training/training.py: How the observer is called from the training loop.megatron/core/parameter_names.pyandmegatron/training/tensor_metrics/optimizer_sources.py: Parameter/wgrad discovery across optimizers, canonical naming, manifests, and placement metadata.megatron/core/*: How activation tensors are observed.tests/*: Unit tests.This is a draft while the design is reviewed. The implementation is generally complete and I've started using it to debug issues, but details are not fully stable yet.