QCPINN-CavityFlow

Model Introduction

This package reproduces the unsteady lid-driven cavity experiment in QCPINN: Quantum-Classical Physics-Informed Neural Networks for Solving PDEs, Table 3. The Angle-Cascade quantum-classical PINN maps (t, x, y) to (u, v, p). Sobol-sampled PDE and boundary points drive training; the author's reference field is used for validation and evaluation, not gradient updates.

Ten independent runs of 20,000 epochs were completed on CPU quantum simulation. The included weight/best_model.pt is the validation-selected checkpoint from seed 6, epoch 1, not a claim of paper-level accuracy. Only the reference-data path in its checkpoint metadata was changed for portability; all nine parameter tensors are unchanged. The published checkpoint SHA256 is 498bcc0dbfc053ca4824b1b6cd2914e85536d0aed1e07ad50d5ef3b4a0b11b87; the original training checkpoint SHA256 was f24e5f3357b045ed2a49fdb8a377cd3668a5cbb8100ff3c13906e3bfce9aff11.

Intended Use

Task Description
Cavity-flow field inference Predict velocity and pressure at spatiotemporal coordinates
PINN research Examine a quantum-classical Navier-Stokes training protocol

Usage

Download the Model Package

hf download OneScience-Group/QCPINN-CavityFlow --local-dir ./QCPINN-CavityFlow
cd QCPINN-CavityFlow

Install Dependencies

The formal run used Python 3.10, CPU PyTorch 2.6.0 and PennyLane 0.40.0. The +cpu PyTorch wheel requires the official CPU index:

conda create -n qcpinn-cavity python=3.10 -y
conda activate qcpinn-cavity
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install 'modelscope[datasets]'

Reference Data

Hugging Face hosts only the model package. Obtain the author's cavity.mat from OneScience/QCPINN-Cavity on ModelScope:

modelscope download --dataset OneScience/QCPINN-Cavity --local_dir ./data

The expected file is data/cavity.mat, SHA256 4010d55dc23aa0f8ba79b24baf75e3903044bc4333d772168121cd30bc95c3ba. It contains cavity_internal, cavity_gamma0, and cavity_gamma1 in MATLAB v7.3/HDF5 format. No external labeled training dataset is needed.

Train

From a fresh package copy on a SLURM compute cluster, with the Python environment activated:

sbatch scripts/run_all.slurm

The script runs ten seeds, 20,000 epochs per seed, then reloads checkpoints for inference and figures. Adjust the cluster's time/partition settings as needed. Preserve the bundled weight and results before retraining.

Inference and Results

python scripts/inference.py --checkpoint weight/best_model.pt
python scripts/result.py

The selected checkpoint's internal-field relative L2 errors for (u, v, p) were (123.70%, 121.43%, 164.19%). Across ten validation-best checkpoints, the means were (200.42%, 274.73%, 148.86%), versus (25.73%, 38.00%, 42.65%) in paper Table 3. The full training was completed, but the paper accuracy was not reproduced. Historical results/best_model/metrics.json records the original checkpoint hash; rerunning inference records the published checkpoint hash.

OneScience Repositories

Platform Main repository Skills repository
Gitee OneScience OneSkills
GitHub OneScience OneSkills

Citation and License

  • Paper: QCPINN.
  • Reference field: authors' QCPINN repository. The repository has an MIT software license; the data is distributed separately with its own provenance information.

中文说明

QCPINN-CavityFlow

模型简介

本模型包复现了QCPINN:求解 PDE 的量子–经典物理信息神经网络(physics-informed neural network,PINN)表 3 中的非稳态顶盖驱动方腔实验。Angle-Cascade 量子–经典物理信息神经网络将 (t, x, y) 映射至 (u, v, p)。训练采用 Sobol 采样的 PDE 和边界点。作者提供的参考场用于验证和评估,不用于梯度更新。

在 CPU 量子模拟上完成了十次独立运行,每次 20,000 轮。随附的 weight/best_model.pt 是验证选出的种子 6 第 1 轮模型权重(检查点)(checkpoint),并不代表达到论文精度。仅为移植而修改了其模型权重(检查点)元数据中的参考数据路径,全部九个参数张量保持不变。发布的模型权重(检查点)的 SHA256 为 498bcc0dbfc053ca4824b1b6cd2914e85536d0aed1e07ad50d5ef3b4a0b11b87,原始训练模型权重(检查点)的 SHA256 为 f24e5f3357b045ed2a49fdb8a377cd3668a5cbb8100ff3c13906e3bfce9aff11。

预期用途

任务 说明
方腔流场推理(inference) 预测时空坐标上的速度和压力
物理信息神经网络研究 研究量子–经典 Navier-Stokes 训练规约

使用方法

下载模型包

hf download OneScience-Group/QCPINN-CavityFlow --local-dir ./QCPINN-CavityFlow
cd QCPINN-CavityFlow

安装依赖

正式运行使用 Python 3.10、CPU PyTorch 2.6.0 和 PennyLane 0.40.0。+cpu PyTorch wheel 需要官方 CPU 索引。

conda create -n qcpinn-cavity python=3.10 -y
conda activate qcpinn-cavity
pip install -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install 'modelscope[datasets]'

参考数据

Hugging Face 仅托管模型包。请从 ModelScope 上的 OneScience/QCPINN-Cavity获取作者的 cavity.mat。

modelscope download --dataset OneScience/QCPINN-Cavity --local_dir ./data

预期文件为 data/cavity.mat,SHA256 为 4010d55dc23aa0f8ba79b24baf75e3903044bc4333d772168121cd30bc95c3ba。该文件采用 MATLAB v7.3/HDF5 格式,包含 cavity_internal、cavity_gamma0 和 cavity_gamma1。无需外部带标签的训练数据集。

训练

在 SLURM 计算集群上,从新的模型包副本运行,并先激活 Python 环境。

sbatch scripts/run_all.slurm

脚本运行十个种子,每个种子 20,000 轮,随后重新加载模型权重(检查点)进行推理与绘图。按需调整集群的时间和分区设置。重新训练前请保留随附权重及结果。

推理与结果

python scripts/inference.py --checkpoint weight/best_model.pt
python scripts/result.py

选定模型权重(检查点)的内部场 (u, v, p) 相对 L2 误差为 (123.70%, 121.43%, 164.19%)。十个验证最优模型权重(检查点)的均值为 (200.42%, 274.73%, 148.86%),论文表 3 中为 (25.73%, 38.00%, 42.65%)。已完成全部训练,但未复现论文精度。历史 results/best_model/metrics.json 记录的是原始模型权重(检查点)哈希。重新运行推理将记录发布的模型权重(检查点)哈希。

OneScience 仓库

平台 主仓库 Skills 仓库
Gitee OneScience OneSkills
GitHub OneScience OneSkills

引用与许可证

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

Paper for OneScience-Group/QCPINN-CavityFlow