← Back to Pull requests

refactor(config): enable trackio tracking by default #5217

Open
imstevenpmwork opened this pull request with 272 lines diff across 18 files
View on GitHub
imstevenpmwork imstevenpmwork commented on Nov 02, 2026 22:26 UTC
Author

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.

Diff: 272 lines (+192 / -80) across 18 files Reviewer: pkooij Review duration: 48359m
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.95) × (1 − Review Confidence (0.80)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.95 · 272 lines diff across 18 files
0.95
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.73 · 5 substantive comment(s)
0.73
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
79%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.336
Sensitive Paths sensitive_paths
0.095
Mass File Touch mass_file_touch
0.080
Real PR Conversation Timeline
10 items
HuggingFaceDocBuilderDev HuggingFaceDocBuilderDev commented on Nov 02, 2026 22:29 UTC
Contributor

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-sheet

  • en/il_robots

  • en/installation
  • zhangyue19921010 zhangyue19921010 commented on code on Nov 03, 2026 02:30 UTC
    Code Review
    src/lerobot/jobs/hf.py:1
    @@ -389,9 +408,29 @@ def submit_to_hf(cfg: TrainPipelineConfig) -> None:
     
         secrets: dict[str, str] = {"HF_TOKEN": token}
         if cfg.trackio.enable and not cfg.trackio.space_id:
    -        raise ValueError(
    -            "trackio is enabled but no `--trackio.space_id` is set. A remote job's local Trackio database "
    -            "vanishes with the pod, so pass a Hugging Face Space, e.g. `--trackio.space_id=<user>/<space>`."
    +        # 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}"
    +        if not env_space:
    +            if cfg.trackio.private is None:
    +                cfg.trackio.private = True
    +            # Trackio's private flag only affects creation; don't reuse a public default implicitly.
    +            if cfg.trackio.private:

    Trackio 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?

    zhangyue19921010 zhangyue19921010 commented on code on Nov 03, 2026 02:31 UTC
    Code Review
    src/lerobot/jobs/hf.py:1
    @@ -389,9 +408,29 @@ def submit_to_hf(cfg: TrainPipelineConfig) -> None:
     
         secrets: dict[str, str] = {"HF_TOKEN": token}
         if cfg.trackio.enable and not cfg.trackio.space_id:
    -        raise ValueError(
    -            "trackio is enabled but no `--trackio.space_id` is set. A remote job's local Trackio database "
    -            "vanishes with the pod, so pass a Hugging Face Space, e.g. `--trackio.space_id=<user>/<space>`."
    +        # 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}"

    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?

    zhangyue19921010 zhangyue19921010 commented on code on Nov 03, 2026 02:35 UTC
    Code Review
    src/lerobot/jobs/hf.py:1
    @@ -389,9 +408,29 @@ def submit_to_hf(cfg: TrainPipelineConfig) -> None:
     
         secrets: dict[str, str] = {"HF_TOKEN": token}
         if cfg.trackio.enable and not cfg.trackio.space_id:
    -        raise ValueError(
    -            "trackio is enabled but no `--trackio.space_id` is set. A remote job's local Trackio database "
    -            "vanishes with the pod, so pass a Hugging Face Space, e.g. `--trackio.space_id=<user>/<space>`."
    +        # 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}"
    +        if not env_space:
    +            if cfg.trackio.private is None:
    +                cfg.trackio.private = True
    +            # Trackio's private flag only affects creation; don't reuse a public default implicitly.
    +            if cfg.trackio.private:
    +                try:
    +                    space = api.space_info(cfg.trackio.space_id)

    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?

    zhangyue19921010 zhangyue19921010 commented on Nov 03, 2026 02:35 UTC
    Reviewer

    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.

    JonnyFaeth JonnyFaeth commented on Nov 03, 2026 06:43 UTC
    Contributor

    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")
    

    pkooij pkooij commented on code on Nov 03, 2026 07:47 UTC
    Code Review
    src/lerobot/scripts/lerobot_train.py:1
    @@ -564,12 +564,7 @@ def train(cfg: TrainPipelineConfig) -> None:
         if is_main_process():
             logging.info(pformat(cfg.to_dict()))
     
    -    if cfg.trackio.enable and cfg.trackio.project and is_main_process():
    -        trackio_logger = TrackioLogger(cfg)
    -    else:
    -        trackio_logger = None
    -        if is_main_process():

    is this removed on purpose?

    pkooij pkooij approved these changes on Nov 03, 2026 07:47 UTC
    Approved Reviewer

    Approved these changes.

    sattyamjjain sattyamjjain commented on Nov 03, 2026 12:36 UTC
    Contributor

    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.

    Reviewers
    Assignees
    imstevenpmwork imstevenpmwork
    Labels
    risk: low confidence: 79.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 95.3% (HIGH) · Higher = larger blast radius
    95.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 79.7% · Lower = rushed or shallow review
    79.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.4% · Safe to merge
    19.4%