Model Evaluation and Inference#

Model evaluation is a key step in AI model development to evaluate and validate the skill of AI surrogate models for their reliability as well as guide the model development for custom applications. Most of the AI training examples from PhysicsNeMo therefore come with an inference script that you can use for model evaluation.

Pretrained checkpoints for selected models are distributed on the NGC Catalog.

Additionally, to complement the inference scripts and checkpoints, PhysicsNeMo provides curated workflows for common downstream tasks for specific domains of CFD and Earth2 using PhysicsNeMo-CFD and Earth2Studio.

NVIDIA PhysicsNeMo-CFD is a sub-module of the NVIDIA PhysicsNeMo framework that provides the tools needed to integrate pretrained AI models into engineering and CFD workflows. Earth2Studio is a Python-based package designed to get you up and running with AI models for climate and weather simulations.

Let’s review a few hello-world examples from these domain-specific repositories.

External Aerodynamics Using DoMINO NIM#

The DoMINO NIM is a pretrained surrogate model for solution developers and researchers to simulate flow over an automobile using AI. Below we will use this NIM to run inference on a car geometry available from the open-source DrivAerML dataset.

Refer to the PhysicsNeMo-CFD Installation Guide for installing PhysicsNeMo-CFD.

from physicsnemo.cfd.inference.domino_nim import call_domino_nim
import subprocess

filenames = [
    "drivaer_202.stl",
]
urls = [
    "https://huggingface.co/datasets/neashton/drivaerml/resolve/main/run_202/drivaerml_202.stl",
]

for url, filename in zip(urls, filenames):
    subprocess.run(["wget", url, "-O", filename], check=True)

output_dict = call_domino_nim(
    stl_path="./drivaer_202.stl",
    inference_api_url="http://localhost:8000/v1/infer",
    data={
        "stream_velocity": "38.89",
        "stencil_size": "1",
        "point_cloud_size": "500000",
    },
    verbose=True,
)

For more in-depth tutorials and exploring other workflows, refer to the PhysicsNeMo-CFD Documentation.

Weather Prediction Using AI Models#

AI surrogate models trained on historical weather data (for example, ERA5 Data) work alongside numerical weather prediction models to provide fast, large-ensemble predictions. Below we will use a lightweight AI model called DLWP to predict a 10-day weather forecast initialized from the date of our choice.

Refer to the Earth2Studio Installation Guide for installing Earth2Studio.

from earth2studio.models.px import DLWP
from earth2studio.data import GFS
from earth2studio.io import NetCDF4Backend
from earth2studio.run import deterministic as run

model = DLWP.load_model(DLWP.load_default_package())
ds = GFS()
io = NetCDF4Backend("output.nc")

run(["2024-01-01"], 10, model, ds, io)

For more in-depth tutorials and exploring other workflows, refer to the Earth2Studio Documentation.