Seeking Guidance on Training a MIONET Model with PINA #573
Replies: 2 comments 2 replies
-
Hi @reactingflow! Have you already checked the doc on MIONET (here)? Also, look at this minimal example below, adapted from the read me. I am reproducing the architecture of Fig.1 in the original paper with import torch
from pina import Trainer, LabelTensor
from pina.model import MIONet, FeedForward
from pina.solver import SupervisedSolver
from pina.problem.zoo import SupervisedProblem
input_tensor = LabelTensor(torch.rand((10, 3)), ["v1", "v2", "y"])
output_tensor = LabelTensor(torch.rand((10, 1)), ["u"])
# Step 1. Define problem
problem = SupervisedProblem(
input_tensor,
output_tensor,
input_variables=input_tensor.labels,
output_variables=output_tensor.labels,
)
# Step 2. Design MIONET
branch_net1 = FeedForward(input_dimensions=1, output_dimensions=10)
branch_net2 = FeedForward(input_dimensions=1, output_dimensions=10)
trunk_net = FeedForward(input_dimensions=1, output_dimensions=10)
networks = {branch_net1: ["v1"], branch_net2: ["v2"], trunk_net: ["y"]}
model = MIONet(networks=networks, reduction="+", aggregator="*")
# Step 3. Define Solver
solver = SupervisedSolver(problem, model)
# Step 4. Train
trainer = Trainer(solver, max_epochs=1000, accelerator="cpu")
trainer.train() Hope this helps! If you enjoy using PINA, consider leaving us a ⭐ — it really helps us grow the community. Thanks for your support! |
Beta Was this translation helpful? Give feedback.
-
Hi Dario, Thank you very much for your previous help and suggestions. Inspired by your example and the first case study in the MIONet paper, I’ve started developing a test case implementation of MIONet that I’d be happy to share with you and potentially contribute to the community as a tutorial or example. The idea is to make it accessible and educational for others who are getting started with operator learning tasks. However, while working on this, I encountered a recurring issue during training that I wanted to ask your opinion on. It seems to be related to network connectivity, and it often prevents the code from running properly. Specifically, when trying to download external data files (like those used in the PINA tutorials), I frequently receive a ConnectionRefusedError. Below is an excerpt of the error trace I get:
Also, once the model runs successfully, I am struggling with visualizing the results effectively — for instance, plotting predicted vs. true solutions, loss curves. If you have any sample scripts or tools you use regularly for visualizations in MIONet or similar models, I’d love to take a look! And here is the current testing code I am working on:
Looking forward to hearing your thoughts when you have time. Best regards, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I wanted to start by saying that I find PINA to be an exceptionally good software, offering a plethora of useful tools. Currently, I am learning how to use PINA to train a MIONET model. In my endeavor, I have searched for tutorial cases but haven't been able to find any that match my specific needs.
All of my inputs (three in total) are one-dimensional arrays, and the output is also one-dimensional. Could anyone here provide some guidance on how to quickly set up a MIONET model for training from scratch? Your help would be greatly appreciated as I'm really eager to move forward with my project.
Thank you very much in advance for your support and insights!
Best regards,
Beta Was this translation helpful? Give feedback.
All reactions