chore(async): move async related code to its directory at top level (#2003)

* chore(async): move async related code to its directory at top level

* chore(style): apply pre-commit to renamed headers

* test(async): fix async imports

* docs(async): update async headers doc
This commit is contained in:
Steven Palma
2025-09-24 14:49:37 +02:00
committed by GitHub
parent 7359e18eb6
commit 1cba47da20
10 changed files with 44 additions and 41 deletions

View File

@@ -65,8 +65,8 @@ class MockPolicy:
def policy_server():
"""Fresh `PolicyServer` instance with a stubbed-out policy model."""
# Import only when the test actually runs (after decorator check)
from lerobot.scripts.server.configs import PolicyServerConfig
from lerobot.scripts.server.policy_server import PolicyServer
from lerobot.async_inference.configs import PolicyServerConfig
from lerobot.async_inference.policy_server import PolicyServer
test_config = PolicyServerConfig(host="localhost", port=9999)
server = PolicyServer(test_config)
@@ -95,7 +95,7 @@ def policy_server():
def _make_obs(state: torch.Tensor, timestep: int = 0, must_go: bool = False):
"""Create a TimedObservation with a given state vector."""
# Import only when needed
from lerobot.scripts.server.helpers import TimedObservation
from lerobot.async_inference.helpers import TimedObservation
return TimedObservation(
observation={
@@ -191,7 +191,7 @@ def test_obs_sanity_checks(policy_server):
def test_predict_action_chunk(monkeypatch, policy_server):
"""End-to-end test of `_predict_action_chunk` with a stubbed _get_action_chunk."""
# Import only when needed
from lerobot.scripts.server.policy_server import PolicyServer
from lerobot.async_inference.policy_server import PolicyServer
# Force server to act-style policy; patch method to return deterministic tensor
policy_server.policy_type = "act"