Unverified Commit 0a570dbd authored by AleksanderWWW's avatar AleksanderWWW Committed by GitHub
Browse files

Neptune fix bug init run (#22836)



* [neptune] fix checkpoint bug with relative out_dir

* update imports

* reformat with black

* check neptune without imports

* fix typing-related issue

* run black on code

* use os.path.sep instead of raw \

* simplify imports and remove type annotation

* make ruff happy

* apply review suggestions

* replace run with with_id kwarg to run

* update imports to avoid deprecation warnings for the latest client

---------
Co-authored-by: default avatarkshitij12345 <kshitijkalambarkar@gmail.com>
parent d4d62846
...@@ -1220,6 +1220,10 @@ class NeptuneCallback(TrainerCallback): ...@@ -1220,6 +1220,10 @@ class NeptuneCallback(TrainerCallback):
self._run = None self._run = None
def _initialize_run(self, **additional_neptune_kwargs): def _initialize_run(self, **additional_neptune_kwargs):
try:
from neptune import init_run
from neptune.exceptions import NeptuneMissingApiTokenException, NeptuneMissingProjectNameException
except ImportError:
from neptune.new import init_run from neptune.new import init_run
from neptune.new.exceptions import NeptuneMissingApiTokenException, NeptuneMissingProjectNameException from neptune.new.exceptions import NeptuneMissingApiTokenException, NeptuneMissingProjectNameException
...@@ -1245,7 +1249,7 @@ class NeptuneCallback(TrainerCallback): ...@@ -1245,7 +1249,7 @@ class NeptuneCallback(TrainerCallback):
return return
if self._run and not self._is_monitoring_run and not self._force_reset_monitoring_run: if self._run and not self._is_monitoring_run and not self._force_reset_monitoring_run:
self._initialize_run(run=self._run_id) self._initialize_run(with_id=self._run_id)
self._is_monitoring_run = True self._is_monitoring_run = True
else: else:
self._initialize_run() self._initialize_run()
...@@ -1257,7 +1261,7 @@ class NeptuneCallback(TrainerCallback): ...@@ -1257,7 +1261,7 @@ class NeptuneCallback(TrainerCallback):
else: else:
if not self._run: if not self._run:
self._initialize_run( self._initialize_run(
run=self._run_id, with_id=self._run_id,
capture_stdout=False, capture_stdout=False,
capture_stderr=False, capture_stderr=False,
capture_hardware_metrics=False, capture_hardware_metrics=False,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment