diff --git a/docs/source/tutorials/tutorial1/tutorial.html b/docs/source/tutorials/tutorial1/tutorial.html index d8010e1..3d8bffc 100644 --- a/docs/source/tutorials/tutorial1/tutorial.html +++ b/docs/source/tutorials/tutorial1/tutorial.html @@ -7544,7 +7544,10 @@ a.anchor-link {
-

Tutorial: Physics Informed Neural Networks on PINA

Open In Colab

+

Tutorial: Introductory Tutorial: Physics Informed Neural Networks with PINA

Open In Colab

+
+
⚠️ Before starting:

We assume you are already familiar with the concepts covered in the Getting started with PINA tutorials. If not, we strongly recommend reviewing them before exploring this advanced topic.

+
@@ -7555,64 +7558,12 @@ a.anchor-link {
-

In this tutorial, we will demonstrate a typical use case of PINA on a toy problem, following the standard API procedure.

-

-PINA API -

-

Specifically, the tutorial aims to introduce the following topics:

- -

These are the two main steps needed before starting the modelling optimization (choose model and solver, and train). We will show each step in detail, and at the end, we will solve a simple Ordinary Differential Equation (ODE) problem using the PINN solver.

+

In this tutorial, we will demonstrate a typical use case of PINA for Physics Informed Neural Network (PINN) training. We will cover the basics of training a PINN with PINA, if you want to go further into PINNs look at our dedicated tutorials on the topic.

+

Let's start by importing the useful modules:

- -
-
- - -
-
-
-
- - -
-
+
@@ -7628,54 +7579,46 @@ $$

except: IN_COLAB = False if IN_COLAB: - !pip install "pina-mathlab" + !pip install "pina-mathlab[tutorial]" import warnings +import torch +import matplotlib.pyplot as plt -from pina.problem import SpatialProblem, TimeDependentProblem +from pina import Trainer, Condition +from pina.problem import SpatialProblem +from pina.operator import grad +from pina.solver import PINN +from pina.model import FeedForward +from pina.optim import TorchOptimizer from pina.domain import CartesianDomain +from pina.callback import MetricTracker +from pina.equation import Equation, FixedValue warnings.filterwarnings("ignore") - - -class TimeSpaceODE(SpatialProblem, TimeDependentProblem): - - output_variables = ["u"] - spatial_domain = CartesianDomain({"x": [0, 1]}) - temporal_domain = CartesianDomain({"t": [0, 1]}) - - # other stuff ...
-
+
-
-
- @@ -7687,26 +7630,9 @@ $$

-
+
@@ -7947,35 +7834,82 @@ Input points labels: ['x'] +
+
+
+
+ + +
+
+
+ + +
+
+
+
+ + +
+
+
+ + @@ -7890,6 +7881,13 @@ and the AveragingNeuralOperator model. As done in the +
+
+ + @@ -7910,19 +7908,12 @@ and the AveragingNeuralOperator model. As done in the - -
-
@@ -7973,7 +7964,7 @@ var element = document.getElementById('247939a9-6568-4a72-bda0-641ef97df37c');
@@ -7985,7 +7976,7 @@ var element = document.getElementById('247939a9-6568-4a72-bda0-641ef97df37c');
@@ -8025,8 +8016,8 @@ Let's take a look at the training and testing error:

@@ -8039,7 +8030,7 @@ Testing error: 0.158
@@ -8050,15 +8041,16 @@ Testing error: 0.158
-

What's next?

Now you know how to solve a time dependent neural operator problem in PINA! There are multiple directions you can go now:

+

What's Next?

You have completed the tutorial on solving time-dependent PDEs using Neural Operators in PINA. Great job! Here are some potential next steps you can explore:

    -
  1. Train the network for longer or with different layer sizes and assert the final accuracy

    +
  2. Train the network for longer or with different layer sizes: Experiment with various configurations, such as adjusting the number of layers or hidden dimensions, to further improve accuracy and observe the impact on performance.

  3. -
  4. We left a more challenging dataset Data_KS2.mat where $A_k \in [-0.5, 0.5]$, $\ell_k \in [1, 2, 3]$, $\phi_k \in [0, 2\pi]$ for longer training

    +
  5. Use a more challenging dataset: Try using the more complex dataset Data_KS2.mat where $A_k \in [-0.5, 0.5]$, $\ell_k \in [1, 2, 3]$, and $\phi_k \in [0, 2\pi]$ for a more difficult task. This dataset may require longer training and testing.

  6. -
  7. Compare the performance between the different neural operators (you can even try to implement your favourite one!)

    +
  8. ... and many more...: Explore other models, such as the FNO, DeepOnet, or implement your own operator using the KernelNeuralOperator class to compare performance and find the best model for your task.

+

For more resources and tutorials, check out the PINA Documentation.

@@ -8066,6 +8058,6 @@ Testing error: 0.158 diff --git a/docs/source/tutorials/tutorial11/tutorial.html b/docs/source/tutorials/tutorial11/tutorial.html index 5b4e5b5..aa46e05 100644 --- a/docs/source/tutorials/tutorial11/tutorial.html +++ b/docs/source/tutorials/tutorial11/tutorial.html @@ -7544,11 +7544,13 @@ a.anchor-link {
-

Tutorial: PINA and PyTorch Lightning, training tips and visualizations

Open In Colab

+

Tutorial: Introduction to Trainer class

Open In Colab

In this tutorial, we will delve deeper into the functionality of the Trainer class, which serves as the cornerstone for training PINA Solvers.

The Trainer class offers a plethora of features aimed at improving model accuracy, reducing training time and memory usage, facilitating logging visualization, and more thanks to the amazing job done by the PyTorch Lightning team!

-

Our leading example will revolve around solving the SimpleODE problem, as outlined in the Introduction to PINA for Physics Informed Neural Networks training. If you haven't already explored it, we highly recommend doing so before diving into this tutorial.

-

Let's start by importing useful modules, define the SimpleODE problem and the PINN solver.

+

Our leading example will revolve around solving a simple regression problem where we want to approximate the following function with a Neural Net model $\mathcal{M}_{\theta}$: +$$y = x^3$$ +by having only a set of $20$ observations $\{x_i, y_i\}_{i=1}^{20}$, with $x_i \sim\mathcal{U}[-3, 3]\;\;\forall i\in(1,\dots,20)$.

+

Let's start by importing useful modules!

@@ -7567,18 +7569,15 @@ a.anchor-link { except: IN_COLAB = False if IN_COLAB: - !pip install "pina-mathlab" + !pip install "pina-mathlab[tutorial]" import torch import warnings -from pina import Condition, Trainer -from pina.solver import PINN +from pina import Trainer +from pina.solver import SupervisedSolver from pina.model import FeedForward -from pina.problem import SpatialProblem -from pina.operator import grad -from pina.domain import CartesianDomain -from pina.equation import Equation, FixedValue +from pina.problem.zoo import SupervisedProblem warnings.filterwarnings("ignore") @@ -7605,55 +7604,22 @@ a.anchor-link {
In [2]:
-
# defining the ode equation
-def ode_equation(input_, output_):
+
# defining the problem
+x_train = torch.empty((20, 1)).uniform_(-3, 3)
+y_train = x_train.pow(3) + 3 * torch.randn_like(x_train)
 
-    # computing the derivative
-    u_x = grad(output_, input_, components=["u"], d=["x"])
-
-    # extracting the u input variable
-    u = output_.extract(["u"])
-
-    # calculate the residual and return it
-    return u_x - u
-
-
-class SimpleODE(SpatialProblem):
-
-    output_variables = ["u"]
-    spatial_domain = CartesianDomain({"x": [0, 1]})
-
-    domains = {
-        "x0": CartesianDomain({"x": 0.0}),
-        "D": CartesianDomain({"x": [0, 1]}),
-    }
-
-    # conditions to hold
-    conditions = {
-        "bound_cond": Condition(domain="x0", equation=FixedValue(1.0)),
-        "phys_cond": Condition(domain="D", equation=Equation(ode_equation)),
-    }
-
-    # defining the true solution
-    def solution(self, pts):
-        return torch.exp(pts.extract(["x"]))
-
-
-# sampling for training
-problem = SimpleODE()
-problem.discretise_domain(1, "random", domains=["x0"])
-problem.discretise_domain(20, "lh", domains=["D"])
+problem = SupervisedProblem(x_train, y_train)
 
 # build the model
 model = FeedForward(
     layers=[10, 10],
     func=torch.nn.Tanh,
-    output_dimensions=len(problem.output_variables),
-    input_dimensions=len(problem.input_variables),
+    output_dimensions=1,
+    input_dimensions=1,
 )
 
-# create the PINN object
-pinn = PINN(problem, model)
+# create the SupervisedSolver object
+solver = SupervisedSolver(problem, model, use_lt=False)
 
@@ -7667,7 +7633,7 @@ a.anchor-link {
@@ -7679,7 +7645,7 @@ can be initialized by simiply passing the PINN solver

In [3]:
-
trainer = Trainer(solver=pinn)
+
trainer = Trainer(solver=solver)
 
@@ -7692,6 +7658,13 @@ can be initialized by simiply passing the PINN solver

+
+
+ + @@ -7719,7 +7692,7 @@ can be initialized by simiply passing the PINN solver

-
-
- -
-
- - @@ -7819,24 +7789,25 @@ can be initialized by simiply passing the PINN solver

from lightning.pytorch.loggers import TensorBoardLogger
 
-# three run of training, by default it trains for 1000 epochs
+# three run of training, by default it trains for 1000 epochs, we set the max to 100
 # we reinitialize the model each time otherwise the same parameters will be optimized
 for _ in range(3):
     model = FeedForward(
         layers=[10, 10],
         func=torch.nn.Tanh,
-        output_dimensions=len(problem.output_variables),
-        input_dimensions=len(problem.input_variables),
+        output_dimensions=1,
+        input_dimensions=1,
     )
-    pinn = PINN(problem, model)
+    solver = SupervisedSolver(problem, model, use_lt=False)
     trainer = Trainer(
-        solver=pinn,
+        solver=solver,
         accelerator="cpu",
         logger=TensorBoardLogger(save_dir="training_log"),
         enable_model_summary=False,
         train_size=1.0,
         val_size=0.0,
         test_size=0.0,
+        max_epochs=100,
     )
     trainer.train()
 
@@ -7851,46 +7822,7 @@ can be initialized by simiply passing the PINN solver

- - - - - @@ -7917,19 +7849,26 @@ var element = document.getElementById('3c79fc12-0197-4b55-bd48-3e471be28efc');
@@ -7993,7 +7978,7 @@ var element = document.getElementById('0ba179f6-fcc7-4775-af21-2ffeb47a945f');
@@ -8005,40 +7990,18 @@ var element = document.getElementById('0ba179f6-fcc7-4775-af21-2ffeb47a945f');
-

as you can see, by default, PINA logs the losses which are shown in the progress bar, as well as the number of epochs. You can always insert more loggings by either defining a callback (more on callbacks), or inheriting the solver and modify the programs with different hooks (more on hooks).

-
-
- - -
-
- - -
-
-
-
- -
@@ -8078,7 +8041,7 @@ Lightning has a callback system to execute them when needed. Callbacks should ca
-

Let's see the results when applyed to the SimpleODE problem. You can define callbacks when initializing the Trainer by the callbacks argument, which expects a list of callbacks.

+

Let's see the results when applied to the problem. You can define callbacks when initializing the Trainer by using the callbacks argument, which expects a list of callbacks.

@@ -8093,12 +8056,12 @@ Lightning has a callback system to execute them when needed. Callbacks should ca
model = FeedForward(
     layers=[10, 10],
     func=torch.nn.Tanh,
-    output_dimensions=len(problem.output_variables),
-    input_dimensions=len(problem.input_variables),
+    output_dimensions=1,
+    input_dimensions=1,
 )
-pinn = PINN(problem, model)
+solver = SupervisedSolver(problem, model, use_lt=False)
 trainer = Trainer(
-    solver=pinn,
+    solver=solver,
     accelerator="cpu",
     logger=True,
     callbacks=[NaiveMetricTracker()],  # adding a callbacks
@@ -8106,6 +8069,7 @@ Lightning has a callback system to execute them when needed. Callbacks should ca
     train_size=1.0,
     val_size=0.0,
     test_size=0.0,
+    max_epochs=10,  # training only for 10 epochs
 )
 trainer.train()
 
@@ -8120,6 +8084,13 @@ Lightning has a callback system to execute them when needed. Callbacks should ca
+
You are using the plain ModelCheckpoint callback. Consider using LitModelCheckpoint which with seamless uploading to Model registry.
+
+
+
+
+
+
GPU available: False, used: False
 
@@ -8140,26 +8111,19 @@ Lightning has a callback system to execute them when needed. Callbacks should ca
-
-
Missing logger folder: /home/runner/work/PINA/PINA/tutorials/tutorial11/lightning_logs
-
-
-
-
-
-
+
@@ -8197,15 +8161,9 @@ var element = document.getElementById('8aaf4f60-47e8-4bd6-9cb3-e61ef0110c23');
@@ -8217,8 +8175,8 @@ var element = document.getElementById('8aaf4f60-47e8-4bd6-9cb3-e61ef0110c23');
-

PyTorch Lightning also has some built in Callbacks which can be used in PINA, here an extensive list.

-

We can for example try the EarlyStopping routine, which automatically stops the training when a specific metric converged (here the train_loss). In order to let the training keep going forever set max_epochs=-1.

+

PyTorch Lightning also has some built-in Callbacks which can be used in PINA, here is an extensive list.

+

We can, for example, try the EarlyStopping routine, which automatically stops the training when a specific metric converges (here the train_loss). In order to let the training keep going forever, set max_epochs=-1.

@@ -8233,12 +8191,12 @@ var element = document.getElementById('8aaf4f60-47e8-4bd6-9cb3-e61ef0110c23');
model = FeedForward(
     layers=[10, 10],
     func=torch.nn.Tanh,
-    output_dimensions=len(problem.output_variables),
-    input_dimensions=len(problem.input_variables),
+    output_dimensions=1,
+    input_dimensions=1,
 )
-pinn = PINN(problem, model)
+solver = SupervisedSolver(problem, model, use_lt=False)
 trainer = Trainer(
-    solver=pinn,
+    solver=solver,
     accelerator="cpu",
     max_epochs=-1,
     enable_model_summary=False,
@@ -8261,6 +8219,13 @@ var element = document.getElementById('8aaf4f60-47e8-4bd6-9cb3-e61ef0110c23');
 
+
 
 
@@ -8330,16 +8295,16 @@ We use the model = FeedForward( layers=[10, 10], func=torch.nn.Tanh, - output_dimensions=len(problem.output_variables), - input_dimensions=len(problem.input_variables), + output_dimensions=1, + input_dimensions=1, ) -pinn = PINN(problem, model) +solver = SupervisedSolver(problem, model, use_lt=False) trainer = Trainer( - solver=pinn, + solver=solver, accelerator="cpu", deterministic=True, # setting deterministic=True ensure reproducibility when a seed is imposed - max_epochs=2000, + max_epochs=500, enable_model_summary=False, callbacks=[Timer()], ) # adding a callbacks @@ -8364,6 +8329,13 @@ We use the
+
You are using the plain ModelCheckpoint callback. Consider using LitModelCheckpoint which with seamless uploading to Model registry.
+
+
+ +
+ + @@ -8384,26 +8356,26 @@ We use the - @@ -8416,7 +8388,7 @@ var element = document.getElementById('7011d2a2-b434-4b6f-82ec-45a209372a18');
@@ -8436,15 +8408,15 @@ var element = document.getElementById('7011d2a2-b434-4b6f-82ec-45a209372a18'); model = FeedForward( layers=[10, 10], func=torch.nn.Tanh, - output_dimensions=len(problem.output_variables), - input_dimensions=len(problem.input_variables), + output_dimensions=1, + input_dimensions=1, ) -pinn = PINN(problem, model) +solver = SupervisedSolver(problem, model, use_lt=False) trainer = Trainer( - solver=pinn, + solver=solver, accelerator="cpu", deterministic=True, - max_epochs=2000, + max_epochs=500, enable_model_summary=False, callbacks=[Timer(), StochasticWeightAveraging(swa_lrs=0.005)], ) # adding StochasticWeightAveraging callbacks @@ -8469,6 +8441,13 @@ var element = document.getElementById('7011d2a2-b434-4b6f-82ec-45a209372a18');
+
+
+ + @@ -8489,12 +8468,12 @@ var element = document.getElementById('7011d2a2-b434-4b6f-82ec-45a209372a18');
- @@ -8508,14 +8487,14 @@ var element = document.getElementById('4d5a6175-b347-40ad-95f4-7eaf88566c7a'); @@ -8528,10 +8507,10 @@ var element = document.getElementById('4d5a6175-b347-40ad-95f4-7eaf88566c7a');
@@ -8549,14 +8528,14 @@ This is because by default StochasticWeightAveraging will be activa model = FeedForward( layers=[10, 10], func=torch.nn.Tanh, - output_dimensions=len(problem.output_variables), - input_dimensions=len(problem.input_variables), + output_dimensions=1, + input_dimensions=1, ) -pinn = PINN(problem, model) +solver = SupervisedSolver(problem, model, use_lt=False) trainer = Trainer( - solver=pinn, + solver=solver, accelerator="cpu", - max_epochs=2000, + max_epochs=500, enable_model_summary=False, gradient_clip_val=0.1, # clipping the gradient callbacks=[Timer(), StochasticWeightAveraging(swa_lrs=0.005)], @@ -8582,6 +8561,13 @@ This is because by default StochasticWeightAveraging will be activa
+
+
+ + @@ -8602,12 +8588,12 @@ This is because by default StochasticWeightAveraging will be activa
- @@ -8621,14 +8607,14 @@ var element = document.getElementById('4e5ab008-430b-409c-817b-9d6db52b6eb0'); @@ -8641,16 +8627,19 @@ var element = document.getElementById('4e5ab008-430b-409c-817b-9d6db52b6eb0');
-

As we can see we by applying gradient clipping we were able to even obtain lower error!

-

What's next?

Now you know how to use efficiently the Trainer class PINA! There are multiple directions you can go now:

+

As we can see, by applying gradient clipping, we were able to achieve even lower error!

+

What's Next?

Now you know how to use the Trainer class efficiently in PINA! There are several directions you can explore next:

    -
  1. Explore training times on different devices (e.g.) TPU

    +
  2. Explore Training on Different Devices: Test training times on various devices (e.g., TPU) to compare performance.

  3. -
  4. Try to reduce memory cost by mixed precision training and gradient accumulation (especially useful when training Neural Operators)

    +
  5. Reduce Memory Costs: Experiment with mixed precision training and gradient accumulation to optimize memory usage, especially when training Neural Operators.

  6. -
  7. Benchmark Trainer speed for different precisions.

    +
  8. Benchmark Trainer Speed: Benchmark the training speed of the Trainer class for different precisions to identify potential optimizations.

    +
  9. +
  10. ...and many more!: Consider expanding to multi-GPU setups or other advanced configurations for large-scale training.

+

For more resources and tutorials, check out the PINA Documentation.

@@ -8658,6 +8647,6 @@ var element = document.getElementById('4e5ab008-430b-409c-817b-9d6db52b6eb0'); diff --git a/docs/source/tutorials/tutorial12/tutorial.html b/docs/source/tutorials/tutorial12/tutorial.html index b34b5f3..03267fd 100644 --- a/docs/source/tutorials/tutorial12/tutorial.html +++ b/docs/source/tutorials/tutorial12/tutorial.html @@ -7517,46 +7517,16 @@ a.anchor-link {
-

Tutorial: The Equation Class

Open In Colab

-
-
- - -
-
- - -
-
-
-
- - -
-
-
-
- -
+ +
+
+ + +
+
+
+ +
+
+ + +
+
+
+ + @@ -8029,6 +8022,13 @@ are applied to input coordinates and then passed through the same fully-connecte + @@ -8125,18 +8125,19 @@ var element = document.getElementById('becbb018-84a3-4bdf-b652-1b6d5a2ff019');
@@ -8144,6 +8145,6 @@ var element = document.getElementById('becbb018-84a3-4bdf-b652-1b6d5a2ff019'); diff --git a/docs/source/tutorials/tutorial14/tutorial.html b/docs/source/tutorials/tutorial14/tutorial.html index e2fcd5e..5d54218 100644 --- a/docs/source/tutorials/tutorial14/tutorial.html +++ b/docs/source/tutorials/tutorial14/tutorial.html @@ -3,7 +3,34 @@ -tutorial +tutorial + + + + + + + + + + + +
+
+ +
+ +
+
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+
+ +
+
+ + + diff --git a/docs/source/tutorials/tutorial16/tutorial.html b/docs/source/tutorials/tutorial16/tutorial.html new file mode 100644 index 0000000..68a069a --- /dev/null +++ b/docs/source/tutorials/tutorial16/tutorial.html @@ -0,0 +1,8156 @@ + + + + + +tutorial + + + + + + + + + + + + +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
+ +
+
+ +
+ +
+
+ +
+
+ +
+ + +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+
+ + diff --git a/docs/source/tutorials/tutorial17/tutorial.html b/docs/source/tutorials/tutorial17/tutorial.html new file mode 100644 index 0000000..1da0242 --- /dev/null +++ b/docs/source/tutorials/tutorial17/tutorial.html @@ -0,0 +1,8499 @@ + + + + + +tutorial + + + + + + + + + + + + +
+
+ +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+
+ + + diff --git a/docs/source/tutorials/tutorial18/tutorial.html b/docs/source/tutorials/tutorial18/tutorial.html new file mode 100644 index 0000000..e44f7a5 --- /dev/null +++ b/docs/source/tutorials/tutorial18/tutorial.html @@ -0,0 +1,8004 @@ + + + + + +tutorial + + + + + + + + + + + + +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+
+ +
+
+ + + diff --git a/docs/source/tutorials/tutorial19/tutorial.html b/docs/source/tutorials/tutorial19/tutorial.html new file mode 100644 index 0000000..6c6f7ec --- /dev/null +++ b/docs/source/tutorials/tutorial19/tutorial.html @@ -0,0 +1,8233 @@ + + + + + +tutorial + + + + + + + + + + + + +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+ + +
+
+ +
+
+ + diff --git a/docs/source/tutorials/tutorial2/tutorial.html b/docs/source/tutorials/tutorial2/tutorial.html index 92225e6..7e50103 100644 --- a/docs/source/tutorials/tutorial2/tutorial.html +++ b/docs/source/tutorials/tutorial2/tutorial.html @@ -7544,7 +7544,7 @@ a.anchor-link {
-

Tutorial: Two dimensional Poisson problem using Extra Features Learning

Open In Colab

+

Tutorial: Enhancing PINNs with Extra Features to solve the Poisson Problem

Open In Colab

This tutorial presents how to solve with Physics-Informed Neural Networks (PINNs) a 2D Poisson problem with Dirichlet boundary conditions. We will train with standard PINN's training, and with extrafeatures. For more insights on extrafeature learning please read An extended physics informed neural network for preliminary analysis of parametric optimal control problems.

First of all, some useful imports.

@@ -7566,7 +7566,7 @@ a.anchor-link { except: IN_COLAB = False if IN_COLAB: - !pip install "pina-mathlab" + !pip install "pina-mathlab[tutorial]" import torch import matplotlib.pyplot as plt @@ -7610,7 +7610,7 @@ u = 0 \text{ on } \Gamma_1 \cup \Gamma_2 \cup \Gamma_3 \cup \Gamma_4, \end{equation} where $D$ is a square domain $[0,1]^2$, and $\Gamma_i$, with $i=1,...,4$, are the boundaries of the square.

The Poisson problem is written in PINA code as a class. The equations are written as conditions that should be satisfied in the corresponding domains. The solution -is the exact solution which will be compared with the predicted one. If interested in how to write problems see this tutorial.

+is the exact solution which will be compared with the predicted one. If interested in how to write problems see this tutorial.

We will directly import the problem from pina.problem.zoo, which contains a vast list of PINN problems and more.

@@ -7730,6 +7730,13 @@ They are: ['g1', 'g2', 'g3', 'g4', 'D']
+
You are using the plain ModelCheckpoint callback. Consider using LitModelCheckpoint which with seamless uploading to Model registry.
+
+
+
+
+
+
GPU available: False, used: False
 
@@ -7750,19 +7757,12 @@ They are: ['g1', 'g2', 'g3', 'g4', 'D']
-
-
Missing logger folder: /home/runner/work/PINA/PINA/tutorials/tutorial2/lightning_logs
-
-
-
-
-
-
+
@@ -7783,7 +7783,7 @@ var element = document.getElementById('21603e2d-ac88-4b39-9dab-afa97865b91b');
@@ -7857,7 +7857,7 @@ The solution predicted by the neural network is plotted on the left, the exact o
-No description has been provided for this image +No description has been provided for this image
@@ -7971,6 +7971,13 @@ The set of input variables to the neural network is:

+
You are using the plain ModelCheckpoint callback. Consider using LitModelCheckpoint which with seamless uploading to Model registry.
+
+
+
+
+
+
GPU available: False, used: False
 
@@ -7991,12 +7998,12 @@ The set of input variables to the neural network is:

-
+
@@ -8043,7 +8050,7 @@ We can easily note that now our network, having almost the same condition as bef
@@ -8141,6 +8148,13 @@ Their implementation is quite trivial: by using the class torch.nn.Paramet
+
+
+ + @@ -8161,12 +8175,12 @@ Their implementation is quite trivial: by using the class torch.nn.Paramet
@@ -8424,6 +8446,6 @@ var element = document.getElementById('a93ab4ce-a973-4a51-8357-d48f59c50c97'); diff --git a/docs/source/tutorials/tutorial20/tutorial.html b/docs/source/tutorials/tutorial20/tutorial.html new file mode 100644 index 0000000..a3646f5 --- /dev/null +++ b/docs/source/tutorials/tutorial20/tutorial.html @@ -0,0 +1,8030 @@ + + + + + +tutorial + + + + + + + + + + + + +
+ + + + + + + + +
+ + + diff --git a/docs/source/tutorials/tutorial21/tutorial.html b/docs/source/tutorials/tutorial21/tutorial.html new file mode 100644 index 0000000..8db72c2 --- /dev/null +++ b/docs/source/tutorials/tutorial21/tutorial.html @@ -0,0 +1,8014 @@ + + + + + +tutorial + + + + + + + + + + + + +
+ + + + + + +
+ + + diff --git a/docs/source/tutorials/tutorial3/tutorial.html b/docs/source/tutorials/tutorial3/tutorial.html index 44c63ce..20e1c3c 100644 --- a/docs/source/tutorials/tutorial3/tutorial.html +++ b/docs/source/tutorials/tutorial3/tutorial.html @@ -7544,8 +7544,8 @@ a.anchor-link { @@ -7566,7 +7566,7 @@ a.anchor-link { except: IN_COLAB = False if IN_COLAB: - !pip install "pina-mathlab" + !pip install "pina-mathlab[tutorial]" import torch import matplotlib.pyplot as plt @@ -7593,18 +7593,7 @@ a.anchor-link { - - - - - - - - - - @@ -7999,19 +7961,19 @@ var element = document.getElementById('41671991-3a89-4a34-bbcc-76999f526715'); @@ -8023,10 +7985,12 @@ var element = document.getElementById('41671991-3a89-4a34-bbcc-76999f526715'); @@ -8121,6 +8085,13 @@ var element = document.getElementById('41671991-3a89-4a34-bbcc-76999f526715'); + @@ -8222,7 +8193,7 @@ var element = document.getElementById('40c29b39-b220-4bdf-baca-d9c01271286d'); @@ -8233,17 +8204,21 @@ var element = document.getElementById('40c29b39-b220-4bdf-baca-d9c01271286d'); @@ -8251,6 +8226,6 @@ var element = document.getElementById('40c29b39-b220-4bdf-baca-d9c01271286d'); diff --git a/docs/source/tutorials/tutorial4/tutorial.html b/docs/source/tutorials/tutorial4/tutorial.html index 34a3638..cd619d9 100644 --- a/docs/source/tutorials/tutorial4/tutorial.html +++ b/docs/source/tutorials/tutorial4/tutorial.html @@ -7544,7 +7544,7 @@ a.anchor-link { @@ -7556,16 +7556,6 @@ a.anchor-link { - - - - - - - - - - - @@ -7895,7 +7867,7 @@ Filter output data has shape: torch.Size([1, 1, 169, 3]) @@ -7942,17 +7914,7 @@ Filter output data has shape: torch.Size([1, 1, 169, 3]) - - - @@ -8848,18 +8720,8 @@ var element = document.getElementById('35bf8e3a-c090-41af-9004-c2bc3a722c6f'); - - - @@ -8922,7 +8784,7 @@ var element = document.getElementById('35bf8e3a-c090-41af-9004-c2bc3a722c6f'); @@ -8956,96 +8818,24 @@ var element = document.getElementById('35bf8e3a-c090-41af-9004-c2bc3a722c6f'); - - - - @@ -7643,7 +7633,7 @@ $$

@@ -7674,7 +7664,7 @@ $$

@@ -7686,7 +7676,7 @@ $$

@@ -7714,7 +7704,7 @@ $$

@@ -7757,6 +7747,13 @@ $$

+ - @@ -7852,7 +7842,7 @@ var element = document.getElementById('45125ed1-65fd-4354-9bb9-99178857ecb2'); @@ -7918,6 +7908,13 @@ Final error testing 28.49% + @@ -8001,8 +7999,8 @@ var element = document.getElementById('37bde5a3-2428-410f-b662-7ee2a91e2d4e'); @@ -8015,7 +8013,7 @@ Final error testing 3.58% @@ -8026,7 +8024,16 @@ Final error testing 3.58% @@ -8034,6 +8041,6 @@ Final error testing 3.58% diff --git a/docs/source/tutorials/tutorial6/tutorial.html b/docs/source/tutorials/tutorial6/tutorial.html index a75032b..b102a31 100644 --- a/docs/source/tutorials/tutorial6/tutorial.html +++ b/docs/source/tutorials/tutorial6/tutorial.html @@ -7517,7 +7517,7 @@ a.anchor-link { @@ -7742,7 +7743,7 @@ tensor([[2.1158, 2.5328], @@ -7812,7 +7813,7 @@ tensor([[2.1158, 2.5328], @@ -7923,7 +7924,7 @@ tensor([[2.1158, 2.5328], @@ -7964,7 +7965,7 @@ tensor([[2.1158, 2.5328], @@ -7991,17 +7992,6 @@ tensor([[2.1158, 2.5328], - - - - @@ -7652,7 +7640,7 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th @@ -7664,7 +7652,7 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th @@ -7693,28 +7681,7 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th - - - - @@ -7804,7 +7753,7 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th @@ -7828,9 +7777,8 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th # fit the pod basis trainer.data_module.setup("fit") # set up the dataset -x_train = trainer.data_module.train_dataset.conditions_dict["data"][ - "target" -] # extract data for training +train_data = trainer.data_module.train_dataset.get_all_data() +x_train = train_data["data"]["target"] # extract data for training pod_nn.fit_pod(x=x_train) # now train @@ -7847,6 +7795,13 @@ The dataset is composed by 500 snapshots of the velocity (along $x$, $y$, and th + @@ -7957,8 +7907,8 @@ var element = document.getElementById('4e45c6e0-34a5-49d6-b093-e133f1ca6f8d'); @@ -7971,18 +7921,7 @@ var element = document.getElementById('4e45c6e0-34a5-49d6-b093-e133f1ca6f8d'); - - - @@ -8113,18 +8032,11 @@ var element = document.getElementById('4e45c6e0-34a5-49d6-b093-e133f1ca6f8d'); - - - - - - - - @@ -7749,10 +7725,11 @@ $u(x) \approx u_{\theta}(x)=NN_{\theta}(v(x))$.

@@ -7764,19 +7741,13 @@ would indicate a periodicity of $2$ in $x$, $3$ in $y$, and so on...