Skip to content

Commit

Permalink
Refactor callbacks (#296)
Browse files Browse the repository at this point in the history
* remove configure_callbacks in favor of specifying them in the config

* remove callbacs from model

* patience --> null
  • Loading branch information
EthanMarx authored Oct 23, 2024
1 parent ab6aa8a commit b039e1b
Show file tree
Hide file tree
Showing 9 changed files with 977 additions and 1,238 deletions.
18 changes: 6 additions & 12 deletions projects/data/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 8 additions & 12 deletions projects/export/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

245 changes: 6 additions & 239 deletions projects/infer/poetry.lock

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions projects/plots/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 17 additions & 2 deletions projects/train/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ model:
weight_decay: 0.0
learning_rate: 0.000585
pct_lr_ramp: 0.115
# early stop
patience: null
data:
class_path: train.data.supervised.TimeDomainSupervisedAframeDataset
init_args:
Expand Down Expand Up @@ -83,6 +81,23 @@ trainer:
init_args:
# save_dir:
flush_logs_every_n_steps: 10
callbacks:
- class_path: lightning.pytorch.callbacks.EarlyStopping
init_args:
monitor: "valid_auroc"
mode: "max"
patience: null
# custom model checkpoint for saving and
# tracing best model at end of traiing
# that will be used for downstream export
- class_path: train.callbacks.ModelCheckpoint
init_args:
monitor: "valid_auroc"
mode: "max"
save_top_k: 1
save_last: true
auto_insert_metric_name: false
- class_path: train.callbacks.SaveAugmentedBatch
# uncomment below if you want to profile
# profiler:
# class_path: lightning.pytorch.profilers.PyTorchProfiler
Expand Down
19 changes: 17 additions & 2 deletions projects/train/configs/bbh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ model:
weight_decay: 0.0
learning_rate: 0.000585
pct_lr_ramp: 0.115
# early stop
patience: 50
data:
class_path: train.data.supervised.TimeDomainSupervisedAframeDataset
init_args:
Expand Down Expand Up @@ -85,6 +83,23 @@ trainer:
# save_dir:
flush_logs_every_n_steps: 10
name: "train_logs"
callbacks:
- class_path: lightning.pytorch.callbacks.EarlyStopping
init_args:
monitor: "valid_auroc"
mode: "max"
patience: null
# custom model checkpoint for saving and
# tracing best model at end of traiing
# that will be used for downstream export
- class_path: train.callbacks.ModelCheckpoint
init_args:
monitor: "valid_auroc"
mode: "max"
save_top_k: 1
save_last: true
auto_insert_metric_name: false
- class_path: train.callbacks.SaveAugmentedBatch
# uncomment below if you want to profile
# profiler:
# class_path: lightning.pytorch.profilers.PyTorchProfiler
Expand Down
20 changes: 19 additions & 1 deletion projects/train/configs/bns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ model:
learning_rate: 0.000585
pct_lr_ramp: 0.115
# early stop
patience: 50
patience: null
data:
class_path: train.data.supervised.SpectrogramDomainSupervisedAframeDataset
init_args:
Expand Down Expand Up @@ -87,6 +87,24 @@ trainer:
# save_dir:
flush_logs_every_n_steps: 10
name: "train_logs"

callbacks:
- class_path: lightning.pytorch.callbacks.EarlyStopping
init_args:
monitor: "valid_auroc"
mode: "max"
patience: 50
# custom model checkpoint for saving and
# tracing best model at end of traiing
# that will be used for downstream export
- class_path: train.callbacks.ModelCheckpoint
init_args:
monitor: "valid_auroc"
mode: "max"
save_top_k: 1
save_last: true
auto_insert_metric_name: false
- class_path: train.callbacks.SaveAugmentedBatch
# uncomment below if you want to profile
# profiler:
# class_path: lightning.pytorch.profilers.PyTorchProfiler
Expand Down
Loading

0 comments on commit b039e1b

Please sign in to comment.