Update callbacks and tests (#482)
--------- Co-authored-by: giovanni <giovanni.canali98@yahoo.it>
This commit is contained in:
committed by
Nicola Demo
parent
6ae301622b
commit
632934f9cc
@@ -5,29 +5,32 @@ from pina.callback.processing_callback import PINAProgressBar
|
||||
from pina.problem.zoo import Poisson2DSquareProblem as Poisson
|
||||
|
||||
|
||||
# # make the problem
|
||||
# poisson_problem = Poisson()
|
||||
# boundaries = ['nil_g1', 'nil_g2', 'nil_g3', 'nil_g4']
|
||||
# n = 10
|
||||
# poisson_problem.discretise_domain(n, 'grid', locations=boundaries)
|
||||
# poisson_problem.discretise_domain(n, 'grid', locations='laplace_D')
|
||||
# model = FeedForward(len(poisson_problem.input_variables),
|
||||
# len(poisson_problem.output_variables))
|
||||
# make the problem
|
||||
poisson_problem = Poisson()
|
||||
boundaries = ["g1", "g2", "g3", "g4"]
|
||||
n = 10
|
||||
condition_names = list(poisson_problem.conditions.keys())
|
||||
poisson_problem.discretise_domain(n, "grid", domains=boundaries)
|
||||
poisson_problem.discretise_domain(n, "grid", domains="D")
|
||||
model = FeedForward(
|
||||
len(poisson_problem.input_variables), len(poisson_problem.output_variables)
|
||||
)
|
||||
|
||||
# # make the solver
|
||||
# solver = PINN(problem=poisson_problem, model=model)
|
||||
# make the solver
|
||||
solver = PINN(problem=poisson_problem, model=model)
|
||||
|
||||
|
||||
# def test_progress_bar_constructor():
|
||||
# PINAProgressBar(['mean'])
|
||||
def test_progress_bar_constructor():
|
||||
PINAProgressBar()
|
||||
|
||||
# def test_progress_bar_routine():
|
||||
# # make the trainer
|
||||
# trainer = Trainer(solver=solver,
|
||||
# callback=[
|
||||
# PINAProgressBar(['mean', 'laplace_D'])
|
||||
# ],
|
||||
# accelerator='cpu',
|
||||
# max_epochs=5)
|
||||
# trainer.train()
|
||||
# # TODO there should be a check that the correct metrics are displayed
|
||||
|
||||
def test_progress_bar_routine():
|
||||
# make the trainer
|
||||
trainer = Trainer(
|
||||
solver=solver,
|
||||
callbacks=[PINAProgressBar(["val", condition_names[0]])],
|
||||
accelerator="cpu",
|
||||
max_epochs=5,
|
||||
)
|
||||
trainer.train()
|
||||
# TODO there should be a check that the correct metrics are displayed
|
||||
|
||||
Reference in New Issue
Block a user