physicsnemo开源程序是开源深度学习框架,用于使用最先进的 Physics-ML 方法构建、训练和微调深度学习模型
一、软件介绍
文末提供程序和源码下载
NVIDIA PhysicsNeMo 是一个开源深度学习框架,用于使用最先进的 SciML 方法构建、训练、微调和推理物理 AI 模型,以实现 AI4 科学和工程。PhysicsNeMo 提供 python 模块来构建可扩展和优化的训练和推理管道,以探索、开发、验证和部署将物理知识与数据相结合的 AI 模型,从而实现实时预测。无论您是在探索使用神经运算符、GNN 或转换器,还是对物理信息神经网络或两者之间的混合方法感兴趣,PhysicsNeMo 都为您提供了一个优化的堆栈,使您能够大规模训练模型。
二、更多关于 PhysicsNeMo
At a granular level, PhysicsNeMo is developed as modular functionality and therefore provides built-in composable modules that are packaged into few key components:
在细粒度层面上,PhysicsNeMo 是作为模块化功能开发的,因此提供了内置的可组合模块,这些模块被打包成几个关键组件:
Component 元件 | Description 描述 |
---|---|
physicsnemo.models | A collection of optimized, customizable, and easy-to-use families of model architectures such as Neural Operators, Graph Neural Networks, Diffusion models, Transformer models and many more 一系列经过优化、可自定义且易于使用的模型架构,例如 Neural Operators、Graph Neural Networks、Diffusion models、Transformer 模型等等 |
physicsnemo.datapipes | Optimized and scalable built-in data pipelines fine tuned to handle engineering and scientific data structures like point clouds, meshes etc 经过优化和可扩展的内置数据管道,经过微调,可处理工程和科学数据结构,如点云、网格等 |
physicsnemo.distributed | A distributed computing sub-module built on top of torch.distributed to enable parallel training with just a few steps基于 之上构建的分布式计算子模块 torch.distributed ,只需几步即可实现并行训练 |
physicsnemo.curator 物理nemo.curator | A sub-module to streamline and accelerate the data curation for engineering and scientific datasets for training and inference. (coming soon) 一个子模块,用于简化和加速用于训练和推理的工程和科学数据集的数据管理。(即将推出) |
physicsnemo.sym.geometry | A sub-module to handle geometry for DL training using the Constructive Solid Geometry modeling and CAD files in STL format. 一个子模块,用于使用构造实体几何建模和 STL 格式的 CAD 文件处理 DL 训练的几何图形。 |
physicsnemo.sym.eq physicsnemo.sym.eq 中 | A sub-module to use PDEs in your DL training with several implementations of commonly observed equations and easy ways for customization. 在 DL 训练中使用 PDE 的子模块,其中包含常见方程的多种实现和简单的自定义方法。 |
三、AI4Science Library AI4Science 图书馆
Usually, PhysicsNeMo is used either as:
通常,PhysicsNeMo 用作:
- A complementary tool to Pytorch when exploring AI for SciML and AI4Science applications.
在探索 SciML 和 AI4Science 应用程序的 AI 时,它是 Pytorch 的补充工具。 - A deep learning research platform that provides scale and optimal performance on NVIDIA GPUs.
一个深度学习研究平台,可在 NVIDIA GPU 上提供扩展和最佳性能。
Domain Specific Packages 特定于域的软件包
The following are packages dedicated for domain experts of specific communities catering to their unique exploration needs.
以下是专供特定社区的领域专家使用的软件包,可满足其独特的探索需求。
- PhysicsNeMo CFD: Inference sub-module of PhysicsNeMo to enable CFD domain experts to explore, experiment and validate using pretrained AI models for CFD use cases.
PhysicsNeMo CFD:PhysicsNeMo 的推理子模块,使 CFD 领域专家能够使用预训练的 AI 模型进行 CFD 用例的探索、实验和验证。 - Earth-2 Studio: Inference sub-module of PhysicsNeMo to enable climate researchers and scientists to explore and experiment with pretrained AI models for weather and climate.
Earth-2 Studio:PhysicsNeMo 的推理子模块,使气候研究人员和科学家能够探索和试验预先训练的天气和气候 AI 模型。
Elaborating Further: 进一步阐述:
四、Scalable GPU-optimized training Library可扩展的 GPU 优化训练库
PhysicsNeMo 提供了一个高度优化和可扩展的训练库,以最大限度地发挥 NVIDIA GPU 的功能。分布式计算实用程序允许通过几行代码从单个 GPU 高效扩展到多节点 GPU 集群,从而确保大规模。可以快速有效地训练基于物理的机器学习 (ML) 模型。该框架包括对 advanced.优化实用程序、量身定制的 DataPipes、验证实用程序,以提高端到端训练速度。
A suite of Physics Informed ML Models
一套基于物理学的 ML 模型
PhysicsNeMo offers a library of state-of-the-art models specifically designed for physics-ML applications. Users can build any model architecture using the underlying PyTorch layers and combine with curated PhysicsNeMo layers.
PhysicsNeMo 提供了一个专为物理 ML 应用程序设计的最先进模型库。用户可以使用底层 PyTorch 层构建任何模型架构,并与精选的 PhysicsNeMo 层相结合。
The Model Zoo includes optimized implementation of family of model architectures such as Neural Operators:
Model Zoo 包括一系列模型架构的优化实现,例如 Neural Operators:
- Fourier Neural Operators (FNOs)傅里叶神经运算符 (FNO)
- DeepONet 深度网络
- DoMINO 骨牌
- Graph Neural Networks (GNNs)图形神经网络 (GNN)
- MeshGraphNet MeshGraphNet 网格
- MeshGraphNet for Lagrangian用于拉格朗日的 MeshGraphNet
- XAeroNet XAeroNet 公司
- Diffusion Models 扩散模型
- Correction Diffusion Model校正扩散模型
- DDPM
- PhysicsNeMo GraphCast 物理 NeMo GraphCast
- Transsolver Transsolver (转译器)
- RNNs 循环神经网络
- SwinVRNN 斯温VRNN
- Physics-Informed Neural Networks (PINNs)物理信息神经网络 (PINN)
And many others. 还有许多其他人。
These models are optimized for various physics domains, such as computational fluid dynamics, structural mechanics, and electromagnetics. Users can download, customize, and build upon these models to suit their specific needs, significantly reducing the time required to develop high-fidelity simulations.
这些模型针对各种物理场域进行了优化,例如计算流体动力学、结构力学和电磁学。用户可以下载、自定义和构建这些模型以满足他们的特定需求,从而显著减少开发高保真仿真所需的时间。
Seamless PyTorch Integration
无缝 PyTorch 集成
PhysicsNeMo is built on top of PyTorch, providing a familiar and user-friendly experience for those already proficient with PyTorch. This includes a simple Python interface and modular design, making it easy to use PhysicsNeMo with existing PyTorch workflows. Users can leverage the extensive PyTorch ecosystem, including its libraries and tools while benefiting from PhysicsNeMo's specialized capabilities for physics-ML. This seamless integration ensures users can quickly adopt PhysicsNeMo without a steep learning curve.
PhysicsNeMo 构建在 PyTorch 之上,为已经精通 PyTorch 的用户提供了熟悉且用户友好的体验。这包括简单的 Python 接口和模块化设计,可以轻松地将 PhysicsNeMo 与现有的 PyTorch 工作流一起使用。用户可以利用广泛的 PyTorch 生态系统,包括其库和工具,同时受益于 PhysicsNeMo 的物理 ML 专业功能。这种无缝集成确保用户可以快速采用 PhysicsNeMo,而无需陡峭的学习曲线。
Easy Customization and Extension
轻松定制和扩展
PhysicsNeMo is designed to be highly extensible, allowing users to add new functionality with minimal effort. The framework provides Pythonic APIs for defining new physics models, geometries, and constraints, making it easy to extend its capabilities to new use cases. The adaptability of PhysicsNeMo is further enhanced by key features such as ONNX support for flexible model deployment, robust logging utilities for streamlined error handling, and efficient checkpointing to simplify model loading and saving.
PhysicsNeMo 被设计为高度可扩展,允许用户以最少的工作量添加新功能。该框架提供了用于定义新物理模型、几何图形和约束的 Pythonic API,使其功能可以轻松地扩展到新的使用案例。PhysicsNeMo 的适应性通过关键功能得到进一步增强,例如对灵活模型部署的 ONNX 支持、用于简化错误处理的强大日志记录实用程序以及用于简化模型加载和保存的高效检查点。
This extensibility ensures that PhysicsNeMo can adapt to the evolving needs of researchers and engineers, facilitating the development of innovative solutions in the field of physics-ML.
这种可扩展性确保 PhysicsNeMo 能够适应研究人员和工程师不断变化的需求,从而促进物理 ML 领域创新解决方案的开发。
Detailed information on features and capabilities can be found in the PhysicsNeMo documentation.
有关特性和功能的详细信息,请参阅 PhysicsNeMo 文档。
Reference samples cover a broad spectrum of physics-constrained and data-driven workflows to suit the diversity of use cases in the science and engineering disciplines.
参考示例涵盖了广泛的物理约束和数据驱动型工作流程,以适应科学和工程学科中的各种用例。
Tip 提示
Have questions about how PhysicsNeMo can assist you? Try our [Experimental] chatbot, PhysicsNeMo Guide, for answers.
对 PhysicsNeMo 如何为您提供帮助有疑问?试试我们的 [实验] 聊天机器人 PhysicsNeMo Guide 来寻找答案。
Hello world 世界您好
You can start using PhysicsNeMo in your PyTorch code as simple as shown here:
您可以在 PyTorch 代码中开始使用 PhysicsNeMo,如下所示:
python
>>> import torch
>>> from physicsnemo.models.mlp.fully_connected import FullyConnected
>>> model = FullyConnected(in_features=32, out_features=64)
>>> input = torch.randn(128, 32)
>>> output = model(input)
>>> output.shape
torch.Size([128, 64])
To use the distributed module, you can do the following (Example for distributed data parallel training. For a more in-depth tutorial refer PhysicsNeMo Distributed):
要使用分布式模块,您可以执行以下作(分布式数据并行训练示例。有关更深入的教程,请参阅 PhysicsNeMo Distributed):
import torch
from torch.nn.parallel import DistributedDataParallel
from physicsnemo.distributed import DistributedManager
from physicsnemo.models.mlp.fully_connected import FullyConnecteddef main():DistributedManager.initialize()dist = DistributedManager()arch = FullyConnected(in_features=32, out_features=64).to(dist.device)if dist.distributed:ddps = torch.cuda.Stream()with torch.cuda.stream(ddps):arch = DistributedDataParallel(arch,device_ids=[dist.local_rank],output_device=dist.device,broadcast_buffers=dist.broadcast_buffers,find_unused_parameters=dist.find_unused_parameters,)torch.cuda.current_stream().wait_stream(ddps)# Set up the optimizeroptimizer = torch.optim.Adam(arch.parameters(),lr=0.001,)def training_step(input, target):pred = arch(invar)loss = torch.sum(torch.pow(pred - target, 2))loss.backward()optimizer.step()return loss# Sample training loopfor i in range(20):# Random inputs and targets for simplicityinput = torch.randn(128, 32, device=dist.device)target = torch.randn(128, 64, device=dist.device)# Training steploss = training_step(input, target)if __name__ == "__main__":main()
To use the PDE module, you can do the following:
要使用 PDE 模块,您可以执行以下作:
>>> from physicsnemo.sym.eq.pdes.navier_stokes import NavierStokes
>>> ns = NavierStokes(nu=0.01, rho=1, dim=2)
>>> ns.pprint()
continuity: u__x + v__y
momentum_x: u*u__x + v*u__y + p__x + u__t - 0.01*u__x__x - 0.01*u__y__y
momentum_y: u*v__x + v*v__y + p__y + v__t - 0.01*v__x__x - 0.01*v__y__y
Who is using and contributing to PhysicsNeMo
谁在使用 PhysicsNeMo 并为 PhysicsNeMo 做出贡献
PhysicsNeMo is an open source project and gets contributions from researchers in the SciML and AI4science fields. While PhysicsNeMo team works on optimizing the underlying SW stack, the community collaborates and contributes model architectures, datasets, and reference applications so we can innovate in the pursuit of developing generalizable model architectures and algorithms.
PhysicsNeMo 是一个开源项目,得到了 SciML 和 AI4science 领域研究人员的贡献。当 PhysicsNeMo 团队致力于优化底层软件堆栈时,社区协作并贡献模型架构、数据集和参考应用程序,以便我们可以在开发通用模型架构和算法的过程中进行创新。
Some latest examples of community contributors are HP Labs 3D Printing team, Stanford Cardiovascular research team, UIUC team, CMU team etc.
社区贡献者的一些最新示例包括 HP Labs 3D 打印团队、斯坦福心血管研究团队、UIUC 团队、CMU 团队等。
Latest examples of research teams using PhysicsNeMo are ORNL team, TU Munich CFD team etc.
使用 PhysicsNeMo 的研究团队的最新示例是 ORNL 团队、TU Munich CFD 团队等。
Please navigate to this page for a complete list of research work leveraging PhysicsNeMo. For a list of enterprises using PhysicsNeMo refer PhysicsNeMo Webpage.
请导航到此页面以获取利用 PhysicsNeMo 的研究工作的完整列表。有关使用 PhysicsNeMo 的企业列表,请参阅 PhysicsNeMo 网页。
Using PhysicsNeMo and interested in showcasing your work on NVIDIA Blogs? Fill out this proposal form and we will get back to you!
使用 PhysicsNeMo 并有兴趣在 NVIDIA 博客上展示您的作品?请填写此提案表,我们会尽快回复您!
Why are they using PhysicsNeMo
他们为什么使用 PhysicsNeMo
Here are some of the key benefits of PhysicsNeMo for SciML model development:
以下是 PhysicsNeMo 用于 SciML 模型开发的一些主要优势:
四、Installation 安装
以下说明可帮助您安装基本 PhysicsNeMo 模块以开始使用。对于特定模型,还有其他可选依赖项,这些依赖项列在 optional dependencies 下。训练配方未打包到 pip 轮或容器中,以保持较低的占用空间。我们建议用户克隆适当的训练配方并将其用作起点。这些训练配方可能需要特定于使用案例的其他依赖项,并且它们附带要求文件。
PyPi
The recommended method for installing the latest version of PhysicsNeMo is using PyPi:
安装最新版本的 PhysicsNeMo 的推荐方法是使用 PyPi:
pip install nvidia-physicsnemo
The installation can be verified by running the hello world example.
可以通过运行 hello world 示例来验证安装。
Optional dependencies 可选依赖项
PhysicsNeMo has many optional dependencies that are used in specific components. When using pip, all dependencies used in PhysicsNeMo can be installed with pip install nvidia-physicsnemo[all]
. If you are developing PhysicsNeMo, developer dependencies can be installed using pip install nvidia-physicsnemo[dev]
. Otherwise, additional dependencies can be installed on a case by case basis. Detailed information on installing the optional dependencies can be found in the Getting Started Guide.
PhysicsNeMo 有许多用于特定组件的可选依赖项。使用 pip 时,PhysicsNeMo 中使用的所有依赖项都可以使用 pip install nvidia-physicsnemo[all]
.如果您正在开发 PhysicsNeMo,则可以使用 pip install nvidia-physicsnemo[dev]
.否则,可以根据具体情况安装其他依赖项。有关安装可选依赖项的详细信息,请参阅入门指南。
NVCR Container NVCR 容器
The recommended PhysicsNeMo docker image can be pulled from the NVIDIA Container Registry (refer to the NGC registry for the latest tag):
推荐的 PhysicsNeMo docker 镜像可以从 NVIDIA 容器注册表中提取(请参阅 NGC 注册表以获取最新标签):
docker pull nvcr.io/nvidia/physicsnemo/physicsnemo:25.03
Inside the container, you can clone the PhysicsNeMo git repositories and get started with the examples. The below command shows the instructions to launch the physicsnemo container and run examples from this repo.
在容器内,您可以克隆 PhysicsNeMo git 存储库并开始执行示例。以下命令显示了启动 physicsnemo 容器并运行此存储库中的示例的说明。
docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864 --runtime nvidia \
--rm -it nvcr.io/nvidia/physicsnemo/physicsnemo:25.03 bash
git clone https://github.com/NVIDIA/physicsnemo.git
cd physicsnemo/examples/cfd/darcy_fno/
pip install warp-lang # install NVIDIA Warp to run the darcy example
python train_fno_darcy.py
For enterprise supported NVAIE container, refer PhysicsNeMo Secured Feature Branch
有关企业支持的 NVAIE 容器,请参阅 PhysicsNeMo 安全功能分支
From Source 从源
Package 包
For a local build of the PhysicsNeMo Python package from source use:
对于来自源的 PhysicsNeMo Python 包的本地构建,请使用:
git clone git@github.com:NVIDIA/physicsnemo.git && cd physicsnemopip install --upgrade pip
pip install .
Source Container 源容器
To build PhysicsNeMo docker image:
要构建 PhysicsNeMo docker 镜像:
docker build -t physicsnemo:deploy \--build-arg TARGETPLATFORM=linux/amd64 --target deploy -f Dockerfile .
Alternatively, you can run make container-deploy
或者,您也可以运行 make container-deploy
To build CI image:
要构建 CI 映像:
docker build -t physicsnemo:ci \--build-arg TARGETPLATFORM=linux/amd64 --target ci -f Dockerfile .
Alternatively, you can run make container-ci
.
或者,您也可以运行 make container-ci
.
Currently, only linux/amd64
and linux/arm64
platforms are supported. If using linux/arm64
, some dependencies like warp-lang
might not install correctly.
目前,仅支持 linux/amd64
和 平台 linux/arm64
。如果使用 linux/arm64
,某些依赖项(如 warp-lang
)可能无法正确安装。
五、软件下载
夸克网盘分享
本文信息来源于GitHub作者地址:https://github.com/NVIDIA/physicsnemo