Skip to content

Commit c46ea7f

Browse files
committed
Add --no_log and --force_log options.
--no_log can be used for debug runs that you don't want appearing on W&B, e.g. if there may be errors in the script that happen after the W&B run starts and you want to fix those first, or if reviewing a PR and testing the training to make sure it runs. --force_log can be used during `model test` to create W&B run so the metrics can be viewed there, the primary use case for now is if you log a confusion matrix, if it wasn't there during training or if val/test are different splits then it needs to be in W&B to visualize easily.
1 parent 2eaa136 commit c46ea7f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

rslp/lightning_cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ def add_arguments_to_parser(self, parser) -> None:
7777
help="Load best checkpoint from GCS for test/predict",
7878
default=False,
7979
)
80+
parser.add_argument(
81+
"--force_log",
82+
type=bool,
83+
help="Log to W&B even for test/predict",
84+
default=False,
85+
)
86+
parser.add_argument(
87+
"--no_log",
88+
type=bool,
89+
help="Disable W&B logging for fit",
90+
default=False,
91+
)
8092

8193
def before_instantiate_classes(self):
8294
"""Called before Lightning class initialization."""
@@ -92,7 +104,7 @@ def before_instantiate_classes(self):
92104
)
93105
)
94106

95-
if subcommand == "fit":
107+
if (subcommand == "fit" and not c.no_log) or c.force_log:
96108
# Add and configure WandbLogger as needed.
97109
if not c.trainer.logger:
98110
c.trainer.logger = jsonargparse.Namespace(
@@ -114,6 +126,7 @@ def before_instantiate_classes(self):
114126
}
115127
)
116128

129+
if subcommand == "fit" and not c.no_log:
117130
# Set the checkpoint directory to canonical GCS location.
118131
checkpoint_callback = None
119132
upload_wandb_callback = None

0 commit comments

Comments
 (0)