Skip to content
Snippets Groups Projects

Lightning acc

Merged Gokhan OZBULAK requested to merge lightning-acc into main
1 unresolved thread
3 files
+ 25
23
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -26,7 +26,7 @@ def run(
@@ -26,7 +26,7 @@ def run(
max_epochs: int,
max_epochs: int,
output_folder: pathlib.Path,
output_folder: pathlib.Path,
monitoring_interval: int | float,
monitoring_interval: int | float,
batch_chunk_count: int,
accumulate_grad_batches: int,
checkpoint: pathlib.Path | None,
checkpoint: pathlib.Path | None,
):
):
"""Fit a CNN model using supervised learning and save it to disk.
"""Fit a CNN model using supervised learning and save it to disk.
@@ -60,12 +60,13 @@ def run(
@@ -60,12 +60,13 @@ def run(
monitoring_interval
monitoring_interval
Interval, in seconds (or fractions), through which we should monitor
Interval, in seconds (or fractions), through which we should monitor
resources during training.
resources during training.
batch_chunk_count
accumulate_grad_batches
If this number is different than 1, then each batch will be divided in
Number of accumulations for backward propagation to accumulate gradients
this number of chunks. Gradients will be accumulated to perform each
over k batches before stepping the optimizer. The default of 1 forces
mini-batch. This is particularly interesting when one has limited RAM
the whole batch to be processed at once. Otherwise the batch is multiplied
on the GPU, but would like to keep training with larger batches. One
by accumulate-grad-batches pieces, and gradients are accumulated to complete
exchanges for longer processing times in this case.
each step. This is especially interesting when one is training on GPUs with
 
a limited amount of onboard RAM.
checkpoint
checkpoint
Path to an optional checkpoint file to load.
Path to an optional checkpoint file to load.
"""
"""
@@ -118,7 +119,7 @@ def run(
@@ -118,7 +119,7 @@ def run(
accelerator=accelerator,
accelerator=accelerator,
devices=devices,
devices=devices,
max_epochs=max_epochs,
max_epochs=max_epochs,
accumulate_grad_batches=batch_chunk_count,
accumulate_grad_batches=accumulate_grad_batches,
logger=tensorboard_logger,
logger=tensorboard_logger,
check_val_every_n_epoch=validation_period,
check_val_every_n_epoch=validation_period,
log_every_n_steps=len(datamodule.train_dataloader()),
log_every_n_steps=len(datamodule.train_dataloader()),
Loading