界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
开发与工程 · SKILL.md

inference

inference

【开发与工程】Repository operating skill for Flow Forecast saved-model inference, evaluation, TorchScript conversion, plots, and explainability.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: inference description: "Repository operating skill for Flow Forecast saved-model inference, evaluation, TorchScript conversion, plots, and explainability." disable-model-invocation: true metadata: disco-role: operating license: GPL 3.0

Inference

Use this sub-skill when the task is about loading a Flow Forecast model, running saved-model forecasts or classification inference, computing evaluation metrics, creating confidence-interval plots, exporting TorchScript, or using SHAP/Plotly explainability helpers.

Start with:

What This Sub-skill Covers

  • flood_forecast.deployment.inference.InferenceMode and load_model.
  • infer_now, infer_now_classification, and make_plots.
  • flood_forecast.evaluator.infer_on_torch_model, evaluate_model, and run_evaluation.
  • convert_to_torch_script and the currently placeholder convert_to_onnx.
  • Plotly confidence interval helpers and SHAP summary/heatmap routes.
  • Optional GCS upload/download and W&B logging behavior.

What Belongs Elsewhere

  • Data cleaning, datetime normalization, and loader schema validation belong in data-preparation.
  • Training configs, checkpoint creation, and loss/optimizer selection belong in training.
  • Catchment encoders, CrossViViT, NeuralODE, and GR4 hybrid model internals belong in multimodal-physics.

Typical Workflow

  1. Validate that the package imports and the desired model name is in the registry.
  2. Validate the CSV and inference config locally.
  3. Load the saved JSON config and checkpoint path.
  4. Use InferenceMode or infer_on_torch_model to run the forecast.
  5. Add plots, SHAP, W&B, or GCS only after the local forecast path works.

Operating Notes

  1. InferenceMode wraps load_model, which returns a PyTorchForecast instance.
  2. inference_params.dataset_params should use the test-time loader field names; use scaling for inference-time scaler construction.
  3. datetime_start can be a Python datetime; string parsing in low-level evaluator paths is more restrictive.
  4. num_prediction_samples triggers prediction-sample dataframes for confidence intervals.
  5. save_buck, save_name, wandb_proj, and GCS paths require external credentials and should not be enabled by default.

Shared References And Scripts

Non-goals

  • Do not use this as a cloud-serving infrastructure guide unrelated to Flow Forecast APIs.
  • Do not assume GCS or W&B credentials are present.
  • Do not require the original repository checkout to run an inference recipe.
我的收藏