FPINNs / README.md
OneScience's picture
Upload folder using huggingface_hub
371b59f verified
|
Raw
History Blame Contribute Delete
4.88 kB
---
frameworks:
- pytorch
language:
- en
license: apache-2.0
tags:
- OneScience
- FPINNs
- fuzzy-physics-informed-neural-networks
- Allen-Cahn
- forward-problem
- inverse-problem
tasks:
- pde-solving
---
<p align="center">
<strong>
<span style="font-size: 30px;">FPINNs</span>
</strong>
</p>
# Model Overview
In this model package, FPINNs refers to Fuzzy Physics-Informed Neural Networks, not fractional PINNs. The architecture augments a fully connected network with a Gaussian fuzzy-membership branch and fuses neural features with fuzzy-rule features to predict solutions to partial differential equations.
The current example solves the Allen–Cahn equation:
```text
u_t - lambda_1 u_xx + lambda_2 (u^3 - u) = 0
```
Paper: Deep fuzzy physics-informed neural networks for forward and inverse PDE problems
https://doi.org/10.1016/j.neunet.2024.106750
# Model Description
FPINNs are trained jointly on data loss and PDE residuals and support both forward and inverse Allen–Cahn problems. The forward task predicts the spatiotemporal solution for known parameters `lambda_1=0.0001` and `lambda_2=5.0`; the inverse task jointly learns the equation solution and both parameters from observations. The model is trained with Adam by default, with optional L-BFGS refinement.
# Use Cases
| Use Case | Description |
| :---: | :--- |
| Forward Allen–Cahn problem | Predict the complete spatiotemporal solution using known diffusion and reaction parameters |
| Inverse Allen–Cahn problem | Identify diffusion and reaction parameters from solution observations |
| Fuzzy-feature research | Evaluate the fusion of neural features and Gaussian fuzzy-rule features |
| Pipeline validation | Validate training and inference using the bundled data and a small-scale configuration |
# Usage
## 1. OneCode
Use the online OneCode environment for an intelligent, one-click AI for Science (AI4S) programming experience:
[Launch OneCode for one-click AI4S programming](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
## 2. Manual Setup
**Hardware Requirements**
- A GPU or DCU is recommended for training and full-grid inference.
- A CPU can be used for small-scale pipeline validation.
- DCU users must install DTK and a PyTorch environment compatible with the target cluster.
### Download the Model Package
```bash
modelscope download --model OneScience/FPINNs --local_dir ./FPINNs
cd FPINNs
```
### Set Up the Runtime Environment
**DCU Environment**
```bash
# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
**GPU Environment**
```bash
# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai
```
### Training Data
The model package includes the Allen–Cahn data file `data/AC.mat`, which contains spatial coordinates, temporal coordinates, and the corresponding equation solution. The number of training samples and evaluation batch size can be adjusted in `conf/config.yaml`.
### Training
The training task is controlled by `common.task` in `conf/config.yaml`: `forward` selects the forward problem, while `inverse` selects the inverse problem. After configuring the task, run:
```bash
python scripts/train.py
```
Training checkpoints and histories are saved to the `weight/` and `result/` directories by default.
### Model Weights
This repository provides weights trained on the Allen–Cahn dataset in the `weight/` directory.
### Inference, Evaluation, and Visualization
After training the selected task, run:
```bash
python scripts/inference.py
```
The inference task is also controlled by `common.task`. Results are saved as `result/fpinn_forward.*` or `result/fpinn_inverse.*` by default. The inverse task additionally reports the recovered `lambda_1` and `lambda_2` values. Model, training, loss, and inference parameters can all be modified in `conf/config.yaml`.
# Official OneScience Resources
| Platform | OneScience Repository | Skills Repository |
| --- | --- | --- |
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
# Citations and License
- Wu, W., Duan, S., Sun, Y., Yu, Y., Liu, D., and Peng, D. Deep fuzzy physics-informed neural networks for forward and inverse PDE problems. Neural Networks, 181, 106750, 2025.
- This model package is released under the Apache-2.0 license and retains attribution to the original paper and data sources.