refactor(train): hoist submit_to_hf import to module top

The `from lerobot.jobs import submit_to_hf` was a function-local import in
train(); it pulls no heavy/optional deps and has no circular-import risk, so
move it to the top-level import block.
This commit is contained in:
Nicolas Rabault
2026-06-29 09:11:54 +02:00
parent be007a6f6e
commit f2b1e62dda
2 changed files with 3 additions and 4 deletions
+2 -2
View File
@@ -54,10 +54,10 @@ def test_no_target_is_not_remote(monkeypatch):
def test_train_dispatches_to_submit_when_remote(monkeypatch):
"""A remote --job.target short-circuits train() to the HF Jobs submitter."""
import lerobot.jobs
import lerobot.scripts.lerobot_train as train_module
captured = []
monkeypatch.setattr(lerobot.jobs, "submit_to_hf", lambda cfg: captured.append(cfg) or "submitted")
monkeypatch.setattr(train_module, "submit_to_hf", lambda cfg: captured.append(cfg) or "submitted")
cfg = draccus.parse(
TrainPipelineConfig,
args=["--dataset.repo_id", "u/d", "--policy.type", "act", "--job.target", "a10g-small"],