Skip to main content

Description

Our package introduces Physics-Informed Neural Networks (PINNs) implemented using PyTorch. The standout feature is the incorporation of CUDA Graphs and JIT Compilers (TorchScript) for compiling models, resulting in significant performance gains up to 9x compared to the original TensorFlow v1 implementation.


Each subplot corresponds to a problem, with its iteration count displayed at the top. The logarithmic x-axis shows the speed-up factor w.r.t the original code in TensorFlow v1, and the y-axis illustrates the mean relative error.

For more information, please refer to our paper:

PINNs-Torch: Enhancing Speed and Usability of Physics-Informed Neural Networks with PyTorch. Reza Akbarian Bafghi, and Maziar Raissi. DLDE III, NeurIPS, 2023.

Installation

PINNs-Torch requires following dependencies to be installed:

Then, you can install PINNs-Torch itself via [pip]:

pip install pinnstorch

If you intend to introduce new functionalities or make code modifications, we suggest duplicating the repository and setting up a local installation:

git clone https://github.com/rezaakb/pinns-torch
cd pinns-torch

# [OPTIONAL] create conda environment
conda create -n myenv python=3.9
conda activate myenv

# install package
pip install -e .

Quick start

Explore a variety of implemented examples within the examples folder. To run a specific code, such as the one for the Navier-Stokes PDE, you can use:

python examples/navier_stokes/train.py

You can train the model using a specified configuration, like the one found in examples/navier_stokes/configs/config.yaml. Parameters can be overridden directly from the command line. For instance:

python examples/navier_stokes/train.py trainer.max_epochs=20 n_train=3000

To utilize our package, there are two primary options:

  • Implement your training structures using Hydra, as illustrated in our provided examples.
  • Directly incorporate our package to solve your custom problem.

For a practical guide on directly using our package to solve the Schrödinger PDE in a continuous forward problem, refer to our tutorial here: tutorials/0-Schrodinger.ipynb.

Data

The data located on the server and will be downloaded automatically upon running each example.

Contributing

As this is the first version of our package, there might be scope for enhancements and bug fixes. We highly value community contributions. If you find any issues, missing features, or unusual behavior during your usage of this library, please feel free to open an issue or submit a pull request on GitHub. For any queries, suggestions, or feedback, please send them to Reza Akbarian Bafghi at reza.akbarianbafghi@colorado.edu.

License

Distributed under the terms of the [BSD-3] license, "pinnstorch" is free and open source software.

Resources

We employed this template to develop the package, drawing from its structure and design principles. For a deeper understanding, we recommend visiting their GitHub repository. We also recommend consulting the official documentation of Hydra and PyTorch Lightning for additional insights.

Citation

If you find this useful in your research, please consider citing:

@inproceedings{
bafghi2023pinnstorch,
title={{PINN}s-Torch: Enhancing Speed and Usability of Physics-Informed Neural Networks with PyTorch},
author={Reza Akbarian Bafghi and Maziar Raissi},
booktitle={The Symbiosis of Deep Learning and Differential Equations III},
year={2023},
url={https://openreview.net/forum?id=nl1ZzdHpab}
}

Release files for pinnstorch 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pinnstorch 0.1.2
File Size Uploaded
pinnstorch-0.1.2.tar.gz 51.0 kB Details

Release files / pinnstorch-0.1.2.tar.gz

Download URL pinnstorch-0.1.2.tar.gz
Size 51.0 kB
Tags Source
SHA-256 checksum
How to use checksums
36f1444026a286b25135914f184f7342d6c5cb53193139df8f6a4a60526c0a39
BLAKE2b-256 checksum
How to use checksums
0d7aa439afcff551caf6c9688c175d538598277e6584722b6f3a9b1f4a3d8817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page