Skip to content
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

neptune online #1499

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytorch_lightning/loggers/neptune.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self,
api_key: Optional[str] = None,
project_name: Optional[str] = None,
close_after_fit: Optional[bool] = True,
offline_mode: bool = True,
offline_mode: bool = False,
experiment_name: Optional[str] = None,
upload_source_files: Optional[List[str]] = None,
params: Optional[Dict[str, Any]] = None,
Expand Down Expand Up @@ -140,7 +140,7 @@ def any_lightning_module_function_or_hook(...):
"namespace/project_name" for example "tom/minst-classification".
If None, the value of NEPTUNE_PROJECT environment variable will be taken.
You need to create the project in https://neptune.ai first.
offline_mode: Optional default True. If offline_mode=True no logs will be send
offline_mode: Optional default False. If offline_mode=True no logs will be send
to neptune. Usually used for debug and test purposes.
close_after_fit: Optional default True. If close_after_fit=False the experiment
will not be closed after training and additional metrics,
Expand Down
21 changes: 13 additions & 8 deletions tests/loggers/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
from tests.base import LightningTestModel


def _get_logger_args(logger_class, save_dir):
logger_args = {}
if 'save_dir' in inspect.getfullargspec(logger_class).args:
logger_args.update(save_dir=str(save_dir))
if 'offline_mode' in inspect.getfullargspec(logger_class).args:
logger_args.update(offline_mode=True)
return logger_args


@pytest.mark.parametrize("logger_class", [
TensorBoardLogger,
CometLogger,
Expand Down Expand Up @@ -40,10 +49,8 @@ def log_metrics(self, metrics, step):
super().log_metrics(metrics, step)
self.history.append((step, metrics))

if 'save_dir' in inspect.getfullargspec(logger_class).args:
logger = StoreHistoryLogger(save_dir=str(tmpdir))
else:
logger = StoreHistoryLogger()
logger_args = _get_logger_args(logger_class, tmpdir)
logger = StoreHistoryLogger(**logger_args)

trainer = Trainer(
max_epochs=1,
Expand Down Expand Up @@ -80,10 +87,8 @@ def test_loggers_pickle(tmpdir, monkeypatch, logger_class):
import atexit
monkeypatch.setattr(atexit, 'register', lambda _: None)

if 'save_dir' in inspect.getfullargspec(logger_class).args:
logger = logger_class(save_dir=str(tmpdir))
else:
logger = logger_class()
logger_args = _get_logger_args(logger_class, tmpdir)
logger = logger_class(**logger_args)

trainer = Trainer(
max_epochs=1,
Expand Down