cleanup: drop never-runnable G1 deploy scripts, bind docs to task owners(issue #1029) - #1343
Merged
Merged
Conversation
scripts/deploy/ (6 files, 1715 LOC) hard-coded owner-derived values instead of reading them through Hydra, violating Config first / Fix at owner layer. Verified defects behind the removal: - sim_prototype.py never ran since 0e534e1: it looks up MuJoCo sensor "gyro", but robots/g1/ only ever exposed pelvis_gyro / torso_gyro (true at the introducing commit too). The documented pre-bringup obs validation therefore never executed once. - Docs bound the exporter to ppo/g1_motion_tracking, whose composed action_scale falls back to the dataclass default 0.25 with a 160-wide actor obs, while the exporter emits 2.0 / 514. Only sac/g1_wbt_obs matches on both axes; the ONNX width check catches the obs mismatch but action_scale would be silently off by 8x. - --enable-zero-anchor-pos / --enable-zero-linvel used action="store_true" with default=True, so neither could ever be False, leaving two layout branches and two segment aliases unreachable. - sim_prototype used the XML timestep (substeps=3) while the owner declares env.sim_dt 0.005 (substeps=4), so the "same config" check stepped at a different rate. - export_deploy_config.py rejected the registered 23-dof owners (Expected 29 actuators, got 23). - warmup/cooldown/motion_primitives (688 LOC) plus 7 emitted config fields had zero in-repo consumers. test_obs_alignment_g1_wbt.py keeps the contract it actually guards: the training-side ring buffer (_fill_obs_history / _push_obs_history + _build_actor_obs order) is now compared directly against per-term deque semantics, dropping the importlib hop through sim_prototype.ObsAssembler. The H=1 case proves plain layout-order concat on its own. Deployment docs (zh/en symmetric) now derive the hardware contract from the task owner YAML and its scene XML, and state that action_scale's scalar vs per-joint-list form must be reproduced exactly - no averaging, first-entry, or silent broadcast. The 514 / 154 actor widths quoted there were read off the running envs. tracking_obs.py: comments only, no code lines. Claims of byte-alignment with an external ObservationManager / use_gym_history flag had no remaining repo evidence (Evidence only), so they now describe per-term deque semantics and point at the guarding test. Training side untouched: conf/ unchanged, no src/ code lines changed, G1WBTObs / G1WBTObs23Dof / G1MotionTracking / G1MotionTrackingDeploy all still register, construct, reset and step (514 / 154 widths confirmed). Validation on this head: make test-all green - ruff format --check (476 files), ruff check, mypy (229 files), pyright (0 errors), pytest -m "not slow" 1759 passed / 25 skipped / 1 xfailed at 73.60% coverage, benchmark smoke 32/33 + 33/34 (1 platform-optional mlx skip). Sphinx -n build succeeds; its one remaining warning (en 9-sim2sim_contract_status) predates this branch. Full-repo sweep for the removed paths returns zero hits. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
针对原motion tracking任务sac算法的部署端特供脚本,现训练端及docs内容做相应改动和清理 |
TATP-233
approved these changes
Aug 27, 2026
TATP-233
added a commit
that referenced
this pull request
Sep 4, 2026
…-scripts cleanup: drop never-runnable G1 deploy scripts, bind docs to task owners(issue #1029)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
scripts/deploy/的 6 个脚本(1715 LOC)把 owner 派生值硬编码为模块常量,而不经Hydra 读取,违反 Config first 与 Fix at owner layer。
移除依据(均为实跑 / compose 验证,非代码审读推断)
1.
sim_prototype.py自0e534e13引入起从未成功运行该脚本查
mj_name2id(model, mjOBJ_SENSOR, "gyro"),而robots/g1/只暴露pelvis_gyro/torso_gyro。git show 0e534e13:src/unilab/assets/robots/g1/g1.xml确认引入当天亦如此,且
git log -S'"gyro"' -- scripts/deploy/sim_prototype.py只返回引入那一个 commit——该行从未被改动。
文档称其为"上机前的字节级验证",而它一次都没执行过。这违反 Validate near risk:
验证挂在最接近风险的边界上,但那个边界是断的。
2. 文档规定的 owner 绑定是错的(不是"未确认")
两份
2-g1_whole_body.md原先都是eval --algo ppo --task g1_motion_tracking→ 跑 exporter。Hydra compose + 实跑 env 结果:
action_scaleppo/g1_motion_trackingppo/g1_motion_tracking_deployoffpolicy/sac/g1_wbt_obs唯一两轴都吻合的是
g1_wbt_obs。文档指的 owner 两轴都不吻合——ONNX 宽度不匹配会被拦住(那个检查有效),但
action_scale会静默错 8 倍。这同时解答了原 issue 结论 3 悬置的疑问:仓内不存在任何 owner 既是 514-d/H=5
又带非均匀 list。514 唯一属于
g1_wbt_obs(标量 2.0);29 维 list 唯一属于g1_motion_tracking_deploy(154-d,H=1)。exporter 的 H=1 schema 恰好逐段等于build_mimic_actor_obs的顺序——正确的 obs schema 配错误的 action 映射,这才是漂移的真实形态。原 issue 结论 2"仓内不存在 action-scale 数值或形态漂移"
成立;漂移在 owner 绑定上。
3. 两个 CLI flag 物理上无法取
False--enable-zero-anchor-pos/--enable-zero-linvel使用action="store_true", default=True:带不带 flag 都是True。两个布局分支(
motion_anchor_pos_b、base_lin_vel)与两个 segment 别名(base_lin_vel、linvel)不可达。--help承诺了不存在的能力。4.
sim_dt漂移exporter 硬编码
CTRL_DT = 0.02(与 owner 一致),但 prototype 直接用 XML 的model.opt.timestep = 0.006667→ substeps=3;owner 声明env.sim_dt: 0.005→ substeps=4,且 prototype 从不写回。所谓"用同一份配置验证",物理步长本身不同。
5. 23-dof 直接失败
而
G1WBTObs23Dof(action_scale: 2.0)与G1MotionTracking23DofDeploy(23 维 list)均已注册。支持面不对称且无任何测试或文档记录。
6. exporter 不读任何 owner YAML(核心契约违反)
ACTION_SCALE=2.0、CTRL_DT=0.02、DEFAULT_OBS_HISTORY_LENGTH=5、ANCHOR_BODY_NAME、training_noise_scales5 个数值、TRACKED_BODY_NAMES(全仓第三份副本,另两份在
export_motion_bin.py与common/config.py:125)全部硬编码。今天这些值对
g1_wbt_obs全部吻合,仓内无数值漂移——但每一个都是静默漂移陷阱:改 owner YAML 不会有任何东西提示 exporter 也要改。正确做法仓内已有先例:
scripts/audit_sim2sim_contracts.py:53-67用initialize_config_dir+compose读 owner。
7. 零 in-repo 消费者
prepend_warmup.py/append_cooldown.py/motion_primitives.py(688 LOC)在 docs / tests / CI / Makefile 中零引用
deploy_config.yaml的joint_ids_map(identity 占位)/force_lower/force_upper/training_noise_scales(纯注释且重复 owner noise config)/joint_names/obs_history_length/kp/kd— 零消费者build_obs_from_layout()定义后从未被调用load_motion_bin在sim_prototype.py与motion_primitives.py各一份(
d20a5411那次去重漏了前者)test_obs_alignment_g1_wbt.pyimportlib 加载sim_prototype仅为取
ObsAssembler——1715 LOC 中约 90 LOC改动内容
删除
scripts/deploy/全部 6 文件(−1715 LOC)sim_prototype.pyexport_deploy_config.pyappend_cooldown.pyprepend_warmup.pyexport_motion_bin.pyTRACKED_BODY_NAMES),仅服务已删链路motion_primitives.pygit 历史(
0e534e13..HEAD)保留全部内容。测试收敛,守护的不变量不变
移除"schema 端"那条腿(importlib 加载
sim_prototype.ObsAssembler)。保留的两条腿现在直接对照:
_fill_obs_history/_push_obs_historyring buffer 语义 +_build_actor_obs装配顺序(测试内以纯 numpy 复现)_DeployTerm,测试内早已完整实现)TestBackCompat的 H=1 用例改为自证"H=1 等价于按布局顺序平铺 concat",不再需要外部 assembler。测试同时不再从
tests/反向依赖scripts/的内部类。部署文档 14 文件(zh / en 严格对称)
2-g1_whole_body.md×2g1_wbt_obs(514/H=5) 与g1_motion_tracking_deploy(154/H=1) 对照表;§3 明确action_scale标量与逐关节列表形态不可互换,禁止取平均 / 取首项 / 静默广播;eval示例改为--algo sac --task g1_wbt_obs5-onnx_runtime.md×28-latency_budget.md×27-safety_layers.md×2deploy_config.yaml字段块 → 权威来源表(action_scale←owner YAML;default_angles/ 限位 /kp/kd←场景 XML)9-troubleshooting.md×2_build_actor_obs;bug report 清单改为 owner YAML 路径1-overview.md×22-motion_tracking.md×2scripts/deploy/"文档中的 514 / 154 是从跑起来的 env 读出来的,非抄自被删脚本的注释。
原 issue 要求保留的语义(形态保真、禁止平均 / 取首项 / 广播)现以契约说明
落在
2-g1_whole_body.md§3 与7-safety_layers.md。将来若重建导出链,不必再从外部源码推导。
src/仅注释,零代码行tracking_obs.py原先在 3 处断言"与部署侧ObservationManager/ObservationTermCfg按字节对齐(use_gym_history=false)"。删除脚本后仓内已无该 flag 与该类的任何证据,按 Evidence only 改为陈述逐项 deque 语义并指向
守护它的测试。另按 review 要求移除两文件的
#注释与 module docstring(保留类 / 方法 docstring 与 2 条
# type: ignore[assignment]—— 后者是 mypy指令,删除会导致
make type失败)。所有注释改动经 AST 逐节点比对确认未触碰代码。Validation
在最终 head 运行
make test-all,全绿:ruff format --check .ruff check .mypy src/unilabpyrightpytest -m "not slow" --cov --cov-fail-under=25scripts/benchmark/smoke_test.pymlx)-n严格构建(复现docs.yml)Sphinx 余下的 1 条 warning(
en侧unknown document: '../../4-developer_guide/9-sim2sim_contract_status')先于本分支存在:en 侧无该文件(仅 zh 有),且
7-config_guard.md不在本 PR 改动范围。已通过 stash 验证。训练端未受影响(实跑证据)
conf/零改动;src/零代码行改动G1WBTObs/G1WBTObs23Dof/G1MotionTracking/G1MotionTrackingDeploy四个注册项完好
G1WBTObs在 owner overrides 下构造 +reset+step:actor 宽度 514(
obs_groups_spec: {'obs': 514, 'critic': 289}),step 后稳定;G1MotionTrackingDeploy154tests/envs/test_env_configs.py273 passedDangling reference 清零
全仓(排除
.git/.venv/__pycache__/logs)扫描scripts/deploy|sim_prototype|export_deploy_config|export_motion_bin|prepend_warmup|append_cooldown|motion_primitives|deploy_config|dance1.bin|State_WBT→ 零命中。
排除的 false positive(确认无关,未改动):
SymmetryObsLayout(
locomotion/g1/的对称性特性)、测试内自有的obs_layoutfixture、dance1_subject2_part.npz(训练用运动资产,与已删的dance1.bin无关)。未做 / 待 maintainer 确认
为非均匀 list 时是否应主动 fail-closed"已无载体。我没有替它下结论;其语义已
转为文档契约。是否可以据此关闭该 issue,请 maintainer 判断。
tracking_obs.py原 module docstring 记录了G1WBTObs相对基类新增的 7 项能力及"基类不受影响"这一契约,现仅存于 git 历史。如需保留,建议补入
2-motion_tracking.md(该文件已在本 PR 范围内)——尚未执行,等确认。PR Gate
git status --short --branch工作树干净make test-all(结果见上)main,故按 CLAUDE.md gate 需等待远程 CI 全绿后再报告完成