actpred: action_dim改18 + .mt脚本预训练入口

- config.py: action_dim默认值 8→18(对齐bot4cj 18列)
- mt_parser.py: 轻量级.mt @Action解析器(支持-占位符前向填充)
- pretrain_mt.py: 预训练入口(零图像占位,checkpoint兼容现有推理)
- _run.sh: 新增pretrain子命令
- README.md: 新增预训练文档 + action_dim说明
- test_actpred.py: 测试断言更新为18
This commit is contained in:
qing committed 2026-08-08 17:09:14 +00:00
1 parent 37206daf13
commit 45e019952e
6 files changed
+394 -12

No files matched your search

+7 -7
View File
@@ -60,28 +60,28 @@ class TestActionPredictor(unittest.TestCase):
"""测试模型前向传播"""
def test_forward_simple_mlp(self):
data_cfg = DataConfig(image_size=64, action_dim=8, history_len=5)
data_cfg = DataConfig(image_size=64, action_dim=18, history_len=5)
model_cfg = ModelConfig(cnn_backbone="simple", history_encoder="mlp")
model = ActionPredictor(model_cfg, data_cfg)
model.eval()
image = torch.randn(2, 3, 64, 64)
history = torch.randn(2, 5, 8)
history = torch.randn(2, 5, 18)
with torch.no_grad():
out = model(image, history)
self.assertEqual(out.shape, (2, 8))
self.assertEqual(out.shape, (2, 18))
def test_forward_simple_gru(self):
data_cfg = DataConfig(image_size=64, action_dim=8, history_len=5)
data_cfg = DataConfig(image_size=64, action_dim=18, history_len=5)
model_cfg = ModelConfig(cnn_backbone="simple", history_encoder="gru")
model = ActionPredictor(model_cfg, data_cfg)
model.eval()
image = torch.randn(2, 3, 64, 64)
history = torch.randn(2, 5, 8)
history = torch.randn(2, 5, 18)
with torch.no_grad():
out = model(image, history)
self.assertEqual(out.shape, (2, 8))
self.assertEqual(out.shape, (2, 18))
def test_forward_dynamic_batch(self):
data_cfg = DataConfig(image_size=32, action_dim=4, history_len=3)
@@ -186,7 +186,7 @@ class TestConfig(unittest.TestCase):
def test_default_config(self):
cfg = Config()
self.assertEqual(cfg.data.image_size, 64)
self.assertEqual(cfg.data.action_dim, 8)
self.assertEqual(cfg.data.action_dim, 18)
self.assertEqual(cfg.data.history_len, 5)
self.assertEqual(cfg.model.cnn_backbone, "simple")
self.assertEqual(cfg.model.history_encoder, "mlp")