Negate the deprecated offline flag in CometLogger - #21921
Open
VenishPaneliya wants to merge 2 commits into
Open
Conversation
VenishPaneliya
requested review from
ethanwharris,
justusschock,
tchaton and
williamFalcon
as code owners
August 26, 2026 08:57
The compatibility shim maps the old `offline` kwarg onto `online`
without inverting it:
if online is None:
online = kwargs.pop("offline")
`offline` and `online` are opposites, so `CometLogger(offline=True)`
starts an online experiment and uploads the run, and `offline=False`
starts an offline one. Before the `online` parameter was introduced the
code read `self.mode = "offline" if offline else "online"`, so the
inversion is what the shim is meant to preserve.
The two neighbouring shims map synonyms - `project_name` onto `project`,
`save_dir` onto `offline_directory` - which is why a direct assignment
looks right here but is not.
Only callers still passing the deprecated `offline` kwarg are affected;
`online` is unchanged.
VenishPaneliya
force-pushed
the
comet-offline-flag
branch
from
August 31, 2026 17:03
b4600fa to
581f25b
Compare
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.
The compatibility shim for the deprecated
offlinekwarg assigns it straight ontoonline:offlineandonlineare opposites, so the flag is inverted.onlineflows toself._onlineand then tocomet_ml.start(online=self._online):CometLogger(offline=True)therefore starts a fully online experiment and uploads the run, which is the opposite of what the caller asked for. Beforeonlinewas introduced in #20275 the code wasself.mode = "offline" if offline else "online", so the inversion is exactly what the shim is meant to preserve.The two neighbouring shims in the same block map synonyms —
project_nameontoproject,save_dirontooffline_directory— where a direct assignment is right. This one maps antonyms, which is easy to miss.Only callers still passing the deprecated
offlinekwarg are affected; anyone ononlineis unchanged.Added
test_comet_logger_deprecated_offline_flag, which checks both directions. It fails onmasterand passes here;tests/tests_pytorch/loggers/test_comet.pygoes 8 -> 9 passing.One thing worth flagging for reviewers: there is a separate bug just below at the
disabled=Trueblock (#21617, being fixed in #21619 / #21634). Until that lands, this change movesoffline=Truefrom "silently uploads online" to "silently disabled" rather than to a working offline experiment. That is still strictly better — no unintended upload — but the two want to land together to giveoffline=Trueits intended behaviour.