Skip to content

optimize_network.py

CLI options for training the parameter-predicting network (see bin/dataset_optim_command.sh for a full invocation).

Typical invocation

UV_CACHE_DIR=.uv-cache-local uv run --project PCT python PCT/bin/optimize_network.py \
  --dataset datasets/... \
  --val-dataset datasets/... \
  --epochs 5000 --batch-size 4096 --lr 1e-6 \
  --model mlp-dynamics --model-hidden 2048 2048 2048 1024 512 512 \
  --dynamics-hidden-size 128 \
  --dataset-cache dataset_bundle_no_teleop_mlp.npz \
  --val-dataset-cache val_dataset_bundle_mlp.npz \
  --curriculum-batches 10000 --curriculum-timesteps 5 \
  --feature-mode full \
  --lr-patience 50 --lr-factor 0.5 --min-lr 1e-12 \
  --output pct_optimized_network.json \
  --wandb-project pct-network-optim --wandb-entity xlab-upenn

Key options

  • Datasets
  • --dataset PATH (repeatable): Training dataset folders.
  • --val-dataset PATH (repeatable): Validation dataset folders.
  • --samples / --val-samples: Limit samples per split.
  • --dataset-cache / --val-dataset-cache: .npz cache files to skip regeneration.
  • --refresh-cache: Force regenerating caches.
  • Model selection
  • --model {singletrack-augmented, tv-linear, mlp-dynamics, …}: Dynamics spec to train.
  • --model-hidden H1 H2 …: Hidden sizes for the parameter-predicting MLP.
  • --dynamics-hidden-size N: Hidden width for the mlp-dynamics spec.
  • --dt: Timestep (hundredths of a second) when building base params.
  • --feature-mode {full, state_contexts_only}: Feature composition for the network input.
  • Optimization
  • --epochs: Training epochs.
  • --batch-size: Mini-batch size.
  • --lr: Initial learning rate.
  • --lr-patience: Epochs without improvement before LR reduction.
  • --lr-factor: Multiplicative LR decay factor.
  • --min-lr: LR floor.
  • --seed: RNG seed.
  • Curriculum
  • --curriculum-batches: Number of initial batches to truncate rollouts.
  • --curriculum-timesteps: Horizon to keep when curriculum is active.
  • Outputs & artifacts
  • --output: JSON path for predicted parameters (defaults under results/…).
  • --best-model-path: Msgpack for best params (when validation provided).
  • --best-params-output: JSON with best predicted params (with validation).
  • --summary-chunk-size: Chunking for param summaries to avoid OOM.
  • --analysis-*: Control scenario sampling and batch size for analysis plots.
  • Logging
  • --wandb-project / --wandb-entity / --wandb-run-name / --wandb-tags / --wandb-mode: Weights & Biases logging controls.

Refer to PCT/bin/optimize_network.py for full argument defaults and validation.