Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
medai
software
mednet
Merge requests
!40
Lightning acc
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Lightning acc
lightning-acc
into
main
Overview
4
Commits
5
Pipelines
3
Changes
8
1 unresolved thread
Hide all comments
Merged
Gokhan OZBULAK
requested to merge
lightning-acc
into
main
9 months ago
Overview
4
Commits
5
Pipelines
3
Changes
3
1 unresolved thread
Hide all comments
Expand
Closes
#25 (closed)
Edited
9 months ago
by
Daniel CARRON
0
0
Merge request reports
Compare
version 1
version 2
2e79aae0
9 months ago
version 1
cf742317
9 months ago
main (base)
and
latest version
latest version
96b8c28e
5 commits,
9 months ago
version 2
2e79aae0
4 commits,
9 months ago
version 1
cf742317
3 commits,
9 months ago
Show latest version
3 files
+
26
−
25
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/mednet/engine/trainer.py
+
9
−
8
Options
@@ -26,7 +26,7 @@ def run(
max_epochs
:
int
,
output_folder
:
pathlib
.
Path
,
monitoring_interval
:
int
|
float
,
batch_chunk_count
:
int
,
accumulate_grad_batches
:
int
,
checkpoint
:
pathlib
.
Path
|
None
,
):
"""
Fit a CNN model using supervised learning and save it to disk.
@@ -60,12 +60,13 @@ def run(
monitoring_interval
Interval, in seconds (or fractions), through which we should monitor
resources during training.
batch_chunk_count
If this number is different than 1, then each batch will be divided in
this number of chunks. Gradients will be accumulated to perform each
mini-batch. This is particularly interesting when one has limited RAM
on the GPU, but would like to keep training with larger batches. One
exchanges for longer processing times in this case.
accumulate_grad_batches
Number of accumulations for backward propagation to accumulate gradients
over k batches before stepping the optimizer. The default of 1 forces
the whole batch to be processed at once. Otherwise the batch is multiplied
by accumulate-grad-batches pieces, and gradients are accumulated to complete
each step. This is especially interesting when one is training on GPUs with
a limited amount of onboard RAM.
checkpoint
Path to an optional checkpoint file to load.
"""
@@ -118,7 +119,7 @@ def run(
accelerator
=
accelerator
,
devices
=
devices
,
max_epochs
=
max_epochs
,
accumulate_grad_batches
=
batch_chunk_count
,
accumulate_grad_batches
=
accumulate_grad_batches
,
logger
=
tensorboard_logger
,
check_val_every_n_epoch
=
validation_period
,
log_every_n_steps
=
len
(
datamodule
.
train_dataloader
()),
Loading