How do I train a sensor classifier in the cloud and test it on a device?

For a device that classifies sensor readings, start by defining one observation: its feature order, units, sampling interval and label. Train a baseline, save the preprocessing rules alongside the weights and replay the same observation after export. A small linear classifier like the one below fits on a CPU. A cloud GPU becomes worth testing when a larger model or longer input windows make training the bottleneck.

What can I reproduce before I rent?

Download the PyTorch training notebook to inspect the data and training loop. The example generates 2,048 synthetic observations with eight features each. Its label is 1 when the sum of the first two features is positive. It trains on 1,536 rows for 80 updates and holds out 512 rows. For a CUDA run, open the PyTorch template and check the instance quote before starting.

The notebook saves two files. Keep both before releasing the instance.

File What to do with it
pytorch-classifier.pt Reload the model weights for evaluation. The file also contains optimizer state and the step count for continued training.
classifier-host.pt2 Reload the exported inference graph in PyTorch and pass one observation of shape (1, 8) with dtype float32.

On November 30, 2026, we ran the export cell against the example checkpoint with PyTorch 2.8.0 on CPU. The input was [0.5, -0.25, 0, 0, 0, 0, 0, 0]. The reloaded graph returned two scores with shape (1, 2), and PyTorch’s assert_close check passed against the original model. This checks the host export on one input. Device latency and accuracy on physical sensor readings remain unmeasured.

What changes with real hardware?

  1. For a vibration detector, record complete runs with labels such as idle and running. Reserve entire sessions or devices for evaluation before cutting overlapping windows. Adjacent windows can otherwise leak nearly identical readings into training and testing.
  2. Keep a small set of labeled windows plus their expected scores. Replay them through the device’s preprocessing and inference runtime. Check channel order, units and normalization if predictions diverge.
  3. Choose a runtime that supports the target chip and operators. For ExecuTorch, lower the exported model for the target backend and serialize its program as a .pte file. Measure prediction agreement, peak memory and latency on the actual device at the intended sampling rate. ExecuTorch deployment overview

If the output you need is a sequence of robot actions learned from demonstrations, follow the LeRobot ACT cloud training guide.