FPINNs / README.md
Zhongning's picture
Add Chinese README section
f0bdf67 verified
|
Raw History Blame Contribute Delete
8.94 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
hf download OneScience-Group/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.
---
# 中文说明
## 模型概览
在本模型包中,FPINNs 指模糊物理信息神经网络(Fuzzy Physics-Informed Neural Networks),区别于分数阶 PINNs。该架构在全连接网络中加入高斯模糊隶属度分支,融合神经网络特征与模糊规则特征,以预测偏微分方程的解。
当前示例求解 Allen–Cahn 方程。
```text
u_t - lambda_1 u_xx + lambda_2 (u^3 - u) = 0
```
论文《用于正向和反向 PDE 问题的深度模糊物理信息神经网络》
https://doi.org/10.1016/j.neunet.2024.106750
## 模型描述
FPINNs 基于数据损失和 PDE 残差联合训练,支持 Allen–Cahn 正问题和反问题。正问题根据已知参数 `lambda_1=0.0001` 和 `lambda_2=5.0` 预测时空解,反问题根据观测联合学习方程解和两个参数。模型默认使用 Adam 训练,也可使用 L-BFGS 进一步优化。
## 使用场景
| 使用场景 | 说明 |
| :---: | :--- |
| Allen–Cahn 正问题 | 根据已知扩散和反应参数预测完整时空解 |
| Allen–Cahn 反问题 | 根据解的观测值识别扩散和反应参数 |
| 模糊特征研究 | 评估神经网络特征与高斯模糊规则特征的融合 |
| 流程验证 | 使用随附数据与小规模配置验证训练及推理(inference) |
## 使用方法
### 1. OneCode
在 OneCode 在线环境中体验智能一键 AI for Science(AI4S)编程。
[启动 OneCode,体验一键 AI4S 编程](https://web-2069360198568017922-iaaj.ksai.scnet.cn:58043/home)
### 2. 手动设置
**硬件要求**
- 建议使用 GPU 或 DCU 进行训练和全网格推理。
- 可使用 CPU 验证小规模流程。
- DCU 用户必须安装与目标集群兼容的 DTK 和 PyTorch 环境。
#### 下载模型包
```bash
hf download OneScience-Group/FPINNs --local-dir ./FPINNs
cd FPINNs
```
#### 配置运行环境
**DCU 环境**
```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 环境**
```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
```
#### 训练数据
模型包包含 Allen–Cahn 数据文件 `data/AC.mat`,其中包括空间坐标、时间坐标及对应的方程解。训练样本数和评估批大小可在 `conf/config.yaml` 中调整。
#### 训练
训练任务由 `common.task` 控制,该配置位于 `conf/config.yaml` 中。`forward` 选择正问题,`inverse` 选择反问题。完成任务配置后,运行以下命令。
```bash
python scripts/train.py
```
训练模型权重(检查点)(checkpoint)和训练历史默认保存至 `weight/` 和 `result/` 目录。
#### 模型权重
本仓库在 `weight/` 目录中提供基于 Allen–Cahn 数据集训练的权重。
#### 推理、评估与可视化
训练所选任务后,运行以下命令。
```bash
python scripts/inference.py
```
推理任务同样由 `common.task` 控制。结果默认保存为 `result/fpinn_forward.*` 或 `result/fpinn_inverse.*`。反问题任务还报告反演得到的 `lambda_1` 和 `lambda_2` 值。模型、训练、损失和推理参数均可在 `conf/config.yaml` 中修改。
## OneScience 官方资源
| 平台 | OneScience 仓库 | Skills 仓库 |
| --- | --- | --- |
| 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 |
## 引用与许可证
- 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.
- 本模型包采用 Apache-2.0 许可发布,并保留原始论文和数据来源的署名。