fix(actpred): ONNX opset 升级 + NumPy 兼容 + 断点续训 + MobileNetV2 离线弹性
- export_onnx: opset 17→18,dynamic_axes 改 dynamic_shapes 消除弃用警告 - predict: action_stats 改为 torch tensor,消除 NumPy 2.0 __array_wrap__ 警告 - train/pretrain: 每 epoch 保存 last.pt,新增 --resume 断点续训练 - model: MobileNetEncoder 下载失败时回退到已缓存权重 - _set.sh: 安装时预缓存 MobileNetV2 权重,失败给出明确指引 - test: 新增 TestResumeCheckpoint(2 用例),总计 58 测试全绿
This commit is contained in:
1 parent
9fc3542771
commit
d17677bade
9 files changed
+183
-18
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import argparse
|
||||
import torch
|
||||
from torch.export import Dim
|
||||
from config import parse_checkpoint_config
|
||||
from model import ActionPredictor
|
||||
|
||||
@@ -23,17 +24,17 @@ def main():
|
||||
1, data_cfg.frame_len, 3, data_cfg.image_size, data_cfg.image_size)
|
||||
dummy_history = torch.randn(1, data_cfg.history_len, data_cfg.action_dim)
|
||||
|
||||
batch = Dim("batch")
|
||||
torch.onnx.export(
|
||||
model, (dummy_images, dummy_history),
|
||||
args.output,
|
||||
input_names=["images", "action_history"],
|
||||
output_names=["predicted_action"],
|
||||
dynamic_axes={
|
||||
"images": {0: "batch"},
|
||||
"action_history": {0: "batch"},
|
||||
"predicted_action": {0: "batch"},
|
||||
dynamic_shapes={
|
||||
"images": {0: batch},
|
||||
"action_history": {0: batch},
|
||||
},
|
||||
opset_version=17,
|
||||
opset_version=18,
|
||||
)
|
||||
print(f"ONNX model exported to: {args.output}")
|
||||
|
||||
|
||||
Reference in new issue
Block a user