-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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
Fix bug with passing capture_* args to neptune callback #29041
Fix bug with passing capture_* args to neptune callback #29041
Conversation
What does this PR doThis PR aims to fix a bug that appears when using Cause of the problemThis is due to the fact, that in one of the methods those params have hardcoded values, but the kwargs passed to the constructor are also passed to that method. Therefore a SolutionBefore invoking the problematic method we want to make sure that the |
Thanks for opening this PR @AleksanderWWW! Let us know when you want a review 🤗 |
Thank you @amyeroberts ! Let me wait for my colleagues at Neptune to share their thoughts on my proposal 😃 |
capture_traceback=False, | ||
) | ||
self._is_monitoring_run = False | ||
with preserve_neptune_kwargs(callback=self): |
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.
I would recommend to override the params as a part of def _initialize_run
:
def _initialize_run(self, **additional_neptune_kwargs):
...
self._stop_run_if_exists()
try:
run_params = additional_neptune_kwargs.copy()
run_params.update(self._init_run_kwargs)
self._run = init_run(**run_params)
self._run_id = self._run["sys/id"].fetch()
except (NeptuneMissingProjectNameException, NeptuneMissingApiTokenException) as e:
raise NeptuneMissingConfiguration() from e
I'm not sure if I haven't done any typo etc. but I don't see a need to "preserve" these params.
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.
Actually by use case mentioned here: neptune-ai/neptune-client#1663 let's override with the user-provided parameters.
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.
But setting those capture_*
to False
is only required in one invocation of _initialize_run
. I'm not sure I understand
@@ -1187,6 +1186,9 @@ class NeptuneCallback(TrainerCallback): | |||
trial_params_key = "trial_params" | |||
trainer_parameters_key = "trainer_parameters" | |||
flat_metrics = {"train/epoch"} | |||
params_to_preserve = frozenset( |
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.
No need for this, right?
Hey @amyeroberts |
Hi @AleksanderWWW, what kind of structure would you propose for the files? |
@amyeroberts The root could be the already existing And btw. the PR is ready for review from the code owners' side 🚀 |
@AleksanderWWW OK, sounds like a good idea. We'd have to make all objects importable from the |
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.
Thanks for working on a fix!
Just a question about how this works
self._run = init_run(**self._init_run_kwargs, **additional_neptune_kwargs) | ||
run_params = additional_neptune_kwargs.copy() | ||
run_params.update(self._init_run_kwargs) | ||
self._run = init_run(**self._init_run_kwargs, **run_params) |
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 looks to me like it won't work. Because we're updating run_params
with self._init_run_kwargs
we're guaranteeing that all the keys in self._init_run_kwargs
are in run_params
i.e. we're passing the same argument twice to init_run
, which I'd expect to trigger an error.
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.
Yes, you are absolutely correct!. In fact, it should be just **run_params
in the init_run
call. My bad! Fixing rn :) Thank you for noticing
Will do :) |
The failing CI test |
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.
Thanks for fixing!
@amyeroberts will you merge it once the checks pass? 🚀 |
@AleksanderWWW A fix has been merged into main which should resolve this. Could you try rebasing to include this and trigger an new CI run? |
@amyeroberts Done 😃 |
What does this PR do?
Fixes # (issue)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.