Skip to content

chore(g1/23dof): host motion npz on HuggingFace, keep git history clean #pr 691#698

Closed
LeeLeno wants to merge 13 commits into
unilabsim:mainfrom
LeeLeno:feat/g1-23dof-hf-motions
Closed

chore(g1/23dof): host motion npz on HuggingFace, keep git history clean #pr 691#698
LeeLeno wants to merge 13 commits into
unilabsim:mainfrom
LeeLeno:feat/g1-23dof-hf-motions

Conversation

@LeeLeno

@LeeLeno LeeLeno commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

What & Why

G1 23-DoF motion tracking 的参考轨迹(npz)此前直接提交进 git,导致仓库历史膨胀。本 PR 将全部 motion npz 迁移到 HuggingFace 数据集 unilabsim/unilab-motions,运行时按需下载,并保证 git 历史中零 npz blob

Changes

  • 资产迁移到 HF:5 个任务参考轨迹(dance / flip / wall-flip / climb / box tracking)上传至 HF 顶层 motions/g1/;env 通过 resolve_motion_files()src/unilab/assets/hub.py)在文件缺失时自动从 HF 下载。
  • 历史瘦身:分支历史经重写,不含任何 motion npz blobgit rev-list --objects HEAD | grep '\.npz' → 0)。
  • .gitignore 收严:新增 src/unilab/assets/motions/g1/**/*.npz 递归规则,防止子目录下的 npz 再次被误提交。
  • 转换脚本:纳入 scripts/convert_motion_29dof_to_23dof.py(29→23 DoF:移除 6 个 RM 关节 + body 重映射),记录 23-DoF 轨迹的生成来源。

Runtime download

env config 中的 motion_file 指向 ASSETS_ROOT_PATH / "motions" / "g1" / "<name>_23dof.npz"MotionLoaderresolve_motion_files() 逻辑:本地存在即用,否则从 unilabsim/unilab-motions 拉取对应相对路径(支持 HF_ENDPOINT 镜像回退到官方端点)。下载物被 .gitignore 覆盖,不污染工作树。

HF asset state

  • 顶层 motions/g1/ 新增 5 个 *_23dof.npz(均校验为合法 23-DoF:joint_pos 23 列、25 bodies;box 轨迹含 object 数据)。
  • 清理了此前误传的 18 个未被任何 task 引用的 23dof_amp/ locomotion 文件。

Validation

  • make test-allcheck 阶段(ruff format + ruff check + mypy + pyright)全部通过:Success: no issues found in 222 source files / pyright 0 errors, 14 warnings
  • 端到端自动下载(真实生产类):删除本地全部 5 个 npz 并清空 HF cache 后,用 env 实际调用的 MotionLoader(内部 resolve_motion_files → HF 下载 → np.load)逐一加载 5 个 task 默认 motion,全部成功从 HF 拉回并解析(帧数 715/225/198/602/725,DoF=23,box 轨迹含 object 数据);下载物被 .gitignore 覆盖,工作树保持干净。
  • 训练 CLI 管道uv run train --algo ppo --task g1_23dof_flip_tracking --sim motrix 完成参数解析 → Hydra 配置组装 → 后端选择,停在后端初始化门槛(本地未装 motrix/mujoco extra,环境依赖问题,非代码回归)。
  • 历史洁净性git rev-list --objects HEAD | grep '\.npz' 计数为 0(含 nan_dump 在内任何 .npz blob 均为 0);相对 main 的 diff 中 npz 文件数为 0。
  • 注:pytest 全量在本地环境因缺可选后端依赖 mujoco 出现 collection error(3 个 test 模块 import 阶段失败),与本 PR 改动无关(改动仅涉及 scripts/ 脚本、conf/、env 代码与 .gitignore,未触碰相关测试模块)。

hero and others added 13 commits July 13, 2026 17:10
… backend

Two-part fix for the G1 23-DoF box_tracking ValueError
'operands could not be broadcast together with shapes (N,16) (23,)':

1. BoxMotionLoader fallback: remove erroneous '-7' from
   n_robot_joints calc when joint_names is absent.
   23-DoF motion data joint_pos is pure robot joints (23)
   without floating base, so subtracting 7 truncated to 16.

2. MotrixBackend get_dof_pos/get_dof_vel: use actuator-level
   joint indices (_actuator_joint_pos/vel_indices) instead of
   body.get_joint_dof_pos/vel() which returned wrong dim for
   23-DoF model.

Also includes pre-existing uncommitted updates:
- Register motrix backend for G1Walk23DofFlat/Rough and G1WBTObs23Dof
- Add pose_weights to g1_23dof_walk_flat motrix config
- Update support matrix (23-DoF tasks marked Tested/Registered for motrix)
- Add g1_23dof_walk_rough mujoco config
- Ignore .sisyphus/ directory
- Remove G1_23DOF_INIT.md from tracking (internal doc, now gitignored)
- Ignore internal docs: G1_23DOF_INIT.md, G1_23DOF_PR_CHECKLIST.md,
  APPO_HARDWARE_TIMING_ANALYSIS.md
- Add conf/offpolicy/task/flashsac/g1_23dof_walk_flat/motrix.yaml
  (FlashSAC 23-DoF motrix config, trained and verified)
- Run generate_support_matrix.py to update 23-DoF support status
- Ignore log/ directory (training checkpoints/ONNX exports)
The 18 g1 23-DoF AMP motion clips under motions/g1/23dof_amp/ are now
hosted on the unilabsim/unilab-motions HF dataset and pulled on demand,
mirroring how g1/x2 motions and x2 meshes are already handled. Their
blobs are purged from this branch's history; .gitignore is extended to
cover nested motion subdirectories so they cannot be re-committed, and
.gitkeep placeholders preserve the directory layout for HF downloads.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Wrap long assert message to satisfy repo ruff line-length config.
Cherry-picked script from fork was authored against a looser style.
@TATP-233

Copy link
Copy Markdown
Collaborator

澄清和 #691 的关系,原pr的处理方式

@LeeLeno

LeeLeno commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

#691 涉及分支无权限,故fork作者仓库后另提pr。
改动仅为原仓库git log瘦身,npz处理及rebase最新main。无其余代码逻辑改动

@Kennyp-Chen

Copy link
Copy Markdown

@LeeLeno @TATP-233 这个 PR 在做 filter-branch 时,commit 的 author 信息变成了 LeeLeno,同时我本机 git 配置误绑定为 "hero",没绑定 GitHub 账号。这样合并后 GitHub 无法把我的 contribution 归到我名下。

麻烦 @LeeLeno 在分支上跑一下 filter-branch 把 commit authors 修正成我的 GitHub 账号(Kennyp-Chen [email protected]),然后 force push。合进来后 contribution 记录就正常了,谢谢!

如果不方便操作的话,告诉我,我来处理也可以。

@LeeLeno

LeeLeno commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

@Kennyp-Chen 直接拉取我fork仓库中feat/g1-23dof-hf-motions,修正信息后force push到你的pr

@Kennyp-Chen Kennyp-Chen mentioned this pull request Jul 14, 2026
7 tasks
@LeeLeno LeeLeno closed this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants