-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Fixed NeptuneLogger support across different versions of neptune package #19131
Fixed NeptuneLogger support across different versions of neptune package #19131
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #19131 +/- ##
==========================================
- Coverage 83% 49% -34%
==========================================
Files 443 435 -8
Lines 36764 36616 -148
==========================================
- Hits 30617 17981 -12636
- Misses 6147 18635 +12488 |
_NEPTUNE_AVAILABLE = bool(RequirementCache("neptune>=1.0")) or bool(RequirementCache("neptune-client>=1.0")) | ||
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = bool(RequirementCache("neptune-client<1.0")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be converted to bools. This class overrides str providing a helpful error message to the users. See for instance the use in L227
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_NEPTUNE_AVAILABLE = bool(RequirementCache("neptune>=1.0")) or bool(RequirementCache("neptune-client>=1.0")) | |
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = bool(RequirementCache("neptune-client<1.0")) | |
_NEPTUNE_AVAILABLE = RequirementCache("neptune>=1.0") or RequirementCache("neptune-client>=1.0") | |
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = RequirementCache("neptune-client<1.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Raalsky What's the issue with having two separate variables each pointing to each class? (as in the current version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shouldn't be converted to bools. This class overrides str providing a helpful error message to the users. See for instance the use in L227
I've been trying during the development and I remember that this leads to two separate messages about the lack of one of the packages. The expected behavior is to raise/warn whenever none of neptune-client
/ neptune
was installed. This should be covered in: https://github.com/Lightning-AI/pytorch-lightning/pull/19131/files#diff-903c2ecc76f95d71b3f577baf15c47f0e629f6e2a4b201a344177e7908cfccd9R323
What's the issue with having two separate variables each pointing to each class? (as in the current version)
neptune
was introduced as a name transition of neptune-client
and the long-term target is to get rid of Neptune-client
package completely someday. It was introduced as a part of breaking-changes with a release of neptune-client==1.0
. neptune-client>=1.0
is just an alias of neptune
package and have some breaking-changes in compare to neptune-client<1.0.0
. We would like to still support all of the possible environments and package versions. The earlier approach was just "wrong" and had some misunderstandings of how the relationships between each of the packages looked like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the motivation, then this should work (see the suggestions posted too):
_NEPTUNE_AVAILABLE = RequirementCache("neptune>=1.0")
# neptune-client will be gone someday. additionally, version 1.0 had breaking changes to account for
_NEPTUNE_CLIENT_AVAILABLE = RequirementCache("neptune-client>=1.0")
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = RequirementCache("neptune-client<1.0")
_NEPTUNE_GREATER_EQUAL_1_0 = bool(_NEPTUNE_AVAILABLE or _NEPTUNE_CLIENT_AVAILABLE)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Raalsky thank you for your explanation. As we discontinued support also for older Torch version lest make the cut also here and since next feature release work neptune
package only
_NEPTUNE_AVAILABLE = bool(RequirementCache("neptune>=1.0")) or bool(RequirementCache("neptune-client>=1.0")) | ||
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = bool(RequirementCache("neptune-client<1.0")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the motivation, then this should work (see the suggestions posted too):
_NEPTUNE_AVAILABLE = RequirementCache("neptune>=1.0")
# neptune-client will be gone someday. additionally, version 1.0 had breaking changes to account for
_NEPTUNE_CLIENT_AVAILABLE = RequirementCache("neptune-client>=1.0")
_LEGACY_NEPTUNE_CLIENT_AVAILABLE = RequirementCache("neptune-client<1.0")
_NEPTUNE_GREATER_EQUAL_1_0 = bool(_NEPTUNE_AVAILABLE or _NEPTUNE_CLIENT_AVAILABLE)
@@ -223,7 +223,7 @@ def __init__( | |||
prefix: str = "training", | |||
**neptune_run_kwargs: Any, | |||
): | |||
if not _NEPTUNE_AVAILABLE and not _NEPTUNE_CLIENT_AVAILABLE: | |||
if not _NEPTUNE_AVAILABLE and not _LEGACY_NEPTUNE_CLIENT_AVAILABLE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not _NEPTUNE_AVAILABLE and not _LEGACY_NEPTUNE_CLIENT_AVAILABLE: | |
if not _NEPTUNE_AVAILABLE and not _NEPTUNE_CLIENT_AVAILABLE and not _LEGACY_NEPTUNE_CLIENT_AVAILABLE: |
note how the str(_NEPTUNE_AVAILABLE)
below is kept, so that it is suggested to install neptune>=1.0
@@ -319,6 +319,9 @@ def _verify_input_arguments( | |||
if run is not None and not isinstance(run, (Run, Handler)): | |||
raise ValueError("Run parameter expected to be of type `neptune.Run`, or `neptune.handler.Handler`.") | |||
|
|||
if isinstance(run, Handler) and not _NEPTUNE_AVAILABLE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, in all the places that currently check for _NEPTUNE_AVAILABLE, now you check _NEPTUNE_GREATER_EQUAL_1_0
because if I understood the motivation correctly, you don't care about neptune vs neptune-client but neptune<1.0 vs neptune>=1.0
@@ -335,12 +338,12 @@ def __getstate__(self) -> Dict[str, Any]: | |||
|
|||
def __setstate__(self, state: Dict[str, Any]) -> None: | |||
if _NEPTUNE_AVAILABLE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems strange import Neptune even Neptune is not available...
@@ -376,12 +379,12 @@ def training_step(self, batch, batch_idx): | |||
@rank_zero_experiment | |||
def run(self) -> "Run": | |||
if _NEPTUNE_AVAILABLE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a better, more desriptive name, as it is not about Neptune but version...
let's update or rebase after #19265 lands 🎏 |
|
GitGuardian id | Secret | Commit | Filename | |
---|---|---|---|---|
- | Generic High Entropy Secret | 78fa3af | tests/tests_app/utilities/test_login.py | View secret |
- | Base64 Basic Authentication | 78fa3af | tests/tests_app/utilities/test_login.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
Closing in favor of #19265 |
What does this PR do?
Fixes #18555
Before submitting
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
📚 Documentation preview 📚 : https://pytorch-lightning--19131.org.readthedocs.build/en/19131/