Adaptive Refinment and Multiple Optimizer callbacks
* Implementing a callback to switch between optimizers during training * Implementing the R3Refinment for collocation points * Modify trainer -> dataloader is created or updated by calling `_create_or_update_loader` * Adding `add_points` routine to AbstractProblem so that new points can be added without resampling from scratch
This commit is contained in:
committed by
Nicola Demo
parent
5a4c114d48
commit
4d1187898f
@@ -9,9 +9,6 @@ class Trainer(pl.Trainer):
|
||||
|
||||
def __init__(self, solver, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
# get accellerator
|
||||
device = self._accelerator_connector._accelerator_flag
|
||||
|
||||
# check inheritance consistency for solver
|
||||
check_consistency(solver, SolverInterface)
|
||||
@@ -26,8 +23,15 @@ class Trainer(pl.Trainer):
|
||||
'in the provided locations.')
|
||||
|
||||
# TODO: make a better dataloader for train
|
||||
self._loader = DummyLoader(solver.problem.input_pts, device)
|
||||
self._create_or_update_loader()
|
||||
|
||||
# this method is used here because is resampling is needed
|
||||
# during training, there is no need to define to touch the
|
||||
# trainer dataloader, just call the method.
|
||||
def _create_or_update_loader(self):
|
||||
# get accellerator
|
||||
device = self._accelerator_connector._accelerator_flag
|
||||
self._loader = DummyLoader(self._model.problem.input_pts, device)
|
||||
|
||||
def train(self, **kwargs): # TODO add kwargs and lightining capabilities
|
||||
return super().fit(self._model, self._loader, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user