Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ actor keeps the command and anchor-orientation terms at one step while the
`base_ang_vel`, `joint_pos`, `joint_vel`, and `actions` terms declare
`history_length: 5`. `ObservationManager` owns and flattens those per-term
histories; the actor uses the configured encoder-biased joint-position term while
the critic keeps the clean term. Per-term oldest-first ordering is guarded by
`tests/scripts/test_obs_alignment_g1_wbt.py`; the hardware-side contract is
the critic keeps the clean term. Per-term oldest-first ordering is guaranteed by
the `ObservationManager` per-term history buffers
(`tests/managers/test_observation_buffers_noise.py`); the hardware-side contract is
documented in the sim-to-real deployment guide. When a Motrix sim2sim replay needs
a checkpoint from another log root, pass the absolute path through `uv run eval`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ within the term, and terms are concatenated in declaration order:

The motion command contributes the reference joint position and velocity
(`29 + 29`) ahead of the observation terms. Per-term oldest-first ordering is
guarded by `tests/scripts/test_obs_alignment_g1_wbt.py`; mirror that ordering
guaranteed by the `ObservationManager` per-term history buffers
(`tests/managers/test_observation_buffers_noise.py`); mirror that ordering
on hardware or the policy reads a permuted vector.

## 3. Actuator interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ budgets as robot-specific measurements, not UniLab defaults.
| --- | --- | --- |
| One-step action delay | Manager action term `simulate_action_latency` declarations in task owners | Executes the previous action instead of the current action. |
| G1 WBT observation history | Per-term `history_length` in `src/unilab/conf/sac/task/g1_wbt_obs/mujoco.yaml` | Per-term history for `base_ang_vel`, `joint_pos`, `joint_vel`, and `actions`. |
| Obs history ordering guard | `tests/scripts/test_obs_alignment_g1_wbt.py` | Asserts per-term oldest-first flatten for the G1 WBT actor obs. |
| Obs history ordering | `ObservationManager` per-term history buffers (`tests/managers/test_observation_buffers_noise.py`) | Per-term oldest-first flatten for the G1 WBT actor obs. |

## Action Latency

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ uv run train --algo sac --task g1_wbt_obs --sim mujoco training.use_amp=true
orientation term 保持单步,`base_ang_vel`、`joint_pos`、`joint_vel` 和 `actions` term
分别声明 `history_length: 5`。这些逐项历史由 `ObservationManager` 维护并展开;actor
使用配置中的 encoder-biased joint-position term,critic 则保留 clean term。逐项最旧
优先顺序由 `tests/scripts/test_obs_alignment_g1_wbt.py` 守护;硬件侧契约见仿真到真机
优先顺序由 `ObservationManager` 的逐项历史缓冲实现保证
(`tests/managers/test_observation_buffers_noise.py`);硬件侧契约见仿真到真机
部署指南。当 Motrix sim2sim 回放需要引用其他日志根目录下的 checkpoint 时,用
`uv run eval` 透传绝对路径:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ Actor 观测宽度是 `env.observations.actor.terms` 下各项 `dim * history_le
```

motion command 在观测项之前贡献参考关节位置与速度(`29 + 29`)。逐项的最旧优先
顺序由 `tests/scripts/test_obs_alignment_g1_wbt.py` 守护;硬件侧必须镜像该顺序,
顺序由 `ObservationManager` 的逐项历史缓冲实现保证
(`tests/managers/test_observation_buffers_noise.py`);硬件侧必须镜像该顺序,
否则策略读到的是被置换过的向量。

## 3. 执行器接口
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| --- | --- | --- |
| 单步动作延迟 | task owner 中 Manager action term 的 `simulate_action_latency` 声明 | 执行上一步动作而非当前动作。 |
| G1 WBT 观测历史 | `src/unilab/conf/sac/task/g1_wbt_obs/mujoco.yaml` 中逐 term 的 `history_length` | 为 `base_ang_vel`、`joint_pos`、`joint_vel` 与 `actions` 提供逐项历史。 |
| 观测历史顺序守护 | `tests/scripts/test_obs_alignment_g1_wbt.py` | 断言 G1 WBT actor 观测按逐项最旧优先展平。 |
| 观测历史顺序 | `ObservationManager` 逐项历史缓冲(`tests/managers/test_observation_buffers_noise.py`) | G1 WBT actor 观测按逐项最旧优先展平。 |

## 动作延迟

Expand Down
132 changes: 0 additions & 132 deletions src/unilab/tasks/compatibility.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/unilab/tasks/migration_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Literal

MigrationStatus = Literal["Compatible", "Adapted"]
MigrationTarget = Literal["complete", "mba", "compatibility"]
MigrationTarget = Literal["complete", "mba"]


@dataclass(frozen=True)
Expand Down
17 changes: 0 additions & 17 deletions tests/algos/test_appo_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@
from unilab.structured_configs import APPOConfig


@pytest.mark.slow
def test_appo_runner_init_no_crash(mock_env_name):
cfg = APPOConfig().to_dict()
cfg["num_envs"] = 4
cfg["steps_per_env"] = 4

runner = APPORunner(
env_name=mock_env_name,
env_factory=registry_env_factory(mock_env_name, "mujoco"),
env_cfg_overrides={},
rl_cfg=cfg,
num_envs=4,
steps_per_env=4,
)
runner.close()


@pytest.mark.slow
@pytest.mark.parametrize("env_name", ["Go2JoystickFlat"])
def test_appo_runner_learn_two_iterations(env_name):
Expand Down
43 changes: 0 additions & 43 deletions tests/algos/test_offpolicy_double_buffer_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import pytest
from hydra import compose, initialize_config_dir
from hydra.core.global_hydra import GlobalHydra
from hydra.errors import ConfigCompositionException
from uni_rl.ipc.dp_launcher import UNILAB_DP_LOG_DIR, UNILAB_DP_RANK, UNILAB_DP_WORLD_SIZE

_ROOT = Path(__file__).parent.parent.parent
Expand Down Expand Up @@ -83,35 +82,6 @@ def test_offpolicy_config_has_one_replay_path():
cfg = _offpolicy_cfg()
assert cfg.training.replay_prefetch_mode == "one_tick"
assert cfg.training.env_steps_per_sync == 1
assert "env_steps_per_sync" not in cfg.algo
assert "inference_owner" not in cfg.training
assert "collector_infer_device" not in cfg.training
assert "no_sync_collection" not in cfg.training
assert "replay_pipeline" not in cfg.training
assert "verbose_metrics" not in cfg.training
assert "replay_pack_layout" not in cfg.training
assert "replay_pack_executor" not in cfg.training
assert "replay_h2d_submitter" not in cfg.training


@pytest.mark.parametrize(
"override",
[
"training.replay_pipeline=cpu_pinned_double_buffer",
"training.verbose_metrics=true",
"training.num_gpus=2",
"training.multi_gpu_sync_mode=sync_sgd",
"training.multi_gpu_sync_interval=2",
"training.device=cuda",
"training.inference_owner=collector",
"training.collector_infer_device=cpu",
"training.no_sync_collection=true",
"algo.env_steps_per_sync=2",
],
)
def test_removed_offpolicy_options_fail_hydra_compose(override: str):
with pytest.raises(ConfigCompositionException, match="Could not override"):
_offpolicy_cfg([override])


@pytest.mark.parametrize("mode", ["invalid_mode", "same_tick"])
Expand Down Expand Up @@ -160,11 +130,6 @@ def test_sac_dispatch_constructs_unique_runner(monkeypatch: pytest.MonkeyPatch):
assert runner.kwargs["algo_type"] == "sac"
assert runner.kwargs["device"] == "cuda:0"
assert runner.kwargs["replay_prefetch_mode"] == "one_tick"
assert "inference_owner" not in runner.kwargs
assert "collector_infer_device" not in runner.kwargs
assert "sync_collection" not in runner.kwargs
assert "replay_pipeline" not in runner.kwargs
assert "verbose_metrics" not in runner.kwargs
assert runner.kwargs["learner"].kwargs == {
"device": "cuda:0",
"obs_dim": 4,
Expand Down Expand Up @@ -252,10 +217,6 @@ def test_td3_dispatch_constructs_unique_runner(monkeypatch: pytest.MonkeyPatch):
assert isinstance(runner, _FakeRunner)
assert runner.kwargs["algo_type"] == "td3"
assert runner.kwargs["device"] == "cuda:0"
assert "inference_owner" not in runner.kwargs
assert "collector_infer_device" not in runner.kwargs
assert "sync_collection" not in runner.kwargs
assert "replay_pipeline" not in runner.kwargs
assert runner.kwargs["replay_prefetch_mode"] == "one_tick"
nan_guard_cfg = runner.kwargs["nan_guard_cfg"]
assert nan_guard_cfg.enabled is True
Expand Down Expand Up @@ -326,10 +287,6 @@ def test_flashsac_dispatch_constructs_unique_runner(monkeypatch: pytest.MonkeyPa
assert runner.kwargs["algo_type"] == "flashsac"
assert runner.kwargs["device"] == "cuda:0"
assert runner.kwargs["replay_prefetch_mode"] == "one_tick"
assert "inference_owner" not in runner.kwargs
assert "collector_infer_device" not in runner.kwargs
assert "sync_collection" not in runner.kwargs
assert "replay_pipeline" not in runner.kwargs


def test_flashsac_n_step_is_rejected():
Expand Down
14 changes: 0 additions & 14 deletions tests/algos/test_offpolicy_dp_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,6 @@ def test_learner_without_initial_sync_tensors_fails_with_type_error():
runner._dp_init_broadcast()


def test_close_closes_dp_sync_idempotently():
dp_sync = _FakeDpSync()
runner = _runner_with(_SyncLearner(), dp_sync)
# Avoid the full AsyncRunner.close(); only the dp_sync branch is under test.
runner.dp_sync.close()
runner.dp_sync.close()
assert [name for name, _ in dp_sync.calls] == ["close", "close"]


def test_close_restores_terminal_and_ipc_before_destroying_process_group(monkeypatch):
from uni_rl.offpolicy.runner import OffPolicyRunner

Expand Down Expand Up @@ -499,11 +490,6 @@ def __init__(self, *args, **kwargs):
return runner.kwargs


def test_offpolicy_config_has_no_periodic_parameter_sync_interval():
cfg = _offpolicy_cfg()
assert "dp_sync_interval" not in cfg.training


def test_build_runner_single_rank_keeps_dp_sync_none(monkeypatch: pytest.MonkeyPatch):
monkeypatch.delenv(UNILAB_DP_RANK, raising=False)
kwargs = _build_sac_runner_with_dp_fakes(monkeypatch, [])
Expand Down
Loading
Loading