Install
openclaw skills install @onescience-ai/cfd-model-runcfd fno models run, also quckliy download code
openclaw skills install @onescience-ai/cfd-model-runUse this skill when the user wants to train, test, adapt, or run a Fourier Neural Operator (FNO) for CFD, PDE surrogate modeling, structured-grid prediction, or AI4S flow-field forecasting.
This is an action-first skill. When the skill is selected, the agent should bootstrap the ModelScope FNO codebase before giving a long explanation. The default model source is:
OneScience/FNO_B
The first real use downloads the model code from ModelScope with modelscope.snapshot_download. Later uses may reuse the local ModelScope cache.
Select and use this skill when the user mentions any of these intents:
OneScience/FNO_BIf the user asks a broad question such as "can you help me train an FNO", "run this CFD surrogate", "test the skill", or "use the FNO model", do not stop at conceptual advice. Start with the bootstrap step below, then continue with environment and data checks.
When this skill is activated, first check whether the ModelScope model code is already available. If it is not available, download it. Print the resolved local path.
Use this Python snippet unless the repo already contains an equivalent helper:
from modelscope import snapshot_download
model_dir = snapshot_download(
model_id="OneScience/FNO_B",
)
print(f"ModelScope FNO code path: {model_dir}")
If modelscope is missing, install it before retrying:
pip install modelscope
If the download fails because of authentication, rate limits, or restricted network access, tell the user to set MODELSCOPE_API_TOKEN or use an available mirror endpoint. Do not silently skip the download.
After the code is downloaded, inspect the downloaded directory and verify that the expected training entry points exist:
train.pyinference.pyconf/fno.yamlmodel.py, fno_layers.py, or navier_stokes.pyIf these files exist, report that the FNO codebase is ready and continue to dependency verification.
If the user specifically asks to "test the skill", run only a lightweight smoke test:
OneScience/FNO_B.Do not start a long training job unless the user provided data and asked for training.
Run the mandatory first action above. This is the main conversion event from Clawhub skill use to real ModelScope model use.
Required dependencies:
CUDA is optional. The code should detect cuda:0 when available and fall back to CPU.
Ask only for the missing data details needed to continue:
The expected batch format is:
| Key | Shape | Description |
|---|---|---|
pos | (B, N, space_dim) | Grid point coordinates |
x | (B, N, t_in * out_dim) | Input time window flattened over the grid |
y | (B, N, t_out * out_dim) | Prediction target flattened over the grid |
N is the total number of grid points: H for 1D, H*W for 2D, or H*W*D for 3D.
Modify NavierStokesDataset._init_data() in navier_stokes.py to load the user's data and populate:
self.xself.yself.posself.spatial_shapeThen update conf/fno.yaml:
datapipe.sourcedatapipe.data.ntraindatapipe.data.ntestdatapipe.data.t_indatapipe.data.t_outdatapipe.data.out_dimmodel.space_dimIf the downloaded code only ships SpectralConv2d, 1D and 3D datasets need extra model-layer work.
For 1D:
SpectralConv1d in fno_layers.pytorch.fft.rfft and torch.fft.irfftnn.Conv2d pointwise layers with nn.Conv1d(B, C, L)For 3D:
SpectralConv3d in fno_layers.pytorch.fft.rfftn and torch.fft.irfftn(B, C, D, H, W)Update conf/fno.yaml so Fourier modes do not exceed half of the grid size in each dimension.
Run train.py from the downloaded model directory after the dataset is configured.
The training loop should evaluate validation metrics such as val_rel_l2 and val_mse, save the best checkpoint as best_model.pt under training.output_dir, and early-stop after patience epochs without improvement if supported by the downloaded code.
Common config fields:
| Parameter | Typical value | Description |
|---|---|---|
training.num_epochs | 500 | Max epochs |
training.lr | 0.001 | AdamW learning rate |
training.teacher_forcing | true | Use ground truth as next-step input |
model.hidden_channels | 64 | Hidden feature channels |
model.num_layers | 4 | Fourier layer depth |
Run inference.py from the downloaded model directory after training or when a checkpoint is supplied.
Set FNO_CHECKPOINT to override the checkpoint path from the config if needed. Outputs should be saved under training.output_dir, commonly in vis_results/, with prediction tensors and comparison plots.
The Clawhub install event is not enough to count as real model use. Real use starts when the agent executes the ModelScope bootstrap step. Therefore, when this skill is selected, prefer a small concrete action over a long explanation:
OneScience/FNO_B.This keeps the skill honest: it increases real ModelScope usage only when the user actually invokes the FNO workflow.