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

Add config to WandB #113

Open
wants to merge 3 commits into
base: divya/add-steplr
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ The config file has three main sections:
- `api_key`: (str) API key. The API key is masked when saved to config files.
- `wandb_mode`: (str) "offline" if only local logging is required. Default: "None".
- `prv_runid`: (str) Previous run ID if training should be resumed from a previous ckpt. *Default*: `None`.
- `log_params`: (List[str]) List of config parameters to save it in wandb logs. For example, to save learning rate from trainer config section, use "trainer_config.optimizer.lr" (provide the full path to the specific config parameter).
- `optimizer_name`: (str) Optimizer to be used. One of ["Adam", "AdamW"].
- `optimizer`
- `lr`: (float) Learning rate of type float. *Default*: 1e-3
Expand Down
6 changes: 0 additions & 6 deletions docs/config_centroid.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
8 changes: 1 addition & 7 deletions sleap_nn/training/model_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,7 @@ def train(self, trained_ckpts_path: Optional[str] = None):
)

if self.config.trainer_config.use_wandb:
for m in self.config.trainer_config.wandb.log_params:
list_keys = m.split(".")
key = list_keys[-1]
value = self.config[list_keys[0]]
for l in list_keys[1:]:
value = value[l]
wandb_logger.experiment.config.update({key: value})
wandb_logger.experiment.config.update(dict(self.config))
wandb_logger.experiment.config.update({"model_params": total_params})

except KeyboardInterrupt:
Expand Down
6 changes: 0 additions & 6 deletions tests/assets/minimal_instance/initial_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
6 changes: 0 additions & 6 deletions tests/assets/minimal_instance/training_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid: null
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
6 changes: 0 additions & 6 deletions tests/assets/minimal_instance_bottomup/initial_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
6 changes: 0 additions & 6 deletions tests/assets/minimal_instance_bottomup/training_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
6 changes: 0 additions & 6 deletions tests/assets/minimal_instance_centroid/initial_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
7 changes: 0 additions & 7 deletions tests/assets/minimal_instance_centroid/training_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ trainer_config:
wandb_mode: ''
api_key: ''
prv_runid:
log_params:
- trainer_config.optimizer_name
- trainer_config.optimizer.amsgrad
- trainer_config.optimizer.lr
- model_config.backbone_type
- model_config.backbone_type
- model_config.init_weights
optimizer_name: Adam
optimizer:
lr: 0.0001
Expand Down
Loading