fix(actpred): 修复归一化统计不一致等 5 项问题并增强可复现性

- train/val 归一化统计量改为仅用训练集计算并落盘复用,修复 val loss 不可信
- predict.py 统计文件路径改用 os.path 处理,修复跨平台与无分隔符路径问题
- dataset.py jpg/png 混合时统一按文件名排序,保证时间顺序
- 新增 --seed 全局随机种子(含 DataLoader generator),训练可复现
- 新增 --max-grad-norm 梯度裁剪(默认 1.0),防 GRU 梯度爆炸
- get_episode_count 与数据集目录过滤条件对齐,避免无效目录导致索引错位
- 空验证集返回 inf 并保底保存最终权重,避免伪造 best 模型
- 清理 export_onnx.py 重复分支死代码
This commit is contained in:
qing committed 2026-08-08 14:00:49 +00:00
1 parent 85e5a4a054
commit 73b72d6889
5 files changed
+58 -18

No files matched your search

+1 -4
View File
@@ -20,10 +20,7 @@ def main():
model.eval()
dummy_image = torch.randn(1, 3, data_cfg.image_size, data_cfg.image_size)
if model_cfg.history_encoder == "gru":
dummy_history = torch.randn(1, data_cfg.history_len, data_cfg.action_dim)
else:
dummy_history = torch.randn(1, data_cfg.history_len, data_cfg.action_dim)
dummy_history = torch.randn(1, data_cfg.history_len, data_cfg.action_dim)
torch.onnx.export(
model, (dummy_image, dummy_history),