Skip to content

Commit

Permalink
Force execution of __init__.py on direct execution (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmos authored Jan 16, 2022
1 parent 127e6e2 commit f4dd42f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/nn_template/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# thus the logging configuration defined in the __init__.py must be called before
# the lightning import otherwise it has no effect.
# See https://github.com/PyTorchLightning/pytorch-lightning/issues/1503
#
# Force the execution of __init__.py if this file is executed directly.
lightning_logger = logging.getLogger("pytorch_lightning")
# Remove all handlers associated with the lightning logger.
for handler in lightning_logger.handlers[:]:
Expand Down
3 changes: 3 additions & 0 deletions src/nn_template/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from nn_core.model_logging import NNLogger
from nn_core.resume import resolve_ckpt, resolve_run_path, resolve_run_version

# Force the execution of __init__.py if this file is executed directly.
import nn_template # noqa

pylogger = logging.getLogger(__name__)

RESUME_MODES = {
Expand Down

0 comments on commit f4dd42f

Please sign in to comment.