Giter Club home page Giter Club logo

neuralsolvers's People

Contributors

jeyhun1 avatar maxxxzdn avatar nih23 avatar psteinb avatar raj-sutariya avatar stillerpatrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neuralsolvers's Issues

UserWarning in InitalCondition.py

https://github.com/ComputationalRadiationPhysics/NeuralSolvers/blob/2a9457257b35265d219db245eb765c6132559748/PINNFramework/InitalCondition.py#L28

/home/maxxxzdn/.local/lib/python3.8/site-packages/torch/nn/modules/loss.py:446: UserWarning: Using a target size (torch.Size([batch_size])) that is different to the input size (torch.Size([batch_size, 1])). This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
return F.mse_loss(input, target, reduction=self.reduction)

Using prediction = model(x).reshape(-1) solves the problem

Model is not saved

PINN.py, line 109: torch.save(self.pinn_loss.model.state_dict(), hpm_path)
self.pinn_loss is a function

Rework readme

The general idea of the framework is not well transported and should be better illustrated

mlp.py

.to(device) implementation does not work properly. Needs to be changed to following:

self.lb = self.lb.to(device)
self.ub = self.ub.to(device)

Weighting is not set correctly

In the HPMLoss the weighting is not set correctly.

super(HPMLoss, self).__init__(dataset, None, name, norm='L2', weight=1.)

should be

super(HPMLoss, self).__init__(dataset, None, name, norm='L2', weight=weight)

Time Measurement

At the moment there is no measurement of elapsed time per epoch and complete training time. That should be added soon.

HPM-Loss

Inherit from PDE Loss and implement the baviour of the HPM-loss

Give all loss terms the attribute name

At the moment only the boundary condtion has the attribute name. For the workflow of the framework it would be more consistent if all loss terms have a name.

The for loops for pretraining and main training are ignored

when choosing extremely small no. of samples , which lead that the len(no._of batches) of the dataset which is fed to the dataloader to be equal to zero, which makes the iteration loop to for i in range( 0,0, step): .. thats why the looping didn't work and the ic_loss wasn't calculated at the first place.
i would suggest creating a warning message when choosing a no. of samples which can make the length of the datasets yields to zero after the using of "//" operator.

the for loops are found in line 503 and 518 in the pinn.fit () function in the pinn.py file

benchmark suite

Implement benchmark suite with:

  • standard setups for various PDEs
  • default argument parser
  • switch of and on various PDEs by the argument list
  • logging
  • model saving depending on PDEs

Making logging more consistent

At the moment the logging is not very consistent. The weighted loss is uploaded to the logger one step earlier than the scalars. That should be changed by a consistent set of the epoch in the logger call:

for key, value in self.loss_log.items():
    logger.log_scalar(scalar=value / batch_counter, name=key, epoch=epoch+1)

vs:

logger.log_scalar(scalar=pinn_loss_sum / batch_counter, name=" Weighted PINN Loss", epoch=epoch)

Provide a seperate pretraining function

At the moment, you need to set the number of main training epochs to 0, activate the pretaining function, and deactivate lbfgs fine-tuning. Here it would be better to have a separate function that trains initial condition only. This helps to find a suitable architecture.

Tracking histogramms of loss terms

To keep track of gradient pathologies a tracking of the loss terms gradients is needed.
The logging should be done in the optimization process and can be activated by a separate flag in the fit function.

Extend the PINN function to accept only one boundary condition

the function PINNFramewrok.PINN(.., boundary_condition,...) only accepts as input argument for boundary_condition elements of the form boundary_condition= [bc1,bc2,.. ], but even for only one bc it requires the input to be [bc]. Otherwise it raises 'KeyError' because it cannot call the bc from its name without the list form.

Adding an opportunity too add model specific losses

Models like the GatedPINN uses a model specific loss in order to balance the utilization of the experts.
An option would be to give the model an attribute called loss.

In the PINN loss we can call the loss function with :

if hasattr(self.model, 'loss'):
    pinn_loss = pinn_loss + model.loss

HPM-loss

Inherit from PDE Loss and implement the baviour of the HPM-loss

Modularize fit function

Currently, the fit function is a very big function that includes tracking, fitting, parallelization, etc.
Here we should modularize the functionalities to get a more maintainable code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.