Add native SmolVLA model integration
This commit is contained in:
@@ -129,6 +129,23 @@ class EvalVLAExecutionTest(unittest.TestCase):
|
||||
["r_vis", "top", "front"],
|
||||
)
|
||||
|
||||
def test_resolve_eval_image_resize_shape_prefers_agent_top_level_override(self):
|
||||
cfg = OmegaConf.create(
|
||||
{
|
||||
"agent": {
|
||||
"eval_image_resize_shape": None,
|
||||
"condition_encoder": {
|
||||
"eval_image_resize_shape": [256, 256],
|
||||
},
|
||||
},
|
||||
"data": {
|
||||
"image_resize_shape": [224, 224],
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
self.assertIsNone(eval_vla._resolve_eval_image_resize_shape(cfg))
|
||||
|
||||
def test_resolve_eval_image_resize_shape_prefers_condition_encoder_override(self):
|
||||
cfg = OmegaConf.create(
|
||||
{
|
||||
@@ -270,6 +287,25 @@ class EvalVLAExecutionTest(unittest.TestCase):
|
||||
np.testing.assert_array_equal(queues["action"].popleft().numpy(), np.array([20.0], dtype=np.float32))
|
||||
np.testing.assert_array_equal(queues["action"].popleft().numpy(), np.array([30.0], dtype=np.float32))
|
||||
|
||||
def test_enqueue_predicted_actions_honors_explicit_chunk_start(self):
|
||||
queues = eval_vla._new_local_policy_queues(obs_horizon=2)
|
||||
predicted_actions = torch.tensor(
|
||||
[[[10.0], [20.0], [30.0], [40.0]]],
|
||||
dtype=torch.float32,
|
||||
)
|
||||
|
||||
eval_vla._enqueue_predicted_actions(
|
||||
queues,
|
||||
predicted_actions=predicted_actions,
|
||||
obs_horizon=2,
|
||||
num_action_steps=2,
|
||||
action_chunk_start=0,
|
||||
)
|
||||
|
||||
self.assertEqual(len(queues["action"]), 2)
|
||||
np.testing.assert_array_equal(queues["action"].popleft().numpy(), np.array([10.0], dtype=np.float32))
|
||||
np.testing.assert_array_equal(queues["action"].popleft().numpy(), np.array([20.0], dtype=np.float32))
|
||||
|
||||
def test_remote_policy_runner_only_requests_server_inference_when_local_action_queue_is_empty(self):
|
||||
request_queue = _FakeQueue()
|
||||
response_queue = _FakeQueue(
|
||||
@@ -288,6 +324,7 @@ class EvalVLAExecutionTest(unittest.TestCase):
|
||||
camera_names=["front"],
|
||||
obs_horizon=2,
|
||||
num_action_steps=2,
|
||||
action_chunk_start=0,
|
||||
)
|
||||
first_observation = {
|
||||
"qpos": torch.tensor([1.0, 2.0], dtype=torch.float32),
|
||||
@@ -315,8 +352,46 @@ class EvalVLAExecutionTest(unittest.TestCase):
|
||||
self.assertEqual(request_queue.put_calls[0]["type"], "predict_chunk")
|
||||
self.assertEqual(request_queue.put_calls[0]["worker_index"], 3)
|
||||
self.assertEqual(request_queue.put_calls[0]["server_index"], 1)
|
||||
np.testing.assert_array_equal(first_action.numpy(), np.array([20.0], dtype=np.float32))
|
||||
np.testing.assert_array_equal(second_action.numpy(), np.array([30.0], dtype=np.float32))
|
||||
np.testing.assert_array_equal(first_action.numpy(), np.array([10.0], dtype=np.float32))
|
||||
np.testing.assert_array_equal(second_action.numpy(), np.array([20.0], dtype=np.float32))
|
||||
|
||||
def test_remote_eval_worker_passes_agent_action_chunk_start_to_remote_runner(self):
|
||||
cfg = OmegaConf.create(
|
||||
{
|
||||
"agent": {
|
||||
"obs_horizon": 2,
|
||||
"num_action_steps": 2,
|
||||
"action_chunk_start": 0,
|
||||
"camera_names": ["front"],
|
||||
},
|
||||
"eval": {
|
||||
"obs_horizon": 2,
|
||||
"num_queries": 2,
|
||||
"response_timeout_s": 3.0,
|
||||
"camera_names": ["front"],
|
||||
},
|
||||
}
|
||||
)
|
||||
captured = {}
|
||||
|
||||
class CapturingRunner:
|
||||
def __init__(self, **kwargs):
|
||||
captured.update(kwargs)
|
||||
|
||||
with mock.patch.object(eval_vla, "_RemotePolicyRunner", CapturingRunner), \
|
||||
mock.patch.object(eval_vla, "_run_eval_episode_plans", return_value={"ok": True}) as run_plans:
|
||||
result = eval_vla._run_remote_eval_worker(
|
||||
cfg,
|
||||
episode_plans=[{"episode_index": 0}],
|
||||
worker_index=1,
|
||||
server_index=2,
|
||||
request_queue=_FakeQueue(),
|
||||
response_queue=_FakeQueue(),
|
||||
)
|
||||
|
||||
self.assertEqual(result, {"ok": True})
|
||||
self.assertEqual(captured["action_chunk_start"], 0)
|
||||
run_plans.assert_called_once()
|
||||
|
||||
def test_merge_worker_summaries_sorts_episodes_and_recomputes_aggregates(self):
|
||||
worker_summaries = [
|
||||
|
||||
Reference in New Issue
Block a user