# LeRobot lab

Real LeRobot code for the workshops after the foundations: first the data (`data_tour.py`, page
`site/ml/robot-arm/lerobot-data.html`), then ACT.

## Environment (set up 2026-10-11)

LeRobot 0.6.1 asks for PyTorch < 2.12; this machine has 2.13 in `~/.virtualenvs/torch_latest`. Rather than downgrade
it, a small separate environment borrows that PyTorch through a path file and adds only LeRobot and the few packages
whose versions LeRobot needs (150 MB):

```bash
/usr/bin/python3.12 -m venv ~/.virtualenvs/lerobot
echo "$HOME/.virtualenvs/torch_latest/lib/python3.12/site-packages" > ~/.virtualenvs/lerobot/lib/python3.12/site-packages/zz_torch_latest.pth
~/.virtualenvs/lerobot/bin/pip install --no-deps "lerobot==0.6.1"
~/.virtualenvs/lerobot/bin/pip install "datasets>=4.8,<5" "av>=15,<16" "jsonlines>=4,<5" "draccus>=0.11.6,<0.12" "opencv-python-headless>=4.9,<4.14"
```

The packages installed in `~/.virtualenvs/lerobot` take priority over the borrowed ones, so `torch_latest` keeps its
own versions (datasets 5, av 18). Videos are decoded with `video_backend="pyav"`, because torchcodec, LeRobot's
default, must match the PyTorch version.

## Data

`lerobot/svla_so101_pickplace`, revision `f641879e22172be7e8161d5e6c1503c2d2feb657`: 50 episodes, 11,939 frames at
30 fps, two 480 × 640 cameras, 86 MB. The first run downloads it into `~/.cache/huggingface/lerobot`.

```bash
~/.virtualenvs/lerobot/bin/python classes/ml/labs/lerobot/data_tour.py
~/.virtualenvs/lerobot/bin/python site/ml/robot-arm/tools/build_lerobot_data.py
```
