Skip to content

Ss/neptune scale integration #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 31, 2025
Merged

Conversation

SiddhantSadangi
Copy link
Member

@SiddhantSadangi SiddhantSadangi commented Mar 31, 2025

What does this PR do?

Fixes #<issue_number>

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

Summary by Sourcery

Add support for Neptune Scale logger in PyTorch Lightning

New Features:

  • Introduce NeptuneScaleLogger as a new logging option for tracking experiments with Neptune Scale platform

Enhancements:

  • Extend logger infrastructure to support Neptune Scale integration
  • Add comprehensive documentation and usage examples for NeptuneScaleLogger

Documentation:

  • Update README with NeptuneScaleLogger example
  • Add documentation references for Neptune Scale logger

Tests:

  • Add comprehensive test suite for NeptuneScaleLogger
  • Implement test cases covering initialization, metric logging, hyperparameter logging, and other logger functionalities

Chores:

  • Update project configuration to include Neptune Scale logger
  • Modify changelog to reflect new logger addition

Copy link

sourcery-ai bot commented Mar 31, 2025

Reviewer's Guide by Sourcery

This pull request introduces the NeptuneScaleLogger to PyTorch Lightning, enabling users to log experiment data to Neptune Scale. It also updates the existing Neptune logger to support both the neptune and neptune-scale packages. The implementation includes comprehensive documentation, tests, and examples for the new logger.

Sequence diagram for logging metrics with NeptuneScaleLogger

sequenceDiagram
    participant LightningModule
    participant NeptuneScaleLogger
    participant Neptune Run

    LightningModule->>NeptuneScaleLogger: log_metrics(metrics, step)
    activate NeptuneScaleLogger
    NeptuneScaleLogger->>Neptune Run: log_metrics(metrics, step)
    activate Neptune Run
    Neptune Run-->>NeptuneScaleLogger: 
    deactivate Neptune Run
    NeptuneScaleLogger-->>LightningModule: 
    deactivate NeptuneScaleLogger
Loading

Sequence diagram for logging hyperparameters with NeptuneScaleLogger

sequenceDiagram
    participant LightningModule
    participant NeptuneScaleLogger
    participant Neptune Run

    LightningModule->>NeptuneScaleLogger: log_hyperparams(params)
    activate NeptuneScaleLogger
    NeptuneScaleLogger->>Neptune Run: log_configs(params)
    activate Neptune Run
    Neptune Run-->>NeptuneScaleLogger: 
    deactivate Neptune Run
    NeptuneScaleLogger-->>LightningModule: 
    deactivate NeptuneScaleLogger
Loading

File-Level Changes

Change Details Files
Introduces a new logger, NeptuneScaleLogger, for logging metrics and hyperparameters to Neptune Scale.
  • Adds NeptuneScaleLogger class.
  • Implements methods for logging hyperparameters and metrics.
  • Adds documentation for the new logger.
  • Adds tests for the new logger.
src/lightning/pytorch/loggers/neptune.py
tests/tests_pytorch/loggers/test_neptune.py
src/lightning/pytorch/loggers/__init__.py
src/lightning/pytorch/CHANGELOG.md
README.md
docs/source-pytorch/conf.py
docs/source-pytorch/visualize/supported_exp_managers.rst
requirements/pytorch/loggers.info
Updates the Neptune logger to handle both neptune and neptune-scale packages.
  • Adds a check for the neptune-scale package.
  • Updates the TYPE_CHECKING block to import from neptune_scale if available.
  • Adds conditional imports for type hinting based on the availability of neptune or neptune_scale.
src/lightning/pytorch/loggers/neptune.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @SiddhantSadangi - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Method _get_full_model_name immediately returns None, making the rest of its code unreachable. (link)

Overall Comments:

  • Consider adding a test case that initializes NeptuneScaleLogger with all possible arguments to ensure proper handling.
  • The _get_full_model_name method in NeptuneScaleLogger always returns None; is this intentional?
Here's what I looked at during the review
  • 🔴 General issues: 1 blocking issue, 3 other issues
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@SiddhantSadangi
Copy link
Member Author

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @SiddhantSadangi - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a test case that initializes NeptuneScaleLogger with all possible arguments to ensure compatibility.
  • The _get_full_model_name method in NeptuneScaleLogger always returns None; is this intentional?
Here's what I looked at during the review
  • 🟡 General issues: 5 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

)
trainer = Trainer(logger=neptune_scale_logger)

Access the Neptune Scale logger from any function (except the LightningModule *init*) to use its API for tracking advanced artifacts
Copy link

Choose a reason for hiding this comment

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

issue: Clarify logger vs. run

The documentation should refer to accessing the Neptune Scale run, not the logger. The logger is passed to the Trainer, while the run is obtained via logger.experiment.

neptune_scale_logger.log_metrics(data={"path/to/metadata": metadata}, step=step)
neptune_scale_logger.log_configs(data={"path/to/config": config})

Here's the full documentation for the :class:`~lightning.pytorch.loggers.NeptuneScaleLogger`.
Copy link

Choose a reason for hiding this comment

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

issue: Missing link to full documentation

The documentation promises a link to the full documentation for the NeptuneScaleLogger but doesn't provide one. Please add the appropriate link.

@SiddhantSadangi SiddhantSadangi merged commit 6a0ddf6 into master Mar 31, 2025
@SiddhantSadangi SiddhantSadangi deleted the ss/neptune_scale_integration branch May 20, 2025 09:22
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