Skip to content

docs: fix CometLogger log_model docstring example#21759

Open
gaurav0107 wants to merge 1 commit into
Lightning-AI:masterfrom
gaurav0107:fix/20583-comet-undocumented-and-incorrectly-descr
Open

docs: fix CometLogger log_model docstring example#21759
gaurav0107 wants to merge 1 commit into
Lightning-AI:masterfrom
gaurav0107:fix/20583-comet-undocumented-and-incorrectly-descr

Conversation

@gaurav0107

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the broken docstring example for log_model in the CometLogger
class (src/lightning/pytorch/loggers/comet.py). The current example is
syntactically invalid Python — it places a positional argument after a
keyword argument, and it omits the file_or_folder= keyword that the
Comet SDK requires.

Before:

logger.experiment.log_model(name="my-model", "<path to your model>")

After:

logger.experiment.log_model(name="my-model", file_or_folder="<path to your model>")

This matches the call signature documented at
https://www.comet.com/docs/v2/api-and-sdk/python-sdk/reference/Experiment/#experimentlog_model
and the worked example in issue #20583.

Fixes #20583

Before submitting
  • Was this discussed/agreed via a GitHub issue? — yes, Comet: Undocumented and incorrectly described function #20583, with a worked example by the reporter.
  • Did you read the contributor guideline?
  • Did you make sure your PR does only one thing? — yes, single-line docstring fix; no behavior changes.
  • N/A documentation update beyond the docstring itself.
  • N/A new tests — docstring-only change, nothing to test.
  • Did you verify new and existing tests pass locally with your changes? — ruff check and ruff format --check pass; AST parses cleanly.
  • N/A breaking changes.
  • N/A CHANGELOG — PR template explicitly excludes docstring fixes.

PR review

Anyone in the community is welcome to review the PR.

@gaurav0107 gaurav0107 marked this pull request as ready for review June 6, 2026 13:13
@gaurav0107 gaurav0107 requested a review from williamFalcon as a code owner June 6, 2026 13:13
@gaurav0107

Copy link
Copy Markdown
Contributor Author

Marked ready for review. This is a one-line docstring fix matching the corrected call signature in the issue body — no behavior change, ruff check and ruff format both pass locally. Happy to adjust if maintainers prefer a fuller rewrite of the surrounding log_model docs as a follow-up.

@codecov-commenter

codecov-commenter commented Jun 6, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79%. Comparing base (4819088) to head (aedba1b).
✅ All tests successful. No failed tests found.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

❗ There is a different number of reports uploaded between BASE (4819088) and HEAD (aedba1b). Click for more details.

HEAD has 2045 uploads less than BASE
Flag BASE (4819088) HEAD (aedba1b)
python3.10 36 3
cpu 500 41
lightning 179 15
pytest 250 0
python 36 3
lightning_fabric 160 0
python3.12 144 11
python3.12.7 106 9
python3.11 72 6
python3.13 106 9
pytorch2.8 36 6
pytorch_lightning 161 26
pytest-full 250 41
pytorch2.7 18 3
pytorch2.9 36 5
pytorch2.10 36 6
pytorch2.6 17 3
pytorch2.4.1 17 3
pytorch2.2.2 18 3
pytorch2.1 36 6
pytorch2.3 18 3
pytorch2.5.1 18 3
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #21759     +/-   ##
=========================================
- Coverage      87%      79%     -8%     
=========================================
  Files         270      267      -3     
  Lines       24010    23951     -59     
=========================================
- Hits        20790    18830   -1960     
- Misses       3220     5121   +1901     

@gaurav0107 gaurav0107 force-pushed the fix/20583-comet-undocumented-and-incorrectly-descr branch from 798ade7 to efa33ef Compare July 2, 2026 15:08
@gaurav0107

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest master and force-pushed; the one-line docstring change itself is unchanged. The earlier docs-make (pytorch, doctest) failure was a transient CI issue rather than anything in this diff — this PR only edits a non-executed .. code-block:: python example, and doctest is green on master. It now passes on the rebased commit (efa33efa6). The only remaining red check is the external Read the Docs build, which isn't a required merge gate.

The example for `log_model` in the CometLogger class docstring was
syntactically invalid Python (positional argument after keyword) and
omitted the `file_or_folder=` keyword that the Comet SDK requires.

Update the rst code-block to use the documented call signature:

    logger.experiment.log_model(name="my-model", file_or_folder="<path to your model>")

Fixes Lightning-AI#20583
@gaurav0107 gaurav0107 force-pushed the fix/20583-comet-undocumented-and-incorrectly-descr branch from efa33ef to aedba1b Compare July 7, 2026 21:34
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.

Comet: Undocumented and incorrectly described function

2 participants