From f311ca3dcee0969966cd3ff174f33becf4e0d850 Mon Sep 17 00:00:00 2001 From: "H.Yamada" <3405876+ymd-h@users.noreply.github.com> Date: Thu, 12 Mar 2026 04:12:21 +0900 Subject: [PATCH] Fix action padding key at SmolVLA (#1717) Issue https://github.com/huggingface/lerobot/issues/1707 Action padding mask is set at LeRobotDataset as f"{key}_is_pad". Wrong key doesn't raise any errors, however, padding mask is ignored, resulting wrong attention at around the edges of an episode when multi step actions is enabled (aka. action horizon is greater than 1). Co-authored-by: Steven Palma --- src/lerobot/policies/smolvla/modeling_smolvla.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lerobot/policies/smolvla/modeling_smolvla.py b/src/lerobot/policies/smolvla/modeling_smolvla.py index 430c85481..048d974af 100644 --- a/src/lerobot/policies/smolvla/modeling_smolvla.py +++ b/src/lerobot/policies/smolvla/modeling_smolvla.py @@ -374,7 +374,7 @@ class SmolVLAPolicy(PreTrainedPolicy): lang_tokens = batch[f"{OBS_LANGUAGE_TOKENS}"] lang_masks = batch[f"{OBS_LANGUAGE_ATTENTION_MASK}"] actions = self.prepare_action(batch) - actions_is_pad = batch.get("actions_id_pad") + actions_is_pad = batch.get("action_is_pad") loss_dict = {} losses = self.model.forward(images, img_masks, lang_tokens, lang_masks, state, actions, noise, time) loss_dict["losses_after_forward"] = losses.clone().mean().item()