Repository navigation
Conversation
…-of-list configs A list inside a list stayed a list value after flatten_dict, and TensorBoard's add_hparams raises on it in Logger.log_hyperparams, which stops GRPO setup before the first step for a config holding a matrix (for example Muon polar coefficients in the Megatron optimizer config). Each index path now ends in its own scalar key; expand_lists=False keeps lists intact as before. Signed-off-by: bzantium <[email protected]>
bzantium
force-pushed
the
flatten-dict-nested-lists
branch
from
November 25, 2026 12:47
2e69cac to
430ffdb
Compare
bzantium
force-pushed
the
flatten-dict-nested-lists
branch
from
December 2, 2026 15:35
430ffdb to
c268857
Compare
This branch has not been deployed
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.
What and why
flatten_dictexpands a list into one key per index, but only one level deep. A list inside a list stays a list value.Logger.log_hyperparamspasses the flattened master config to TensorBoard'sadd_hparams, andadd_hparamsraisesValueError: value should be one of int, float, str, bool, or torch.Tensoron a list value. With TensorBoard enabled, any config that holds a matrix therefore stops GRPO setup before the first step. Our case was Muon's polar coefficients in the Megatron optimizer config, a list of[a, b, c]triples.This PR makes
flatten_dictrecurse through lists at any depth, so every index path ends in its own key (coeffs.0.0,coeffs.0.1, ...). Dicts nested in lists flatten as before.expand_lists=Falsestill keeps every list intact. MLflow'slog_params, which uses the same function, gets the same keys.Tests:
expand_lists=Falseleaves it unchanged.Issues
None filed.
Convergence / perf / functionality proof
N/A: this only changes the keys the hyperparameter loggers receive for nested lists. Configs without nested lists flatten exactly as before.
Needs upstream changes
None