PINNsformer

Model Overview

PINNsFormer is a Transformer-based physics-informed neural network framework developed by researchers at the Georgia Institute of Technology and Carnegie Mellon University. It enables rapid prediction of solutions to time-dependent partial differential equations and their associated physical fields.

Paper: PINNsFormer: A Transformer-Based Framework For Physics-Informed Neural Networks.

Model Description

PINNsFormer uses a Transformer encoder–decoder with multi-head attention to numerically solve time-dependent partial differential equations, including convection, reaction, wave, and Navier–Stokes equations.

Use Cases

Use Case Description
Time-dependent PDE solving Train a continuous-field surrogate constrained by physical residuals, boundary conditions, and initial conditions
Physics-informed neural network validation Rapidly validate the PINNsFormer network, loss functions, weight serialization, and inference pipeline
One-dimensional reaction equation example Generate target fields from an analytical solution for pipeline validation and error analysis
ModelScope/OneCode execution Download the standalone model package, install its dependencies, and run the provided scripts

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

2. Manual Setup

Hardware Requirements

  • A CPU can be used for small-scale pipeline validation.
  • A GPU or DCU is recommended for training on larger grids or for more epochs.
  • DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version for the target cluster, is recommended.

Download the Model Package

hf download OneScience-Group/PINNsformer --local-dir ./PINNsformer
cd PINNsformer

Set Up the Runtime Environment

DCU Environment

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU Environment

# 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
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

Training Data

To use real data, download it from the link below and set data.data_dir in conf/config.yaml to the correct path.

Source Link Extraction Code Destination
Baidu Netdisk https://pan.baidu.com/s/1pM4ICc6FJX5pLF7WEoozxQ?pwd=5gha 5gha convection/convection.mat and navier_stokes/cylinder_nektar_wake.mat

Training

python scripts/train.py

The default configuration uses a smaller grid and fewer L-BFGS iterations for rapid end-to-end validation. To restore the scale of the original example, edit conf/config.yaml:

data:
  x_num: 101
  t_num: 101

training:
  epochs: 500

Model Weights

This repository will provide PINNsFormer model weights in the weights/ directory. The weights will be uploaded soon.

Inference

python scripts/inference.py

Inference loads weight/1dreaction_pinnsformer.pt and saves:

result/prediction.npz

Evaluation and Visualization

python scripts/result.py

Official OneScience Resources

Citations and License


中文说明

模型概览

PINNsFormer 是由佐治亚理工学院和卡内基梅隆大学研究人员开发的基于 Transformer 的物理信息神经网络(physics-informed neural network (PINN))框架,可快速预测时变偏微分方程的解及相关物理场。

论文:PINNsFormer:基于 Transformer 的物理信息神经网络框架。

模型描述

PINNsFormer 使用具备多头注意力的 Transformer 编码器–解码器,对对流、反应、波动和 Navier–Stokes 等时变偏微分方程进行数值求解。

使用场景

使用场景 说明
时变 PDE 求解 训练受物理残差、边界条件和初始条件约束的连续场代理模型(surrogate model)
物理信息神经网络验证 快速验证 PINNsFormer 网络、损失函数、权重序列化和推理(inference)流程
一维反应方程示例 根据解析解生成目标场,用于流程验证及误差分析
ModelScope/OneCode 运行 下载独立模型包,安装依赖并运行提供的脚本

使用指南

1. OneCode

通过 OneCode 在线环境体验面向科学的人工智能(AI4S)智能一键编程。

启动 OneCode 以使用一键 AI4S 编程

2. 手动配置

硬件要求

  • 可使用 CPU 进行小规模流程验证。
  • 在较大网格上训练或需要更多训练轮次时,建议使用 GPU 或 DCU。
  • DCU 用户须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 推荐的适配目标集群的版本。

下载模型包

hf download OneScience-Group/PINNsformer --local-dir ./PINNsformer
cd PINNsformer

配置运行环境

DCU 环境

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is also supported
pip install onescience[cfd-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

GPU 环境

# 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
# Installation with uv is also supported
pip install onescience[cfd-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/  --trusted-host mirrors.onescience.ai

训练数据

如需使用真实数据,请通过以下链接下载,并将 conf/config.yaml 中的 data.data_dir 设为正确路径。

来源 链接 提取码 目标位置
百度网盘 https://pan.baidu.com/s/1pM4ICc6FJX5pLF7WEoozxQ?pwd=5gha 5gha convection/convection.mat 和 navier_stokes/cylinder_nektar_wake.mat

训练

python scripts/train.py

默认配置使用较小的网格和较少的 L-BFGS 迭代次数,以快速完成端到端验证。如需恢复原始示例的规模,请编辑 conf/config.yaml。

data:
  x_num: 101
  t_num: 101

training:
  epochs: 500

模型权重

本仓库将在 weights/ 目录中提供 PINNsFormer 模型权重。权重即将上传。

推理

python scripts/inference.py

推理加载 weight/1dreaction_pinnsformer.pt 并保存以下内容。

result/prediction.npz

评估与可视化

python scripts/result.py

OneScience 官方资源

引用与许可证

Downloads last month
25
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/PINNsformer