MeshGraphNet

Model Overview

MeshGraphNets is a graph neural network developed by DeepMind for mesh-based physical simulation. It rapidly predicts the dynamics of complex physical systems, including fluids, structures, and cloth.

Paper: Learning Mesh-Based Simulation with Graph Networks https://arxiv.org/abs/2010.03409

Model Description

MeshGraphNets uses an encoder–processor–decoder graph-network architecture trained on trajectories from fluid, structural, and cloth simulations to perform long-horizon dynamical simulation of complex physical systems.

Use Cases

Use Case Description
External flow prediction Predict velocity, pressure, and other flow variables at mesh nodes
Structural deformation simulation Predict the displacement, stress, and deformation of loaded structures
Cloth dynamics Simulate the motion of deformable objects such as flexible membranes and cloth
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 GPU or DCU is recommended.
  • 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/MeshGraphNet --local-dir ./MeshGraphNet 
cd MeshGraphNet 

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

The OneScience community provides the cylinder_flow dataset for training. Download it with the command below and verify that the data path in config/config.yaml is configured correctly:

hf download --repo-type dataset OneScience-Group/cylinder_flow --local-dir ./data

Training

Single GPU:

python scripts/train.py

Multiple GPUs:

torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py

Training saves .pth files under weight/checkpoints.

Model Weights

This repository will provide weights trained on the cylinder_flow dataset in the weights/ directory. The weights will be uploaded soon.

Inference

python scripts/inference.py

Inference results are saved to result/output/.

Evaluation and Visualization

python scripts/result.py

Official OneScience Resources

Citations and License


中文说明

模型概述

MeshGraphNets 是 DeepMind 开发的用于网格物理模拟的图神经网络,可快速预测流体、结构和织物等复杂物理系统的动力学。

论文《使用图网络学习基于网格的模拟》 https://arxiv.org/abs/2010.03409

模型描述

MeshGraphNets 采用编码器–处理器–解码器图网络架构,在流体、结构及织物模拟的轨迹上训练,对复杂物理系统进行长时间动力学模拟。

使用场景

使用场景 说明
外流场预测 预测网格节点处的速度、压力及其他流动变量
结构变形模拟 预测受载结构的位移、应力和变形
织物动力学 模拟柔性膜、织物等可变形物体的运动
ModelScope/OneCode 运行 下载独立模型包,安装依赖并运行提供的脚本

使用方法

1. OneCode

通过 OneCode 在线环境体验智能一键式 AI 科学计算(AI4S)编程。

启动 OneCode 体验一键 AI4S 编程

2. 手动配置

硬件要求

  • 建议使用 GPU 或 DCU。
  • DCU 用户必须提前安装 DTK。建议使用 DTK 25.04.2 或更高版本,或使用 OneScience 为目标集群推荐的版本。

下载模型包

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

配置运行环境

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

训练数据

OneScience 社区提供 cylinder_flow 数据集用于训练。使用以下命令下载,并确认 config/config.yaml 中的数据路径配置正确。

hf download --repo-type dataset OneScience-Group/cylinder_flow --local-dir ./data

训练

单 GPU

python scripts/train.py

多 GPU

torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py

训练将 .pth 文件保存到 weight/checkpoints 下。

模型权重

本仓库将在 cylinder_flow 数据集上训练得到的权重放在 weights/ 目录中提供。权重即将上传。

推理(inference)

python scripts/inference.py

推理结果保存至 result/output/。

评估与可视化

python scripts/result.py

OneScience 官方资源

引用与许可证

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

Paper for OneScience-Group/MeshGraphNet