From 2a0a2e55adfcf2c7be75bd228f1085bfa714b741 Mon Sep 17 00:00:00 2001 From: Hark Date: Sat, 17 Oct 2026 15:38:00 +0000 Subject: [PATCH] =?UTF-8?q?ml:=20=E6=95=B0=E6=8D=AE=E7=94=9F=E6=88=90=20+?= =?UTF-8?q?=20=E5=8F=AF=E5=BE=AE=E8=BF=90=E5=8A=A8=E5=AD=A6=E5=AF=B9?= =?UTF-8?q?=E6=8B=8D=20+=20MeanFlow/WTA=20=E7=AD=96=E7=95=A5=E4=B8=8E?= =?UTF-8?q?=E9=97=AD=E7=8E=AF=E4=BB=BF=E7=9C=9F=20+=20APG/=E6=8C=96?= =?UTF-8?q?=E9=94=99/ONNX=20=E5=AF=BC=E5=87=BA=E4=B8=8E=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=89=8B=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - M1 数据生成器:采样/老师/距离下界认证/时间律/统计/一致性门禁;确定性老师(碰撞次数计时 + resetSession)、pos 任务冻结 J6、--consensus 邻域共识过滤、Dr 类。 - 全流程代码与运行手册:数据打包/可微运动学与对拍/MeanFlow+WTA 模型/闭环仿真/APG/挖错循环/ONNX 导出;webapp 策略运行时 ik-policy.js、?policy=1 接入、tests/policy_bench.cjs;ik-solver 增 pairList/clusterExport/criticalPairs/pairGap/leverTable。 --- .gitignore | 71 +++--- docs/Transformer轨迹拟合训练方案.html | 90 ++++--- docs/Transformer轨迹拟合训练方案.md | 53 ++-- ml/README.md | 190 ++++++++++++++ ml/__init__.py | 0 ml/apg/__init__.py | 0 ml/apg/apg_finetune.py | 141 +++++++++++ ml/assets/kin.json | 1 + ml/common/__init__.py | 0 ml/common/features.py | 59 +++++ ml/common/kin_torch.py | 160 ++++++++++++ ml/configs/apg.json | 10 + ml/configs/base.json | 10 + ml/configs/wta.json | 10 + ml/data.py | 55 ++++ ml/eval/__init__.py | 0 ml/eval/check_parity.py | 58 +++++ ml/eval/dump_parity.cjs | 25 ++ ml/export_onnx.py | 53 ++++ ml/gen/README.md | 7 + ml/gen/cert.cjs | 3 + ml/gen/consistency.cjs | 47 ++++ ml/gen/gen_dataset.cjs | 59 +++++ ml/gen/pathdev.cjs | 16 ++ ml/gen/run_parallel.sh | 11 + ml/gen/sampler.cjs | 32 +++ ml/gen/stats.cjs | 21 ++ ml/gen/teacher.cjs | 34 +++ ml/gen/timelaw.cjs | 33 +++ ml/mining/__init__.py | 0 ml/mining/gate.py | 53 ++++ ml/mining/loop.sh | 29 +++ ml/mining/mine_round.py | 78 ++++++ ml/mining/tasks.py | 79 ++++++ ml/model/__init__.py | 0 ml/model/meanflow.py | 34 +++ ml/model/policy.py | 159 ++++++++++++ ml/package-lock.json | 227 +++++++++++++++++ ml/package.json | 8 + ml/pipeline.sh | 51 ++++ ml/prep/build_dataset.cjs | 75 ++++++ ml/prep/export_kin.cjs | 23 ++ ml/prep/npy.cjs | 13 + ml/prep/run_prep.sh | 8 + ml/requirements.txt | 6 + ml/serve.py | 17 ++ ml/sim/__init__.py | 0 ml/sim/closed_loop.py | 202 +++++++++++++++ ml/train.py | 117 +++++++++ tests/policy_bench.cjs | 91 +++++++ webapp/index.html | 2 + webapp/js/ik-glue.js | 6 + webapp/js/ik-policy-glue.js | 73 ++++++ webapp/js/ik-policy.js | 346 ++++++++++++++++++++++++++ webapp/js/ik-solver.js | 136 +++++++++- webapp/models/README.md | 5 + 56 files changed, 2990 insertions(+), 97 deletions(-) create mode 100644 ml/README.md create mode 100644 ml/__init__.py create mode 100644 ml/apg/__init__.py create mode 100644 ml/apg/apg_finetune.py create mode 100644 ml/assets/kin.json create mode 100644 ml/common/__init__.py create mode 100644 ml/common/features.py create mode 100644 ml/common/kin_torch.py create mode 100644 ml/configs/apg.json create mode 100644 ml/configs/base.json create mode 100644 ml/configs/wta.json create mode 100644 ml/data.py create mode 100644 ml/eval/__init__.py create mode 100644 ml/eval/check_parity.py create mode 100644 ml/eval/dump_parity.cjs create mode 100644 ml/export_onnx.py create mode 100644 ml/gen/README.md create mode 100644 ml/gen/cert.cjs create mode 100644 ml/gen/consistency.cjs create mode 100644 ml/gen/gen_dataset.cjs create mode 100644 ml/gen/pathdev.cjs create mode 100755 ml/gen/run_parallel.sh create mode 100644 ml/gen/sampler.cjs create mode 100644 ml/gen/stats.cjs create mode 100644 ml/gen/teacher.cjs create mode 100644 ml/gen/timelaw.cjs create mode 100644 ml/mining/__init__.py create mode 100644 ml/mining/gate.py create mode 100755 ml/mining/loop.sh create mode 100644 ml/mining/mine_round.py create mode 100644 ml/mining/tasks.py create mode 100644 ml/model/__init__.py create mode 100644 ml/model/meanflow.py create mode 100644 ml/model/policy.py create mode 100644 ml/package-lock.json create mode 100644 ml/package.json create mode 100755 ml/pipeline.sh create mode 100644 ml/prep/build_dataset.cjs create mode 100644 ml/prep/export_kin.cjs create mode 100644 ml/prep/npy.cjs create mode 100755 ml/prep/run_prep.sh create mode 100644 ml/requirements.txt create mode 100644 ml/serve.py create mode 100644 ml/sim/__init__.py create mode 100644 ml/sim/closed_loop.py create mode 100644 ml/train.py create mode 100644 tests/policy_bench.cjs create mode 100644 webapp/js/ik-policy-glue.js create mode 100644 webapp/js/ik-policy.js create mode 100644 webapp/models/README.md diff --git a/.gitignore b/.gitignore index 90546d9..cf92153 100644 --- a/.gitignore +++ b/.gitignore @@ -1,46 +1,41 @@ + # Python -__pycache__/ -*.pyc - -# 构建产物(可用 python -m arm.* 重新生成) -out/ - -# 临时调试脚本与截图 -scratch/ - -# 单文件查看器优化前的完整备份(带版本标识,勿随手删) -backups/ - -# 重构前的源码快照与脚本自动备份(git 历史里已有旧版本,不重复入库) -.bak/ -*.bak_* - -# 编辑器 / 系统文件 -Thumbs.db -Desktop.ini - -# 构建产物:由 python -m arm.* 重新生成,体积大(mesh 14MB + 单文件查看器 16MB×3), -# 过去被跟踪导致仓库背着 47MB 生成物;取消跟踪后重建不再脏 git status。 -# 旧 web/ 单文件产物目录(已删,源码在 webapp/) -web/ -/机器人手臂3D查看器.html -webapp/data/ -webapp/generated/ -dist/ -data/cache/ - -# 关卡截图落点 = 纯生成物:每次 `python -m tests.verify --shots` 由 shot.py 重写 -# (其中有 13 张在同一份构建下也不逐字节复现,抗锯齿/量化噪声)。 -# 比对的权威物在 tests/baselines/ —— shots_stable.md5 是 92 张的 md5 名单, # flaky/ 是那 13 张的参考像素 + thresholds.json 阈值;PNG 本身不需要入库。 -docs/shots/ - +# 临时调试脚本与截图 +# 关卡截图落点 = 纯生成物:每次 `python -m tests.verify --shots` 由 shot.py 重写 +# 关卡比对的权威物是 tests/baselines/(md5 名单 + flaky 参考像素),不在这里。 # 其它编辑器的本地配置/会话残留(不是工程产物,也不该跟着版本走) +# 单文件查看器优化前的完整备份(带版本标识,勿随手删) +# 定位图/ 只是"给用户看的核验图落点",一次性、会反复清空; +# 旧 web/ 单文件产物目录(已删,源码在 webapp/) +# 构建产物(可用 python -m arm.* 重新生成) +# 构建产物:由 python -m arm.* 重新生成,体积大(mesh 14MB + 单文件查看器 16MB×3), +# 比对的权威物在 tests/baselines/ —— shots_stable.md5 是 92 张的 md5 名单, +# 编辑器 / 系统文件 +# 过去被跟踪导致仓库背着 47MB 生成物;取消跟踪后重建不再脏 git status。 +# 重构前的源码快照与脚本自动备份(git 历史里已有旧版本,不重复入库) +# (其中有 13 张在同一份构建下也不逐字节复现,抗锯齿/量化噪声)。 +*.bak_* +*.pyc +.bak/ .trae/ .workbuddy/ .zcode/ .zcodeignore - -# 定位图/ 只是"给用户看的核验图落点",一次性、会反复清空; -# 关卡比对的权威物是 tests/baselines/(md5 名单 + flaky 参考像素),不在这里。 +/机器人手臂3D查看器.html +Desktop.ini +Thumbs.db +__pycache__/ +backups/ +data/cache/ +dist/ +docs/shots/ +ml/data/ +ml/node_modules/ +ml/runs/ +out/ +scratch/ +web/ +webapp/data/ +webapp/generated/ 定位图/ diff --git a/docs/Transformer轨迹拟合训练方案.html b/docs/Transformer轨迹拟合训练方案.html index 3e794e8..b7fbabb 100644 --- a/docs/Transformer轨迹拟合训练方案.html +++ b/docs/Transformer轨迹拟合训练方案.html @@ -431,7 +431,7 @@ MeanFlow 模型规模 -约 4.1M 参数编码器-解码器 Transformer,不用 VLA 大模型 +约 4.9M 参数编码器-解码器 Transformer,不用 VLA 大模型 A IMPACT 4.67M、300 Hz;π0 3B 单次预填充 46 ms(4090) @@ -997,14 +997,16 @@ a_max 为待定参数,真机型号确定后设定),dt = 20 ms。
  • 每条路径约 40–50 个样本 → 约 200 万样本(以 stats.json 为准)。
  • -
  • 协变量偏移对策:关节噪声增广(σ = -1°,噪声状态由老师离线重标);偏离状态的进一步覆盖靠 §7。
  • +
  • 协变量偏移对策:关节噪声增广(30% 样本,σ = 1°;噪声态须无干涉且间隙 +> 1 mm,标签为 8 步内线性收回老师轨迹的增量);偏离状态的进一步覆盖靠 +§7。
  • 4.6 耗时与存储

    4.7 检查点


    5. 表示与预处理

    -

    文件 ml/prep/build_dataset.py → -train/val/test.parquet、norm.json。

    +

    文件 +ml/prep/build_dataset.cjs(Node,特征直接调用部署运行时 +webapp/js/ik-policy.js 的同一份实现)→ +ml/data/samples/*.{X,Y,V,SG,TID}.npy + +*.tasks.jsonl;按任务 5% 划为验证集。PyTorch 侧特征 +ml/common/features.py 与 JS 逐项对拍(闭环仿真与 APG +使用)。

    5.1 输入

    @@ -1123,7 +1130,7 @@ type="checkbox" />ml/data/stats.json:类别、到达率、行程 - +
    参数量约 4.1M约 4.9M
    @@ -1275,10 +1282,15 @@ Hz)与 20 ms 不整除及后台节流造成的抖动。

    8.3 安全层(唯一的硬保证)