Repository navigation
hparams: strip a trailing path separator from the metric run name on Windows - #7176
Open
Ramnath0521 wants to merge 1 commit into
Open
Ramnath0521 wants to merge 1 commit into
Ramnath0521 wants to merge 1 commit into
Conversation
…Windows With an empty metric group, os.path.join(session_name, "") ends in a backslash on Windows. Only a trailing "/" was removed, so the run name did not match any run in the multiplexer and the HParams dashboard showed null for every metric. Remove a trailing os.sep as well. Fixes tensorflow#7175 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Motivation for features / changes
Fixes #7175. On Windows the HParams dashboard shows
nullfor every metric of a session, and the JSON download hasnulltoo, although the scalars are in the event files.run_tag_from_session_and_metricjoins the session name and the metric group withos.path.joinand then removes a trailing/. When the group is empty (whatadd_hparamswrites),os.path.join("Model001", "")isModel001\on Windows. The/check does not remove it, so the metric lookup uses a run name that the multiplexer does not know.Technical description of changes
tensorboard/plugins/hparams/metrics.py: remove a trailingos.sepas well as a trailing/. A session name that ends in/(a cloud path read on Windows) is still handled by the/check.tensorboard/plugins/hparams/metrics_test.py(new, with apy_testtarget inBUILD): six tests ofrun_tag_from_session_and_metric, run once withposixpathand once withntpathswapped intoos, so they exercise both separators on any machine. They cover an empty group, an empty group with a nested session, a session name ending in/, and a non-empty group. Two of the six fail without the change (the empty-group cases onntpath).Screenshots of UI changes (or N/A)
N/A
Detailed steps to verify changes work correctly (as executed by you)
On Windows 11, Python 3.12, with the TensorBoard 2.21.0 wheel installed for the generated protos:
train_loss) intologdir/Model001and loadedlogdirwithEventMultiplexer. It reports the runModel001.run_tag_from_session_and_metric("Model001", MetricName(group="", tag="train_loss")):('Model001\\', 'train_loss'), which is not a known run('Model001', 'train_loss'), which is the run in the multiplexerpython -m pytest tensorboard/plugins/hparams/metrics_test.py: 6 passed. Without the change inmetrics.py, 2 fail and 4 pass.I did not run the Bazel build, and I did not open the dashboard in a browser.
list_metric_evals_testandlist_session_groups_testneed TensorFlow, which I did not install here, so I did not run them.Alternate designs / implementations considered (or N/A)
"/".join(...): on Windows the multiplexer names nested runs with\(a logdir withModel001/trainreports the runsModel001andModel001\train), so a/join would not match them.rstrip: this would also change run names that legitimately end in more than one separator, which the old code did not touch.🤖 Generated with Claude Code