How to Train and Run SmolVLA with LeRobot: A Step-by-Step Guide
uv
, a fast and modern Python package manager.
uv
:
💡 Pro Tip: Before you start, rungit pull
inside thelerobot
directory to make sure you have the latest version of the library.
Note on MacBook Pro: While it’s technically possible to train on a MacBook Pro with an M-series chip (using the mps
device), it is extremely slow and not recommended for serious training runs.
--save_freq
: Saves a model checkpoint every 5000 steps, which is useful for not losing your work.
Note on WandB: As of June 11, 2025, Weights & Biases logging (wandb
) may have issues in the current version of LeRobot. If you encounter errors, you can disable it by changing the flag to--wandb.enable=false
.
n_action_steps
in the config.json
file. The default value is set to 1, but for inference on SmolVLA, it should be set to 50. This is only used during inference, but it’s easier to fix it now rather than later (before uploading the model to the Hugging Face Hub).
lerobot/smolvla_base
directory.
Note: If you don’t change this, the inference will be very slow, as the model will only predict one action at a time instead of a sequence of actions.
outputs/train/YYYY-MM-DD_HH-MM-SS/
.
torchcodec
Error:
You will likely encounter a RuntimeError: Could not load libtorchcodec
. This is because the default PyTorch version in Colab is incompatible with the torchcodec
version required by LeRobot.
The fix is to downgrade torchcodec
:
HTTP Error 429: Too Many Requests
, you have two options:
repo_id
.ffmpeg
or libtorchcodec
Errors on macOSRuntimeError
s related to ffmpeg
or shared libraries not being found, even if they are installed. This is often a dynamic library path issue.DYLD_LIBRARY_PATH
environment variable to include the path where Homebrew installs libraries.
ImportError: cannot import name 'GradScaler'
torch>=2.3.0
.uv
environment.
/dev/tty.usbmodemXXXXXXXX
).
--policy-path
: Note that this time we do not add the /pretrained_model
subfolder. We will fix this in the code.PLB/phospho-playground-mono
uses radians. However, the LeRobot SO-100 driver expects actions in degrees. This will cause the robot to move erratically or barely at all.
lerobot/common/policies/smolvla/modeling_smolvla.py
select_action
method.# Unpad actions
section.
try-except
block to gracefully handle connection errors.
lerobot/common/robot/motors_bus.py
record_ranges_of_motion
method.while True:
loop in a try-except
block.
config.json
or model.safetensors
Not FoundFileNotFoundError: config.json not found on the HuggingFace Hub
because it doesn’t look inside the pretrained_model
subfolder by default.from_pretrained
method to include the subfolder when downloading files.
lerobot/common/policies/pretrained.py
from_pretrained
class method.subfolder
argument to both hf_hub_download
calls.