From 0e6114ac36e23038fafbbcaed89c2917aeb00fc5 Mon Sep 17 00:00:00 2001 From: masato-ka Date: Sat, 9 May 2026 03:27:01 +0900 Subject: [PATCH] fix(train): restrict legacy RA-BC migration to JSON checkpoints only (#3490) * fix(train): restrict legacy RA-BC migration to JSON checkpoints only _migrate_legacy_rabc_fields was called for all config files, causing json.load to raise DecodeError when a YAML/TOML config was passed to lerobot-train for a new training run. Guard the block with an .endswith(".json") check so migration only runs when resuming from a JSON checkpoint. --- src/lerobot/configs/train.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lerobot/configs/train.py b/src/lerobot/configs/train.py index b2b3cd7a0..318821166 100644 --- a/src/lerobot/configs/train.py +++ b/src/lerobot/configs/train.py @@ -256,7 +256,9 @@ class TrainPipelineConfig(HubMixin): ) from e cli_args = kwargs.pop("cli_args", []) - if config_file is not None: + # Legacy RA-BC migration only applies to framework-saved checkpoints (always JSON). + # Hand-written YAML/TOML configs are expected to use the current sample_weighting schema. + if config_file is not None and config_file.endswith(".json"): with open(config_file) as f: config = json.load(f) migrated_config = _migrate_legacy_rabc_fields(config)