Skip to content

Commit a07d3e7

Browse files
authored
Merge pull request #42 from allenai/favyen/wandb-log-options
Add --no_log and --force_log options.
2 parents bc424fd + c46ea7f commit a07d3e7

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
@@ -78,6 +78,18 @@ def add_arguments_to_parser(self, parser: jsonargparse.ArgumentParser) -> None:
7878
help="Load best checkpoint from GCS for test/predict",
7979
default=False,
8080
)
81+
parser.add_argument(
82+
"--force_log",
83+
type=bool,
84+
help="Log to W&B even for test/predict",
85+
default=False,
86+
)
87+
parser.add_argument(
88+
"--no_log",
89+
type=bool,
90+
help="Disable W&B logging for fit",
91+
default=False,
92+
)
8193

8294
def before_instantiate_classes(self) -> None:
8395
"""Called before Lightning class initialization."""
@@ -93,7 +105,7 @@ def before_instantiate_classes(self) -> None:
93105
)
94106
)
95107

96-
if subcommand == "fit":
108+
if (subcommand == "fit" and not c.no_log) or c.force_log:
97109
# Add and configure WandbLogger as needed.
98110
if not c.trainer.logger:
99111
c.trainer.logger = jsonargparse.Namespace(
@@ -115,6 +127,7 @@ def before_instantiate_classes(self) -> None:
115127
}
116128
)
117129

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

0 commit comments

Comments
 (0)