Skip to content

CLI Reference

AnyPINN ships a single command, anypinn create, that scaffolds a complete, runnable PINN project from one of the built-in templates.

Installation

uv tool install anypinn
pipx install anypinn
uvx anypinn create my-project

Quick start

anypinn create my-project

This launches an interactive wizard that asks for:

  1. Template -- which ODE/PDE to solve (16 options)
  2. Data source -- synthetic or csv
  3. Direction -- forward or inverse (PDE templates only)
  4. Lightning -- include PyTorch Lightning wrapper or not

The wizard creates a project directory, installs dependencies, and starts training automatically.

Non-interactive mode

Skip all prompts with flags:

anypinn create my-project \
  --template heat-1d \
  --data synthetic \
  --direction inverse \
  --lightning \
  --run

Command reference

anypinn

Usage: anypinn [OPTIONS] COMMAND [ARGS]...

Options:
  --version  -v    Show version and exit.
  --help     -h    Show this message and exit.

Commands:
  create    Create a new PINN project.

anypinn create

Usage: anypinn create [OPTIONS] [PROJECT_NAME]

Arguments:
  PROJECT_NAME    Name for the new project directory. [default: .]

Options:
  -t, --template TEXT              Project template name.
  -d, --data [synthetic|csv]       Training data source.
      --direction [forward|inverse]  Problem direction (PDE only).
  -L, --lightning / -NL, --no-lightning
                                   Include Lightning wrapper.
      --run / --no-run             Install deps and run training.
                                   [default: run]
  -l, --list-templates             List all templates and exit.
  -h, --help                       Show this message and exit.

Templates

ODE problems

ODE templates are inverse-only (the --direction flag does not apply).

Template Description
sir SIR epidemic model -- learns transmission rate beta
seir SEIR epidemic model -- learns beta with exposed compartment
damped-oscillator Harmonic oscillator -- learns damping ratio
lotka-volterra Predator-prey with Fourier encoding -- learns beta
van-der-pol Nonlinear oscillator -- learns mu
lorenz Chaotic 3-field ODE -- learns sigma, rho, beta
fitzhugh-nagumo Neuron model -- recovers timescale epsilon
custom Minimal ODE skeleton with stub factories
blank Empty project

PDE problems

PDE templates support both forward and inverse directions.

Template Direction Description
heat-1d forward / inverse 1-D heat equation -- recovers thermal diffusivity
burgers-1d forward / inverse 1-D Burgers equation -- recovers viscosity
wave-1d forward / inverse 1-D wave equation -- recovers wave speed
poisson-2d forward / inverse 2-D Poisson equation
gray-scott-2d forward / inverse 2-field reaction-diffusion
inverse-diffusivity forward / inverse Space-dependent D(x) as neural field
allen-cahn forward / inverse Stiff reaction-diffusion

Data sources

  • synthetic: training data is generated by numerically integrating the ODE/PDE with known parameters (via torchdiffeq or analytical solutions). Best for getting started and validating your setup.
  • csv: training data is loaded from a CSV file placed in the data/ directory. Use this for real-world observations.

Generated project structure

my-project/
├── pyproject.toml    # Dependencies
├── ode.py            # Physics: ODE/PDE, fields, parameters, validation
├── config.py         # Hyperparameters (frozen dataclass)
├── train.py          # Training script
└── data/             # CSV data (if using csv source)

Common workflows

Try a different template

anypinn create experiment-1 --template lorenz --data synthetic --lightning

Use your own data

anypinn create my-sir --template sir --data csv --lightning
# Edit my-sir/data/*.csv with your observations
# Edit my-sir/config.py to point to your CSV columns
# Run: cd my-sir && uv run train.py

Compare forward vs inverse

anypinn create heat-forward --template heat-1d --direction forward --lightning
anypinn create heat-inverse --template heat-1d --direction inverse --lightning

List available templates

anypinn create --list-templates