refactor(config): enable trackio tracking by default #5217
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.
Pages changed in this PR:
en/cheat-sheeten/il_robotsen/installationTrackio 0.44.0 reuses the Space’s mounted bucket, so a private Space can still write logs to a public bucket. Could we also verify the bucket’s visibility when the Space is selected automatically?
I reproduced a retry with the same cfg: the first attempt rejected the public Space, but the second skipped the check. Could we assign cfg.trackio.space_id only after validation succeeds?
From reading the Trackio 0.44.0 source, it looks like a private frozen Space could pass this check and then fail during trackio.init(), before training starts. Would it make sense to warn and skip tracking in this case if the Space was selected automatically?
Thanks for making Trackio easier to use by default! I’ve left a few comments on privacy checks and how training handles an unavailable default Space—hope they help.
Building on @zhangyue19921010's retry finding above, here is a small tested patch against d9c93c35. It resolves the Space/private defaults into local variables and writes them back only after the public-Space check succeeds. A rejected attempt therefore leaves both fields unchanged and rechecks the Space on retry.
Added two cases (private initially None or True) exercising two attempts with the same config and asserting both attempts reject. Before the fix both cases fail because the rejected call mutates the config. After the fix: 99 passed, 1 skipped across tests/jobs and tests/common/test_trackio_utils.py; Ruff lint/format and diff whitespace checks pass.
This addresses the retry mutation only, not the separately raised bucket visibility or frozen-Space questions. Hub/job APIs are mocked; no job was launched or Space modified. Windows/Python 3.12, AI-assisted with Codex and tested locally.
Optional patch:
diff --git a/src/lerobot/jobs/hf.py b/src/lerobot/jobs/hf.py
index 0f6b6473..fea9635a 100644
--- a/src/lerobot/jobs/hf.py
+++ b/src/lerobot/jobs/hf.py
@@ -411,23 +411,27 @@ def submit_to_hf(cfg: TrainPipelineConfig) -> None:
# The pod's local Trackio database vanishes with the job, so log to a Space. TRACKIO_SPACE_ID is
# honored as on a local run, and resolved here because only HF_TOKEN is forwarded to the pod.
env_space = os.environ.get("TRACKIO_SPACE_ID")
- cfg.trackio.space_id = env_space or f"{username}/{DEFAULT_JOB_TRACKIO_SPACE}"
+ resolved_space = env_space or f"{username}/{DEFAULT_JOB_TRACKIO_SPACE}"
+ resolved_private = cfg.trackio.private
if not env_space:
- if cfg.trackio.private is None:
- cfg.trackio.private = True
+ if resolved_private is None:
+ resolved_private = True
# Trackio's private flag only affects creation; don't reuse a public default implicitly.
- if cfg.trackio.private:
+ if resolved_private:
try:
- space = api.space_info(cfg.trackio.space_id)
+ space = api.space_info(resolved_space)
except RepositoryNotFoundError:
pass # Trackio creates the private Space when the job starts.
else:
if not space.private:
raise ValueError(
- f"The default Trackio Space {cfg.trackio.space_id} is public. "
+ f"The default Trackio Space {resolved_space} is public. "
"Make it private, choose another with `--trackio.space_id`, or pass "
"`--trackio.private=false` to use it publicly."
)
+ # Commit resolved defaults only after validation; a failed attempt must remain retryable.
+ cfg.trackio.space_id = resolved_space
+ cfg.trackio.private = resolved_private
print(
f"Trackio: logging to the {cfg.trackio.space_id} Space. Pass `--trackio.space_id` to pick "
"another one, or `--trackio.enable=false` to turn tracking off."
diff --git a/tests/jobs/test_hf.py b/tests/jobs/test_hf.py
index e88b5249..d4e81b05 100644
--- a/tests/jobs/test_hf.py
+++ b/tests/jobs/test_hf.py
@@ -596,6 +596,28 @@ def test_submit_stages_trackio_space_and_forwards_only_hf_token(
assert staged["trackio"]["private"] is expected_private
+@pytest.mark.parametrize("private", [None, True])
+def test_rejected_default_trackio_space_can_be_retried_safely(monkeypatch, private):
+ monkeypatch.delenv("TRACKIO_SPACE_ID", raising=False)
+ monkeypatch.setattr("lerobot.jobs.hf.get_token", lambda: "tok")
+ lookups = []
+
+ def space_info(repo_id):
+ lookups.append(repo_id)
+ return SimpleNamespace(private=False)
+
+ api = SimpleNamespace(whoami=lambda **kwargs: {"name": "alice"}, space_info=space_info)
+ monkeypatch.setattr("lerobot.jobs.hf.HfApi", lambda **kwargs: api)
+ cfg = _minimal_cfg()
+ cfg.trackio.private = private
+ for _ in range(2):
+ with pytest.raises(ValueError, match="default Trackio Space .* is public"):
+ submit_to_hf(cfg)
+ assert cfg.trackio.space_id is None
+ assert cfg.trackio.private is private
+ assert lookups == ["alice/lerobot-trackio"] * 2
+
+
def test_submit_rejects_public_default_trackio_space(monkeypatch):
monkeypatch.delenv("TRACKIO_SPACE_ID", raising=False)
monkeypatch.setattr("lerobot.jobs.hf.get_token", lambda: "tok")
is this removed on purpose?
Approved these changes.
One question on scope: does this also cover eval runs, or only training? If the eval script logged per-episode success with the seed and checkpoint revision to the same Space, comparing two checkpoints on LIBERO would not need a separate log.
pkooij
imstevenpmwork
Enable Trackio by default for training, with graceful fallback when it isn’t installed. HF Jobs automatically use a private Trackio Space, while explicit settings remain respected.