Skip to content

Commit 2a3bb4c

Browse files
committed
feat(deploy): added g1 23dof deploy support
1 parent 0485c05 commit 2a3bb4c

21 files changed

+554
-124
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[![Python](https://img.shields.io/badge/Python3.8-3776AB?logo=python&logoColor=fff)](#)
99
[![Ubuntu](https://img.shields.io/badge/Ubuntu22.04-E95420?logo=ubuntu&logoColor=white)](#)
1010
[![License](https://img.shields.io/badge/License-Apache_2.0-green?logo=apache&logoColor=white)](./LICENSE)
11+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/HorizonRobotics/HoloMotion)
1112

1213
<!-- [![arXiv](https://img.shields.io/badge/arXiv-2025.00000-red?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2025.00000) -->
1314
<!-- [![arXiv](https://img.shields.io/badge/arXiv-2025.00000-red?logo=arxiv&logoColor=white)](https://arxiv.org/abs/2025.00000) -->
@@ -121,8 +122,8 @@ Deploy the exported ONNX model using our ROS2 package to run on real-world robot
121122
author = {Maiyue Chen, Kaihui Wang, Bo Zhang, Yi Ren, Zihao Zhu, Yucheng Wang, Zhizhong Su},
122123
title = {HoloMotion: A Foundation Model for Whole-Body Humanoid Motion Tracking},
123124
year = {2025},
124-
month = july,
125-
version = {0.4.0},
125+
month = september,
126+
version = {0.4.1},
126127
url = {https://github.com/HorizonRobotics/HoloMotion},
127128
license = {Apache-2.0}
128129
}

docs/train_motion_tracking.md

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,25 @@ The LMDB database will be created at the specified `dump_dir`.
4949

5050
### 2. Train the Motion Tracking Model
5151

52-
The training entry point is `holomotion/src/training/train_motion_tracking.py`, which uses the training config to start distributed training across multiple GPUs.
52+
```mermaid
53+
flowchart LR
54+
55+
A[Teacher Stage 1] --> B[Teacher Stage 2]
56+
B --> C[Student Distillation]
57+
C --> D[ONNX Model]
58+
59+
classDef dashed stroke-dasharray: 5 5, rx:10, ry:10, fill:#c9d9f5
60+
classDef normal fill:#c9d9f5, rx:10, ry:10
61+
class D dashed
62+
class A,B,C normal
63+
```
64+
65+
The training entry point is `holomotion/src/training/train_motion_tracking.py`, which uses the training config to start distributed training across multiple GPUs. It is recommended to train with a three-stage procedure:
66+
1. Teacher training stage 1: train the teacher policy without domain randomization;
67+
2. Teacher training stage 2: load the stage1 checkpoint and train with domain randomization;
68+
3. Student training stage 3: load the teacher stage2 checkpoint and conduct distillation with domain randomization.
5369

54-
#### 2.1 Prepare the Training Config
70+
#### 2.1 Explaining the Training Config
5571

5672
Use the demo config at `holomotion/config/training/motion_tracking/exp_unitree_g1_21dof_teacher.yaml` as a template. Key configuration groups to modify (configs are located in the `holomotion/config/` directory):
5773

@@ -80,18 +96,47 @@ defaults:
8096
project_name: HoloMotion
8197
```
8298
83-
#### 2.2 Prepare the Training Script for Teacher
99+
#### 2.2 Prepare the Training Scripts for Teacher (Stage 1 and 2)
84100
85101
Review and modify the training script at `holomotion/scripts/training/train_motion_tracking_teacher.sh`. Ensure `config_name` and `motion_file` match your training config and LMDB database directory.
86102

103+
Start training your teacher policy from stage1, where domain randomization is turned off.
104+
105+
```shell
106+
source train.env
107+
export CUDA_VISIBLE_DEVICES="0"
108+
109+
config_name="train_your_robot_teacher_stage1"
110+
motion_file="data/lmdb_datasets/your_lmdb_path"
111+
num_envs=2048
112+
113+
${Train_CONDA_PREFIX}/bin/accelerate launch \
114+
--multi_gpu \
115+
--mixed_precision=bf16 \
116+
holomotion/src/training/train_motion_tracking.py \
117+
--config-name=training/motion_tracking/${config_name} \
118+
use_accelerate=True \
119+
num_envs=${num_envs} \
120+
headless=True \
121+
experiment_name=${config_name} \
122+
motion_lmdb_path=${motion_file}
123+
```
124+
125+
```shell
126+
bash holomotion/scripts/training/train_motion_tracking_teacher_stage1.sh
127+
```
128+
129+
After finishing your stage1 teacher training, you should start teacher stage2 training loading this checkpoint:
87130
```shell
88131
source train.env
89132
export CUDA_VISIBLE_DEVICES="0"
90133
91-
config_name="exp_unitree_g1_21dof_teacher"
92-
motion_file="data/lmdb_datasets/lmdb_g1_21dof_test"
134+
config_name="train_your_robot_teacher_stage2"
135+
motion_file="data/lmdb_datasets/your_lmdb_path"
93136
num_envs=2048
94137
138+
checkpoint="your_stage1_teacher_ckpt_path.pt"
139+
95140
${Train_CONDA_PREFIX}/bin/accelerate launch \
96141
--multi_gpu \
97142
--mixed_precision=bf16 \
@@ -107,7 +152,7 @@ ${Train_CONDA_PREFIX}/bin/accelerate launch \
107152
Start training by running:
108153

109154
```shell
110-
bash holomotion/scripts/training/train_motion_tracking_teacher.sh
155+
bash holomotion/scripts/training/train_motion_tracking_teacher_stage2.sh
111156
```
112157

113158
#### 2.3 Prepare the Training Script for Student
@@ -120,10 +165,10 @@ To start the studnet training, you should specify the studnet training config na
120165
source train.env
121166
export CUDA_VISIBLE_DEVICES="0"
122167
123-
config_name="train_unitree_g1_21dof_student"
124-
teacher_ckpt_path="logs/HoloMotion/xxxxxxxx_xxxxxx-train_unitree_g1_21dof_teacher/model_x.pt"
125-
motion_file="data/lmdb_datasets/lmdb_g1_21dof_test"
126-
num_envs=16
168+
config_name="train_your_robot_student"
169+
teacher_ckpt_path="your_teacher_stage2_ckpt_path.pt"
170+
motion_file="data/lmdb_datasets/your_lmdb_path"
171+
num_envs=2048
127172
128173
${Train_CONDA_PREFIX}/bin/accelerate launch \
129174
--multi_gpu \
@@ -171,6 +216,6 @@ You may want to have more or less frequent logging and model dumping intervals.
171216

172217
By default, the model checkpoint will be dumped into a folder named `logs/HoloMotion`. You can change this path by explictly setting `project_name=X`, which results in dumping the checkpoints into the `logs/X` directory.
173218

174-
#### How to resume training from a checkpoint ?
219+
#### How to resume training or load pretrained model from a checkpoint ?
175220

176221
To resume training from a pretrained checkpoint, you can find the checkpoint in the log directory, and then add the option like this: `checkpoint=logs/HoloMotion/20250728_214414-train_unitree_g1_21dof_teacher/model_X.pt`

holomotion/config/algo/dagger.yaml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,40 +89,48 @@ algo:
8989
action_scale: ${robot.control.action_scale}
9090
default_dof_pos_dict: ${robot.init_state.default_joint_angles}
9191
dof_order: ${robot.dof_names}
92-
num_fine_experts: 3
92+
num_fine_experts: 5
9393
num_shared_experts: 1
9494
top_k: 2
9595
load_balancing_loss_alpha: 0.01
9696
bound_loss_alpha: 10.0
97-
projection_dim: 512
98-
hidden_dim: 512
97+
projection_dim: 2048
98+
hidden_dim: 1024
9999

100100
actor:
101-
type: MLP
101+
type: MoEMLP
102+
predict_local_body_pos: ${algo.algo.config.predict_local_body_pos}
103+
pred_local_body_pos_dim:
104+
${eval:'(${algo.algo.config.num_rigid_bodies} + ${algo.algo.config.num_extended_bodies})
105+
* 3'}
106+
predict_local_body_vel: ${algo.algo.config.predict_local_body_vel}
107+
pred_local_body_vel_dim:
108+
${eval:'(${algo.algo.config.num_rigid_bodies} + ${algo.algo.config.num_extended_bodies})
109+
* 3'}
110+
predict_root_lin_vel: ${algo.algo.config.predict_root_lin_vel}
102111
fix_sigma: true
112+
use_layernorm: false
103113
input_dim:
104114
- actor_obs
105115
output_dim:
106116
- robot_action_dim
107-
predict_local_body_pos: false
108-
predict_local_body_vel: false
109-
predict_root_lin_vel: false
110-
layer_config:
111-
hidden_dims:
112-
- 2048
113-
- 1024
114-
- 512
115-
- 256
116-
activation: SiLU
117-
use_layernorm: false
118-
117+
max_sigma: 1.2
118+
min_sigma: 0.2
119119
clamp_output:
120120
enabled: true
121121
raw_lower_bound: ${robot.dof_pos_lower_limit_list}
122122
raw_upper_bound: ${robot.dof_pos_upper_limit_list}
123123
action_scale: ${robot.control.action_scale}
124124
default_dof_pos_dict: ${robot.init_state.default_joint_angles}
125125
dof_order: ${robot.dof_names}
126+
num_fine_experts: 5
127+
num_shared_experts: 1
128+
top_k: 2
129+
load_balancing_loss_alpha: 0.01
130+
bound_loss_alpha: 10.0
131+
projection_dim: 2048
132+
hidden_dim: 1024
133+
126134

127135
critic: {}
128136

holomotion/config/algo/ppo.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ algo:
3030
schedule: adaptive
3131
desired_kl: 0.01
3232
init_noise_std: 0.8
33+
donot_load_critic: false
3334
# ---
3435

3536
# --- Dagger Related Settings ---
@@ -94,26 +95,26 @@ algo:
9495
action_scale: ${robot.control.action_scale}
9596
default_dof_pos_dict: ${robot.init_state.default_joint_angles}
9697
dof_order: ${robot.dof_names}
97-
num_fine_experts: 3
98+
num_fine_experts: 5
9899
num_shared_experts: 1
99100
top_k: 2
100101
load_balancing_loss_alpha: 0.01
101102
bound_loss_alpha: 10.0
102-
projection_dim: 512
103-
hidden_dim: 512
103+
projection_dim: 2048
104+
hidden_dim: 1024
104105

105106
critic:
106107
type: MoEMLP
107108
input_dim:
108109
- critic_obs
109110
output_dim:
110111
- 1
111-
num_fine_experts: 3
112+
num_fine_experts: 5
112113
num_shared_experts: 1
113114
top_k: 2
114115
load_balancing_loss_alpha: 0.01
115-
projection_dim: 512
116-
hidden_dim: 512
116+
projection_dim: 2048
117+
hidden_dim: 1024
117118

118119
disc: {}
119120

holomotion/config/env/domain_randomization/domain_rand_base.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ domain_rand:
3434
randomize_torque_rfi: True
3535
rfi_lim: 0.1
3636
randomize_rfi_lim: True
37-
rfi_lim_range: [0.8, 1.2]
37+
rfi_lim_range: [0.9, 1.1]
3838

3939
# control delay
4040
randomize_ctrl_delay: True

0 commit comments

Comments
 (0)