Skip to content

Fix dotted metric names in line plots - #678

Merged
abidlabs merged 4 commits into
mainfrom
issue-677-trl-profiling-metrics
Aug 28, 2026
Merged

Fix dotted metric names in line plots#678
abidlabs merged 4 commits into
mainfrom
issue-677-trl-profiling-metrics

Conversation

@abidlabs

Copy link
Copy Markdown
Member

Fixes #677.

Summary

  • Escape Vega field-path metacharacters in dynamic line-plot encodings.
  • Preserve the original labels while using escaped field references for axes, series, and tooltips.
  • Add regression coverage for dots, brackets, and backslashes.

Verification

  • cd trackio/frontend && npm test
  • cd trackio/frontend && npm run lint
  • cd trackio/frontend && npm run build
  • cd trackio/frontend && node repro_issue_677_vega.mjs

Minimal reproduction

import math
import trackio

metric = "profiling/Time taken: GRPOTrainer.compute_loss"
trackio.init(project="issue-677-dotted-metric", name="trl-grpo-profile")
for step in range(12):
    trackio.log({metric: 0.25 + 0.08 * math.sin(step / 2)}, step=step)
trackio.finish()
trackio.show(project="issue-677-dotted-metric")

The reproduction files are intentionally untracked and were not committed.

@gradio-pr-bot

gradio-pr-bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🪼 branch checks and previews

Name Status URL
🦄 Changes detected! Details

@gradio-pr-bot

Copy link
Copy Markdown
Contributor

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
trackio minor

  • Fix dotted metric names in line plots

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs

Copy link
Copy Markdown
Member Author

Before / after Spaces

Space Expected result
Before profiling/reference_metric renders; profiling/Time taken: GRPOTrainer.compute_loss is empty
After Both profiling metrics render

Both Spaces use byte-identical app.py files and serve the same 12 values for each metric. The after Space serves the exact frontend bundle built from this branch.

@abidlabs
abidlabs marked this pull request as ready for review August 27, 2026 17:43

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a trackio expert but this looks right to me. I checked escapeVegaField against vega-util's splitAccessPath and it round-trips profiling/Time taken: GRPOTrainer.compute_loss back to the literal key, and every field: in the spec looks covered.

One thing I wasn't sure about: quotes aren't escaped. splitAccessPath seems to enter quote mode whenever i === b, which for a field with no dots holds at every position, so something like say "hi" would still break. vega-lite's replacePathInField uses /(\[|\]|\.|'|")/g. Might be worth the union, though it doesn't affect us, our metric names come from Python identifiers.

Thanks for the quick turnaround.

@abidlabs

Copy link
Copy Markdown
Member Author

Thanks for catching that @qgallouedec! Addressed now.

@abidlabs
abidlabs merged commit df9168e into main Aug 28, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TRL profiling metrics do not render in Trackio

3 participants