?一、軟件介紹
文末提供程序和源碼下載
? ? ?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