TorchLean API

NN.Examples.Quickstart.StarterWorkflow

Quickstart: Starter Workflow #

The smallest useful TorchLean training setup is ordinary model code:

public import NN.API
open TorchLean

def model :=
  nn.Sequential![
    nn.linear 2 8,
    nn.relu,
    nn.linear 8 1
  ]

No subsystem-specific imports are needed here. Model construction, data, training, prediction, and the public robustness-checking entry point all come from import NN.API. Lower-level certificate formats and proof developments use the focused NN.Verification and NN.Proofs imports.

Tiny in-memory regression dataset.

The important bit is the last line: Data.tensorDataset xs ys turns ordinary Float tensors into a runtime-polymorphic dataset, so the trainer can still choose Float, executable IEEE32, CPU, CUDA, eager, or compiled execution later.

Instances For

    A LoRA parameter type exposed by the public adapter API.

    Instances For

      Run the public API example from another command or from #eval while developing.

      The shape below is the user-facing training path:

      • build the trainer from the model,
      • attach optimizer/backend choices once,
      • call trainer.predict for initial prediction,
      • call trainer.train,
      • use the returned trained handle for prediction.
      • call trained.verifyRobustLInf on a small $\ell_\infty$ box.

      The quickstart build only checks that these declarations typecheck; it does not train during ordinary lake build, which keeps CI fast.

      Instances For