Skip to content

feat: add epoch_key to CometLogger to make epoch extraction configurable#21786

Open
pupeno wants to merge 2 commits into
Lightning-AI:masterfrom
pupeno:feat/log-key-prefix-comet
Open

feat: add epoch_key to CometLogger to make epoch extraction configurable#21786
pupeno wants to merge 2 commits into
Lightning-AI:masterfrom
pupeno:feat/log-key-prefix-comet

Conversation

@pupeno

@pupeno pupeno commented Jun 28, 2026

Copy link
Copy Markdown

What does this PR do?

Contributes to #21782

Adds epoch_key to CometLogger to let users control which incoming metric key is extracted
and forwarded to Comet's dedicated epoch= argument.

Previously this key was hardcoded to "epoch". With this change it is configurable, and can be
set to None to disable epoch extraction entirely.

Default is "epoch", which preserves the previous behaviour — fully backward-compatible.

# before: always extracted "epoch" from metrics
logger = CometLogger(...)

# after: same default, no change
logger = CometLogger(...)

# extract a prefixed epoch key (e.g. when used with Trainer(log_key_prefix="trainer/"))
logger = CometLogger(epoch_key="trainer/epoch")

# disable epoch extraction entirely
logger = CometLogger(epoch_key=None)
Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

pupeno and others added 2 commits June 28, 2026 14:56
Adds a `log_key_prefix` parameter to `Trainer` that prepends a string
to Trainer-generated metric keys such as `epoch`. Defaults to bare
`epoch` (no prefix), so existing users see no change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds an `epoch_key` parameter to `CometLogger` that controls which
metric key is extracted and forwarded as Comet's dedicated epoch
argument. Defaults to `"epoch"` (existing behaviour unchanged).
Pass `epoch_key=None` to disable epoch extraction entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant