lightning
BatchSizeFinder(find_train_batch_size=True, find_validation_batch_size=False, find_test_batch_size=False, find_predict_batch_size=False, mode='power', steps_per_trial=3, init_val=2, max_trials=25, batch_arg_name='batch_size')
¶
Bases: BatchSizeFinder
Batch size finder setting the proper model training status as the current one from lightning seems bugged. It also allows to skip some batch size finding steps.
Parameters:
-
find_train_batch_size
(
bool
, default:True
) –Whether to find the training batch size.
-
find_validation_batch_size
(
bool
, default:False
) –Whether to find the validation batch size.
-
find_test_batch_size
(
bool
, default:False
) –Whether to find the test batch size.
-
find_predict_batch_size
(
bool
, default:False
) –Whether to find the predict batch size.
-
mode
(
str
, default:'power'
) –The mode to use for batch size finding. See
pytorch_lightning.callbacks.BatchSizeFinder
for more details. -
steps_per_trial
(
int
, default:3
) –The number of steps per trial. See
pytorch_lightning.callbacks.BatchSizeFinder
for more details. -
init_val
(
int
, default:2
) –The initial value for batch size. See
pytorch_lightning.callbacks.BatchSizeFinder
for more details. -
max_trials
(
int
, default:25
) –The maximum number of trials. See
pytorch_lightning.callbacks.BatchSizeFinder
for more details. -
batch_arg_name
(
str
, default:'batch_size'
) –The name of the batch size argument. See
pytorch_lightning.callbacks.BatchSizeFinder
for more details.
Source code in quadra/callbacks/lightning.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
scale_batch_size(trainer, pl_module)
¶
Scale the batch size.
Source code in quadra/callbacks/lightning.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
|
LightningTrainerBaseSetup(log_every_n_steps=1)
¶
Bases: Callback
Custom callback used to setup a lightning trainer with default options.
Parameters:
-
log_every_n_steps
(
int
, default:1
) –Default value for trainer.log_every_n_steps if the dataloader is too small.
Source code in quadra/callbacks/lightning.py
384 385 |
|
on_fit_start(trainer, pl_module)
¶
Called on every stage.
Source code in quadra/callbacks/lightning.py
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
__scale_batch_dump_params(trainer)
¶
Dump the parameters that need to be reset after the batch size finder..
Source code in quadra/callbacks/lightning.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
__scale_batch_reset_params(trainer, steps_per_trial)
¶
Reset the parameters that need to be reset after the batch size finder.
Source code in quadra/callbacks/lightning.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
__scale_batch_restore_params(trainer, params)
¶
Restore the parameters that need to be reset after the batch size finder.
Source code in quadra/callbacks/lightning.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|