Safetensors
English
zhenyuzhao commited on
Commit
36acb8e
·
verified ·
1 Parent(s): 5e3761c

Upload gr00t SIMPLE checkpoint for G1WholebodyHandoverSonic-v0

Browse files

Local source: /hfm/zhenyu/psi_develop_runs/quickstart_finish_20260408/gr00t/G1WholebodyHandoverSonic-v0/checkpoint-40000
Completed DR levels: L0=0%
Eval root: /hfm/zhenyu/psi_develop_runs/simple_gr00t_eval_20260407/G1WholebodyHandoverSonic-v0

Files changed (23) hide show
  1. gr00t/simple/G1WholebodyHandoverSonic-v0/config.json +70 -0
  2. gr00t/simple/G1WholebodyHandoverSonic-v0/embodiment_id.json +14 -0
  3. gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/conf.yaml +253 -0
  4. gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/config.yaml +327 -0
  5. gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/dataset_statistics.json +641 -0
  6. gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/final_model_config.json +53 -0
  7. gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/final_processor_config.json +0 -0
  8. gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  9. gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
  10. gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/mp_rank_00_model_states.pt +3 -0
  11. gr00t/simple/G1WholebodyHandoverSonic-v0/latest +1 -0
  12. gr00t/simple/G1WholebodyHandoverSonic-v0/model-00001-of-00002.safetensors +3 -0
  13. gr00t/simple/G1WholebodyHandoverSonic-v0/model-00002-of-00002.safetensors +3 -0
  14. gr00t/simple/G1WholebodyHandoverSonic-v0/model.safetensors.index.json +0 -0
  15. gr00t/simple/G1WholebodyHandoverSonic-v0/processor_config.json +514 -0
  16. gr00t/simple/G1WholebodyHandoverSonic-v0/rng_state_0.pth +3 -0
  17. gr00t/simple/G1WholebodyHandoverSonic-v0/rng_state_1.pth +3 -0
  18. gr00t/simple/G1WholebodyHandoverSonic-v0/scheduler.pt +3 -0
  19. gr00t/simple/G1WholebodyHandoverSonic-v0/statistics.json +0 -0
  20. gr00t/simple/G1WholebodyHandoverSonic-v0/trainer_state.json +0 -0
  21. gr00t/simple/G1WholebodyHandoverSonic-v0/training_args.bin +3 -0
  22. gr00t/simple/G1WholebodyHandoverSonic-v0/wandb_config.json +1 -0
  23. gr00t/simple/G1WholebodyHandoverSonic-v0/zero_to_fp32.py +760 -0
gr00t/simple/G1WholebodyHandoverSonic-v0/config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "action_horizon": 50,
3
+ "add_pos_embed": true,
4
+ "apply_sincos_state_encoding": true,
5
+ "architectures": [
6
+ "Gr00tN1d6"
7
+ ],
8
+ "attn_dropout": 0.2,
9
+ "attn_implementation": null,
10
+ "backbone_embedding_dim": 2048,
11
+ "backbone_model_type": "eagle",
12
+ "backbone_trainable_params_fp32": true,
13
+ "collator_overwrite_image_inputs": false,
14
+ "color_jitter_params": {
15
+ "brightness": 0.1,
16
+ "contrast": 0.1,
17
+ "hue": 0.1,
18
+ "saturation": 0.1
19
+ },
20
+ "crop_fraction": 0.95,
21
+ "diffusion_model_cfg": {
22
+ "attention_head_dim": 48,
23
+ "dropout": 0.2,
24
+ "final_dropout": true,
25
+ "interleave_self_attention": true,
26
+ "norm_type": "ada_norm",
27
+ "num_attention_heads": 32,
28
+ "num_layers": 32,
29
+ "output_dim": 1024,
30
+ "positional_embeddings": null
31
+ },
32
+ "eagle_collator": true,
33
+ "formalize_language": true,
34
+ "gemma_collator": false,
35
+ "hidden_size": 1024,
36
+ "image_crop_size": null,
37
+ "image_target_size": null,
38
+ "input_embedding_dim": 1536,
39
+ "load_bf16": true,
40
+ "max_action_dim": 128,
41
+ "max_num_embodiments": 32,
42
+ "max_seq_len": 1024,
43
+ "max_state_dim": 128,
44
+ "model_dtype": "bfloat16",
45
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
46
+ "model_type": "Gr00tN1d6",
47
+ "noise_beta_alpha": 1.5,
48
+ "noise_beta_beta": 1.0,
49
+ "noise_s": 0.999,
50
+ "num_inference_timesteps": 4,
51
+ "num_timestep_buckets": 1000,
52
+ "random_rotation_angle": null,
53
+ "reproject_vision": false,
54
+ "select_layer": 16,
55
+ "shortest_image_edge": 256,
56
+ "state_dropout_prob": 0.0,
57
+ "torch_dtype": "bfloat16",
58
+ "transformers_version": "4.51.3",
59
+ "tune_diffusion_model": true,
60
+ "tune_llm": false,
61
+ "tune_projector": true,
62
+ "tune_top_llm_layers": 4,
63
+ "tune_visual": false,
64
+ "tune_vlln": true,
65
+ "use_albumentations_transforms": true,
66
+ "use_alternate_vl_dit": true,
67
+ "use_flash_attention": true,
68
+ "use_relative_action": true,
69
+ "use_vlln": true
70
+ }
gr00t/simple/G1WholebodyHandoverSonic-v0/embodiment_id.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "robocasa_panda_omron": 13,
3
+ "gr1": 20,
4
+ "behavior_r1_pro": 24,
5
+ "unitree_g1": 8,
6
+ "oxe_google": 0,
7
+ "oxe_widowx": 1,
8
+ "libero_panda": 2,
9
+ "new_embodiment": 10,
10
+ "g1_ee_a16": 10,
11
+ "h1_ee_a16": 11,
12
+ "g1_upper_a16": 10,
13
+ "g1_loco_downstream": 10
14
+ }
gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/conf.yaml ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ load_config_path: null
2
+ model:
3
+ model_type: Gr00tN1d6
4
+ model_dtype: bfloat16
5
+ model_name: nvidia/Eagle-Block2A-2B-v2
6
+ backbone_model_type: eagle
7
+ model_revision: null
8
+ tune_top_llm_layers: 4
9
+ backbone_embedding_dim: 2048
10
+ tune_llm: false
11
+ tune_visual: false
12
+ select_layer: 16
13
+ reproject_vision: false
14
+ use_flash_attention: true
15
+ load_bf16: false
16
+ collator_overwrite_image_inputs: false
17
+ eagle_collator: true
18
+ backbone_trainable_params_fp32: true
19
+ image_crop_size: null
20
+ image_target_size: null
21
+ shortest_image_edge: 256
22
+ crop_fraction: 0.95
23
+ random_rotation_angle: null
24
+ color_jitter_params:
25
+ brightness: 0.3
26
+ contrast: 0.4
27
+ saturation: 0.5
28
+ hue: 0.08
29
+ use_albumentations_transforms: true
30
+ formalize_language: true
31
+ apply_sincos_state_encoding: true
32
+ use_relative_action: true
33
+ max_state_dim: 128
34
+ max_action_dim: 128
35
+ action_horizon: 50
36
+ hidden_size: 1024
37
+ input_embedding_dim: 1536
38
+ add_pos_embed: true
39
+ attn_dropout: 0.2
40
+ use_vlln: true
41
+ max_seq_len: 1024
42
+ use_alternate_vl_dit: true
43
+ attend_text_every_n_blocks: 2
44
+ diffusion_model_cfg:
45
+ attention_head_dim: 48
46
+ dropout: 0.2
47
+ final_dropout: true
48
+ interleave_self_attention: true
49
+ norm_type: ada_norm
50
+ num_attention_heads: 32
51
+ num_layers: 32
52
+ output_dim: 1024
53
+ positional_embeddings: null
54
+ num_inference_timesteps: 4
55
+ noise_beta_alpha: 1.5
56
+ noise_beta_beta: 1.0
57
+ noise_s: 0.999
58
+ num_timestep_buckets: 1000
59
+ tune_projector: true
60
+ tune_diffusion_model: true
61
+ tune_vlln: true
62
+ state_dropout_prob: 0.0
63
+ state_additive_noise_scale: 0.0
64
+ max_num_embodiments: 32
65
+ data:
66
+ datasets:
67
+ - dataset_paths:
68
+ - /hfm/data/simple_hf/G1WholebodyHandoverSonic-v0
69
+ embodiment_tag: g1_loco_downstream
70
+ mix_ratio: 1.0
71
+ dataset_type: physical_embodiment
72
+ val_dataset_path: null
73
+ modality_configs:
74
+ g1_loco_downstream:
75
+ video:
76
+ delta_indices:
77
+ - 0
78
+ modality_keys:
79
+ - rs_view
80
+ sin_cos_embedding_keys: null
81
+ mean_std_embedding_keys: null
82
+ action_configs: null
83
+ state:
84
+ delta_indices:
85
+ - 0
86
+ modality_keys:
87
+ - left_hand
88
+ - right_hand
89
+ - left_arm
90
+ - right_arm
91
+ - rpy
92
+ - height
93
+ sin_cos_embedding_keys: null
94
+ mean_std_embedding_keys: null
95
+ action_configs: null
96
+ action:
97
+ delta_indices:
98
+ - 0
99
+ - 1
100
+ - 2
101
+ - 3
102
+ - 4
103
+ - 5
104
+ - 6
105
+ - 7
106
+ - 8
107
+ - 9
108
+ - 10
109
+ - 11
110
+ - 12
111
+ - 13
112
+ - 14
113
+ - 15
114
+ modality_keys:
115
+ - left_hand
116
+ - right_hand
117
+ - left_arm
118
+ - right_arm
119
+ - rpy
120
+ - height
121
+ - torso_vx
122
+ - torso_vy
123
+ - torso_vyaw
124
+ - target_yaw
125
+ sin_cos_embedding_keys: null
126
+ mean_std_embedding_keys: null
127
+ action_configs:
128
+ - rep: ABSOLUTE
129
+ type: NON_EEF
130
+ format: DEFAULT
131
+ state_key: null
132
+ - rep: ABSOLUTE
133
+ type: NON_EEF
134
+ format: DEFAULT
135
+ state_key: null
136
+ - rep: ABSOLUTE
137
+ type: NON_EEF
138
+ format: DEFAULT
139
+ state_key: null
140
+ - rep: ABSOLUTE
141
+ type: NON_EEF
142
+ format: DEFAULT
143
+ state_key: null
144
+ - rep: ABSOLUTE
145
+ type: NON_EEF
146
+ format: DEFAULT
147
+ state_key: null
148
+ - rep: ABSOLUTE
149
+ type: NON_EEF
150
+ format: DEFAULT
151
+ state_key: null
152
+ - rep: ABSOLUTE
153
+ type: NON_EEF
154
+ format: DEFAULT
155
+ state_key: null
156
+ - rep: ABSOLUTE
157
+ type: NON_EEF
158
+ format: DEFAULT
159
+ state_key: null
160
+ - rep: ABSOLUTE
161
+ type: NON_EEF
162
+ format: DEFAULT
163
+ state_key: null
164
+ - rep: ABSOLUTE
165
+ type: NON_EEF
166
+ format: DEFAULT
167
+ state_key: null
168
+ language:
169
+ delta_indices:
170
+ - 0
171
+ modality_keys:
172
+ - annotation.human.task_description
173
+ sin_cos_embedding_keys: null
174
+ mean_std_embedding_keys: null
175
+ action_configs: null
176
+ download_cache: false
177
+ shard_size: 1024
178
+ episode_sampling_rate: 0.1
179
+ num_shards_per_epoch: 100000
180
+ override_pretraining_statistics: false
181
+ mode: single_turn
182
+ random_chop: 0.0
183
+ mock_dataset_mode: false
184
+ shuffle: true
185
+ seed: 42
186
+ multiprocessing_context: fork
187
+ allow_padding: false
188
+ subsample_ratio: 1.0
189
+ image_crop_size:
190
+ - 244
191
+ - 244
192
+ image_target_size:
193
+ - 224
194
+ - 224
195
+ video_backend: torchcodec
196
+ training:
197
+ output_dir: /hfm/zhenyu/psi_develop_runs/quickstart_finish_20260408/gr00t/G1WholebodyHandoverSonic-v0
198
+ experiment_name: null
199
+ max_steps: 40000
200
+ global_batch_size: 24
201
+ batch_size: null
202
+ gradient_accumulation_steps: 1
203
+ learning_rate: 0.0001
204
+ lr_scheduler_type: cosine
205
+ weight_decay: 1.0e-05
206
+ warmup_ratio: 0.05
207
+ warmup_steps: 0
208
+ max_grad_norm: 1.0
209
+ optim: adamw_torch
210
+ start_from_checkpoint: /hfm/zhenyu/cache/huggingface/hub/models--nvidia--GR00T-N1.6-3B/snapshots/d0814e7ecb19202e7c8468b46098b0b7ef3a6d61
211
+ reinit_action_head: false
212
+ tf32: true
213
+ fp16: false
214
+ bf16: true
215
+ eval_bf16: true
216
+ logging_steps: 10
217
+ save_steps: 40000
218
+ save_total_limit: 1
219
+ save_vl_model: false
220
+ upload_checkpoints: false
221
+ upload_every: 1000
222
+ upload_last_n_checkpoints: 5
223
+ max_concurrent_uploads: 2
224
+ eval_strategy: 'no'
225
+ eval_steps: 500
226
+ eval_set_split_ratio: 0.1
227
+ eval_batch_size: 2
228
+ save_best_eval_metric_name: ''
229
+ save_best_eval_metric_greater_is_better: true
230
+ deepspeed_stage: 2
231
+ gradient_checkpointing: false
232
+ transformers_trust_remote_code: true
233
+ transformers_local_files_only: false
234
+ transformers_cache_dir: null
235
+ transformers_access_token: null
236
+ use_ddp: false
237
+ ddp_bucket_cap_mb: 100
238
+ num_gpus: 2
239
+ dataloader_num_workers: 4
240
+ remove_unused_columns: false
241
+ use_wandb: false
242
+ wandb_project: finetune-gr00t-n1d6
243
+ enable_profiling: false
244
+ max_retries: 3
245
+ assert_loss_less_than: null
246
+ add_rl_callback: false
247
+ enable_open_loop_eval: false
248
+ open_loop_eval_traj_ids:
249
+ - 0
250
+ open_loop_eval_steps_per_traj: 100
251
+ open_loop_eval_plot_indices: null
252
+ max_steps: 40000
253
+ save_steps: 40000
gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/config.yaml ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !!python/object:gr00t.configs.base_config.Config
2
+ data: !!python/object:gr00t.configs.data.data_config.DataConfig
3
+ allow_padding: false
4
+ datasets:
5
+ - !!python/object:gr00t.configs.data.data_config.SingleDatasetConfig
6
+ dataset_paths:
7
+ - /hfm/data/simple_hf/G1WholebodyHandoverSonic-v0
8
+ dataset_type: physical_embodiment
9
+ embodiment_tag: g1_loco_downstream
10
+ mix_ratio: 1.0
11
+ val_dataset_path: null
12
+ download_cache: false
13
+ episode_sampling_rate: 0.1
14
+ image_crop_size:
15
+ - 244
16
+ - 244
17
+ image_target_size:
18
+ - 224
19
+ - 224
20
+ mock_dataset_mode: false
21
+ modality_configs:
22
+ g1_loco_downstream:
23
+ action: !!python/object:gr00t.data.types.ModalityConfig
24
+ action_configs:
25
+ - !!python/object:gr00t.data.types.ActionConfig
26
+ format: &id001 !!python/object/apply:gr00t.data.types.ActionFormat
27
+ - default
28
+ rep: &id002 !!python/object/apply:gr00t.data.types.ActionRepresentation
29
+ - absolute
30
+ state_key: null
31
+ type: &id003 !!python/object/apply:gr00t.data.types.ActionType
32
+ - non_eef
33
+ - !!python/object:gr00t.data.types.ActionConfig
34
+ format: *id001
35
+ rep: *id002
36
+ state_key: null
37
+ type: *id003
38
+ - !!python/object:gr00t.data.types.ActionConfig
39
+ format: *id001
40
+ rep: *id002
41
+ state_key: null
42
+ type: *id003
43
+ - !!python/object:gr00t.data.types.ActionConfig
44
+ format: *id001
45
+ rep: *id002
46
+ state_key: null
47
+ type: *id003
48
+ - !!python/object:gr00t.data.types.ActionConfig
49
+ format: *id001
50
+ rep: *id002
51
+ state_key: null
52
+ type: *id003
53
+ - !!python/object:gr00t.data.types.ActionConfig
54
+ format: *id001
55
+ rep: *id002
56
+ state_key: null
57
+ type: *id003
58
+ - !!python/object:gr00t.data.types.ActionConfig
59
+ format: *id001
60
+ rep: *id002
61
+ state_key: null
62
+ type: *id003
63
+ - !!python/object:gr00t.data.types.ActionConfig
64
+ format: *id001
65
+ rep: *id002
66
+ state_key: null
67
+ type: *id003
68
+ - !!python/object:gr00t.data.types.ActionConfig
69
+ format: *id001
70
+ rep: *id002
71
+ state_key: null
72
+ type: *id003
73
+ - !!python/object:gr00t.data.types.ActionConfig
74
+ format: *id001
75
+ rep: *id002
76
+ state_key: null
77
+ type: *id003
78
+ delta_indices:
79
+ - 0
80
+ - 1
81
+ - 2
82
+ - 3
83
+ - 4
84
+ - 5
85
+ - 6
86
+ - 7
87
+ - 8
88
+ - 9
89
+ - 10
90
+ - 11
91
+ - 12
92
+ - 13
93
+ - 14
94
+ - 15
95
+ mean_std_embedding_keys: null
96
+ modality_keys:
97
+ - left_hand
98
+ - right_hand
99
+ - left_arm
100
+ - right_arm
101
+ - rpy
102
+ - height
103
+ - torso_vx
104
+ - torso_vy
105
+ - torso_vyaw
106
+ - target_yaw
107
+ sin_cos_embedding_keys: null
108
+ language: !!python/object:gr00t.data.types.ModalityConfig
109
+ action_configs: null
110
+ delta_indices:
111
+ - 0
112
+ mean_std_embedding_keys: null
113
+ modality_keys:
114
+ - annotation.human.task_description
115
+ sin_cos_embedding_keys: null
116
+ state: !!python/object:gr00t.data.types.ModalityConfig
117
+ action_configs: null
118
+ delta_indices:
119
+ - 0
120
+ mean_std_embedding_keys: null
121
+ modality_keys:
122
+ - left_hand
123
+ - right_hand
124
+ - left_arm
125
+ - right_arm
126
+ - rpy
127
+ - height
128
+ sin_cos_embedding_keys: null
129
+ video: !!python/object:gr00t.data.types.ModalityConfig
130
+ action_configs: null
131
+ delta_indices:
132
+ - 0
133
+ mean_std_embedding_keys: null
134
+ modality_keys:
135
+ - rs_view
136
+ sin_cos_embedding_keys: null
137
+ mode: single_turn
138
+ multiprocessing_context: fork
139
+ num_shards_per_epoch: 100000
140
+ override_pretraining_statistics: false
141
+ random_chop: 0.0
142
+ seed: 42
143
+ shard_size: 1024
144
+ shuffle: true
145
+ subsample_ratio: 1.0
146
+ video_backend: torchcodec
147
+ load_config_path: null
148
+ model: !!python/object:gr00t.configs.model.gr00t_n1d6.Gr00tN1d6Config
149
+ _attn_implementation_autoset: false
150
+ _attn_implementation_internal: null
151
+ _commit_hash: null
152
+ _name_or_path: ''
153
+ action_horizon: 50
154
+ add_cross_attention: false
155
+ add_pos_embed: true
156
+ apply_sincos_state_encoding: true
157
+ architectures:
158
+ - Gr00tN1d6
159
+ attn_dropout: 0.2
160
+ attn_implementation: null
161
+ backbone_embedding_dim: 2048
162
+ backbone_model_type: eagle
163
+ backbone_trainable_params_fp32: true
164
+ bad_words_ids: null
165
+ begin_suppress_tokens: null
166
+ bos_token_id: null
167
+ chunk_size_feed_forward: 0
168
+ collator_overwrite_image_inputs: false
169
+ color_jitter_params:
170
+ brightness: 0.3
171
+ contrast: 0.4
172
+ hue: 0.08
173
+ saturation: 0.5
174
+ crop_fraction: 0.95
175
+ cross_attention_hidden_size: null
176
+ decoder_start_token_id: null
177
+ diffusion_model_cfg:
178
+ attention_head_dim: 48
179
+ dropout: 0.2
180
+ final_dropout: true
181
+ interleave_self_attention: true
182
+ norm_type: ada_norm
183
+ num_attention_heads: 32
184
+ num_layers: 32
185
+ output_dim: 1024
186
+ positional_embeddings: null
187
+ diversity_penalty: 0.0
188
+ do_sample: false
189
+ eagle_collator: true
190
+ early_stopping: false
191
+ encoder_no_repeat_ngram_size: 0
192
+ eos_token_id: null
193
+ exponential_decay_length_penalty: null
194
+ finetuning_task: null
195
+ forced_bos_token_id: null
196
+ forced_eos_token_id: null
197
+ formalize_language: true
198
+ gemma_collator: false
199
+ hidden_size: 1024
200
+ id2label:
201
+ 0: LABEL_0
202
+ 1: LABEL_1
203
+ image_crop_size: null
204
+ image_target_size: null
205
+ input_embedding_dim: 1536
206
+ is_decoder: false
207
+ is_encoder_decoder: false
208
+ label2id:
209
+ LABEL_0: 0
210
+ LABEL_1: 1
211
+ length_penalty: 1.0
212
+ load_bf16: false
213
+ max_action_dim: 128
214
+ max_length: 20
215
+ max_num_embodiments: 32
216
+ max_seq_len: 1024
217
+ max_state_dim: 128
218
+ min_length: 0
219
+ model_dtype: bfloat16
220
+ model_name: nvidia/Eagle-Block2A-2B-v2
221
+ model_type: Gr00tN1d6
222
+ no_repeat_ngram_size: 0
223
+ noise_beta_alpha: 1.5
224
+ noise_beta_beta: 1.0
225
+ noise_s: 0.999
226
+ num_beam_groups: 1
227
+ num_beams: 1
228
+ num_inference_timesteps: 4
229
+ num_return_sequences: 1
230
+ num_timestep_buckets: 1000
231
+ output_attentions: false
232
+ output_hidden_states: false
233
+ output_scores: false
234
+ pad_token_id: null
235
+ prefix: null
236
+ problem_type: null
237
+ pruned_heads: {}
238
+ random_rotation_angle: null
239
+ remove_invalid_values: false
240
+ repetition_penalty: 1.0
241
+ reproject_vision: false
242
+ return_dict: true
243
+ return_dict_in_generate: false
244
+ select_layer: 16
245
+ sep_token_id: null
246
+ shortest_image_edge: 256
247
+ state_dropout_prob: 0.0
248
+ suppress_tokens: null
249
+ task_specific_params: null
250
+ temperature: 1.0
251
+ tf_legacy_loss: false
252
+ tie_encoder_decoder: false
253
+ tie_word_embeddings: true
254
+ tokenizer_class: null
255
+ top_k: 50
256
+ top_p: 1.0
257
+ torch_dtype: bfloat16
258
+ torchscript: false
259
+ transformers_version: 4.51.3
260
+ tune_diffusion_model: true
261
+ tune_llm: false
262
+ tune_projector: true
263
+ tune_top_llm_layers: 4
264
+ tune_visual: false
265
+ typical_p: 1.0
266
+ use_albumentations_transforms: true
267
+ use_alternate_vl_dit: true
268
+ use_bfloat16: false
269
+ use_flash_attention: true
270
+ use_relative_action: true
271
+ use_vlln: true
272
+ training: !!python/object:gr00t.configs.training.training_config.TrainingConfig
273
+ add_rl_callback: false
274
+ assert_loss_less_than: null
275
+ batch_size: null
276
+ bf16: true
277
+ dataloader_num_workers: 4
278
+ ddp_bucket_cap_mb: 100
279
+ deepspeed_stage: 2
280
+ enable_open_loop_eval: false
281
+ enable_profiling: false
282
+ eval_batch_size: 2
283
+ eval_bf16: true
284
+ eval_set_split_ratio: 0.1
285
+ eval_steps: 500
286
+ eval_strategy: 'no'
287
+ experiment_name: null
288
+ fp16: false
289
+ global_batch_size: 24
290
+ gradient_accumulation_steps: 1
291
+ gradient_checkpointing: false
292
+ learning_rate: 0.0001
293
+ logging_steps: 10
294
+ lr_scheduler_type: cosine
295
+ max_concurrent_uploads: 2
296
+ max_grad_norm: 1.0
297
+ max_retries: 3
298
+ max_steps: 40000
299
+ num_gpus: 2
300
+ open_loop_eval_plot_indices: null
301
+ open_loop_eval_steps_per_traj: 100
302
+ open_loop_eval_traj_ids:
303
+ - 0
304
+ optim: adamw_torch
305
+ output_dir: /hfm/zhenyu/psi_develop_runs/quickstart_finish_20260408/gr00t/G1WholebodyHandoverSonic-v0
306
+ reinit_action_head: false
307
+ remove_unused_columns: false
308
+ save_best_eval_metric_greater_is_better: true
309
+ save_best_eval_metric_name: ''
310
+ save_steps: 40000
311
+ save_total_limit: 1
312
+ save_vl_model: false
313
+ start_from_checkpoint: /hfm/zhenyu/cache/huggingface/hub/models--nvidia--GR00T-N1.6-3B/snapshots/d0814e7ecb19202e7c8468b46098b0b7ef3a6d61
314
+ tf32: true
315
+ transformers_access_token: null
316
+ transformers_cache_dir: null
317
+ transformers_local_files_only: false
318
+ transformers_trust_remote_code: true
319
+ upload_checkpoints: false
320
+ upload_every: 1000
321
+ upload_last_n_checkpoints: 5
322
+ use_ddp: false
323
+ use_wandb: false
324
+ wandb_project: finetune-gr00t-n1d6
325
+ warmup_ratio: 0.05
326
+ warmup_steps: 0
327
+ weight_decay: 1.0e-05
gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/dataset_statistics.json ADDED
@@ -0,0 +1,641 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "g1_loco_downstream": {
3
+ "state": {
4
+ "left_hand": {
5
+ "min": [
6
+ -0.5564982891082764,
7
+ -0.27445706725120544,
8
+ -0.0005447770818136632,
9
+ -0.8388738632202148,
10
+ -1.3655147552490234,
11
+ -0.564049482345581,
12
+ -1.4599460363388062
13
+ ],
14
+ "max": [
15
+ 0.00216071424074471,
16
+ 0.38201195001602173,
17
+ 0.6742639541625977,
18
+ 0.004060761071741581,
19
+ 0.0005195428966544569,
20
+ 0.0004725759499706328,
21
+ 0.00010080631182063371
22
+ ],
23
+ "mean": [
24
+ -0.2751602530479431,
25
+ -0.017094818875193596,
26
+ 0.33967384696006775,
27
+ -0.1750434786081314,
28
+ -0.6749432682991028,
29
+ -0.24268501996994019,
30
+ -0.7257766723632812
31
+ ],
32
+ "std": [
33
+ 0.24003371596336365,
34
+ 0.0703231543302536,
35
+ 0.29606711864471436,
36
+ 0.16954894363880157,
37
+ 0.5928274989128113,
38
+ 0.21174660325050354,
39
+ 0.6372348666191101
40
+ ],
41
+ "q01": [
42
+ -0.5454074621200562,
43
+ -0.19266487956047057,
44
+ -0.0005245920852757991,
45
+ -0.6503645420074463,
46
+ -1.35140860080719,
47
+ -0.5181030392646789,
48
+ -1.4236438989639282
49
+ ],
50
+ "q99": [
51
+ 1.676042811595835e-05,
52
+ 0.24354418218135854,
53
+ 0.6602697968482971,
54
+ 0.0001695691578788683,
55
+ 1.5866123430896557e-05,
56
+ 0.00015037909615784885,
57
+ 2.3581579080200756e-05
58
+ ]
59
+ },
60
+ "right_hand": {
61
+ "min": [
62
+ -0.6568094491958618,
63
+ -0.5149835348129272,
64
+ -0.6775947213172913,
65
+ -0.001480442238971591,
66
+ -0.0002713006397243589,
67
+ -0.0011839715298265219,
68
+ -0.00019419840828049928
69
+ ],
70
+ "max": [
71
+ 6.050001957191853e-06,
72
+ 0.2242346704006195,
73
+ 0.000421577860834077,
74
+ 0.5655707716941833,
75
+ 1.4591559171676636,
76
+ 1.4605127573013306,
77
+ 1.4595911502838135
78
+ ],
79
+ "mean": [
80
+ -0.1981332004070282,
81
+ -0.0195594672113657,
82
+ -0.23163561522960663,
83
+ 0.16773521900177002,
84
+ 0.4997841417789459,
85
+ 0.18093106150627136,
86
+ 0.472481369972229
87
+ ],
88
+ "std": [
89
+ 0.23425449430942535,
90
+ 0.08371374756097794,
91
+ 0.27579209208488464,
92
+ 0.16269023716449738,
93
+ 0.5603010654449463,
94
+ 0.2375503033399582,
95
+ 0.5293523073196411
96
+ ],
97
+ "q01": [
98
+ -0.5749557495117188,
99
+ -0.3337140500545502,
100
+ -0.6711381435394287,
101
+ -7.74595980601589e-07,
102
+ -9.307560304705477e-08,
103
+ -1.6786629203124902e-06,
104
+ -1.9171796736827673e-07
105
+ ],
106
+ "q99": [
107
+ 4.289457137929287e-06,
108
+ 0.08610542118549355,
109
+ 6.386997574736603e-06,
110
+ 0.45666431784629824,
111
+ 1.3896952152252198,
112
+ 1.4538174629211427,
113
+ 1.4552357196807861
114
+ ]
115
+ },
116
+ "left_arm": {
117
+ "min": [
118
+ -0.4206617772579193,
119
+ 0.13972464203834534,
120
+ -0.546251654624939,
121
+ -0.7090029716491699,
122
+ -0.4764360189437866,
123
+ -0.5082273483276367,
124
+ -0.9443663954734802
125
+ ],
126
+ "max": [
127
+ 0.2758432626724243,
128
+ 0.657910943031311,
129
+ 1.2573398351669312,
130
+ 0.502498209476471,
131
+ 0.829430103302002,
132
+ 0.6684854030609131,
133
+ 0.4653257131576538
134
+ ],
135
+ "mean": [
136
+ -0.02776164747774601,
137
+ 0.23111900687217712,
138
+ 0.11910299956798553,
139
+ -0.03885705769062042,
140
+ -0.040147196501493454,
141
+ 0.039232831448316574,
142
+ -0.055104125291109085
143
+ ],
144
+ "std": [
145
+ 0.0913022831082344,
146
+ 0.0760001540184021,
147
+ 0.41979464888572693,
148
+ 0.1705896258354187,
149
+ 0.21253198385238647,
150
+ 0.1471889466047287,
151
+ 0.279379665851593
152
+ ],
153
+ "q01": [
154
+ -0.23415811955928803,
155
+ 0.15543932616710662,
156
+ -0.3921099603176117,
157
+ -0.46588624715805055,
158
+ -0.37132282853126525,
159
+ -0.36638733744621277,
160
+ -0.748569130897522
161
+ ],
162
+ "q99": [
163
+ 0.20841669440269472,
164
+ 0.5301468849182132,
165
+ 1.12667546272278,
166
+ 0.3347089588642124,
167
+ 0.581330204010011,
168
+ 0.4248562216758731,
169
+ 0.32658843994140696
170
+ ]
171
+ },
172
+ "right_arm": {
173
+ "min": [
174
+ -0.4381798803806305,
175
+ -0.3338131606578827,
176
+ -0.667724072933197,
177
+ -0.8774402737617493,
178
+ -0.7544379830360413,
179
+ -0.3845277726650238,
180
+ -0.4484957158565521
181
+ ],
182
+ "max": [
183
+ 0.18638382852077484,
184
+ -0.1659134179353714,
185
+ 0.48569726943969727,
186
+ 0.4635644555091858,
187
+ 0.4788283109664917,
188
+ 0.6297324299812317,
189
+ 0.653800904750824
190
+ ],
191
+ "mean": [
192
+ -0.06836161017417908,
193
+ -0.2021433711051941,
194
+ 0.16087406873703003,
195
+ -0.11563104391098022,
196
+ -0.05866279453039169,
197
+ 0.23557253181934357,
198
+ 0.09276729822158813
199
+ ],
200
+ "std": [
201
+ 0.08297572284936905,
202
+ 0.022914808243513107,
203
+ 0.15356409549713135,
204
+ 0.24699115753173828,
205
+ 0.20469534397125244,
206
+ 0.16003546118736267,
207
+ 0.17473284900188446
208
+ ],
209
+ "q01": [
210
+ -0.29160568714141843,
211
+ -0.29346513748168945,
212
+ -0.279777330160141,
213
+ -0.6629836201667786,
214
+ -0.6018376231193543,
215
+ -0.17154656052589418,
216
+ -0.32367889285087587
217
+ ],
218
+ "q99": [
219
+ 0.11399658918380765,
220
+ -0.17735292613506315,
221
+ 0.4229020774364473,
222
+ 0.34572245478630076,
223
+ 0.368752056360246,
224
+ 0.5649118661880499,
225
+ 0.48370276093483006
226
+ ]
227
+ },
228
+ "rpy": {
229
+ "min": [
230
+ -0.13709338009357452,
231
+ -0.12902723252773285,
232
+ -0.4748336970806122
233
+ ],
234
+ "max": [
235
+ 0.16572202742099762,
236
+ 0.3150315284729004,
237
+ 0.26422709226608276
238
+ ],
239
+ "mean": [
240
+ -0.005020154640078545,
241
+ 0.05687952786684036,
242
+ -0.026122862473130226
243
+ ],
244
+ "std": [
245
+ 0.028302520513534546,
246
+ 0.04447358474135399,
247
+ 0.085796058177948
248
+ ],
249
+ "q01": [
250
+ -0.07991428971290589,
251
+ -0.04651294574141503,
252
+ -0.3028513967990875
253
+ ],
254
+ "q99": [
255
+ 0.08919754773378384,
256
+ 0.1530724883079529,
257
+ 0.1207957535982132
258
+ ]
259
+ },
260
+ "height": {
261
+ "min": [
262
+ 0.7400000095367432
263
+ ],
264
+ "max": [
265
+ 0.7400000095367432
266
+ ],
267
+ "mean": [
268
+ 0.740202009677887
269
+ ],
270
+ "std": [
271
+ 0.0002020601823283891
272
+ ],
273
+ "q01": [
274
+ 0.7400000095367432
275
+ ],
276
+ "q99": [
277
+ 0.7400000095367432
278
+ ]
279
+ }
280
+ },
281
+ "action": {
282
+ "left_hand": {
283
+ "min": [
284
+ -0.5,
285
+ -1.1095792134107943e-16,
286
+ -1.1095792134107943e-16,
287
+ -1.0,
288
+ -1.5,
289
+ -1.5,
290
+ -1.5
291
+ ],
292
+ "max": [
293
+ 0.0,
294
+ 0.699999988079071,
295
+ 0.699999988079071,
296
+ 0.0,
297
+ 2.2146225653890418e-16,
298
+ 2.2146225653890418e-16,
299
+ 2.2146225653890418e-16
300
+ ],
301
+ "mean": [
302
+ -0.27781689167022705,
303
+ 0.38925525546073914,
304
+ 0.38925525546073914,
305
+ -0.33365052938461304,
306
+ -0.8339555859565735,
307
+ -0.8337874412536621,
308
+ -0.8339555859565735
309
+ ],
310
+ "std": [
311
+ 0.24835854768753052,
312
+ 0.34778890013694763,
313
+ 0.34778890013694763,
314
+ 0.2983124852180481,
315
+ 0.7450643181800842,
316
+ 0.7449713945388794,
317
+ 0.7450643181800842
318
+ ],
319
+ "q01": [
320
+ -0.5,
321
+ 0.0,
322
+ 0.0,
323
+ -0.6000000238418579,
324
+ -1.5,
325
+ -1.5,
326
+ -1.5
327
+ ],
328
+ "q99": [
329
+ 0.0,
330
+ 0.699999988079071,
331
+ 0.699999988079071,
332
+ 0.0,
333
+ 0.0,
334
+ 0.0,
335
+ 0.0
336
+ ]
337
+ },
338
+ "right_hand": {
339
+ "min": [
340
+ -0.5,
341
+ -0.699999988079071,
342
+ -0.699999988079071,
343
+ -2.2166350627321588e-16,
344
+ -2.2166350627321588e-16,
345
+ 0.0,
346
+ -2.2166350627321588e-16
347
+ ],
348
+ "max": [
349
+ 0.0,
350
+ 1.1078670818917075e-16,
351
+ 1.1078670818917075e-16,
352
+ 1.5,
353
+ 1.5,
354
+ 0.6000000238418579,
355
+ 1.5
356
+ ],
357
+ "mean": [
358
+ -0.17657075822353363,
359
+ -0.24723553657531738,
360
+ -0.24723553657531738,
361
+ 0.529712438583374,
362
+ 0.529712438583374,
363
+ 0.2118975669145584,
364
+ 0.529712438583374
365
+ ],
366
+ "std": [
367
+ 0.23890717327594757,
368
+ 0.33447372913360596,
369
+ 0.33447372913360596,
370
+ 0.7167963981628418,
371
+ 0.7167963981628418,
372
+ 0.28673890233039856,
373
+ 0.7167963981628418
374
+ ],
375
+ "q01": [
376
+ -0.5,
377
+ -0.699999988079071,
378
+ -0.699999988079071,
379
+ 0.0,
380
+ 0.0,
381
+ 0.0,
382
+ 0.0
383
+ ],
384
+ "q99": [
385
+ 0.0,
386
+ 0.0,
387
+ 0.0,
388
+ 1.5,
389
+ 1.5,
390
+ 0.6000000238418579,
391
+ 1.5
392
+ ]
393
+ },
394
+ "left_arm": {
395
+ "min": [
396
+ -0.47567468881607056,
397
+ 0.1900009959936142,
398
+ -0.512170135974884,
399
+ -0.7892420291900635,
400
+ -0.5008617043495178,
401
+ -0.5746880769729614,
402
+ -0.9223371148109436
403
+ ],
404
+ "max": [
405
+ 0.2540479004383087,
406
+ 0.7282471060752869,
407
+ 1.2709754705429077,
408
+ 0.42311304807662964,
409
+ 0.8564174771308899,
410
+ 0.6096596121788025,
411
+ 0.5172277092933655
412
+ ],
413
+ "mean": [
414
+ -0.06350070238113403,
415
+ 0.24785259366035461,
416
+ 0.14029042422771454,
417
+ -0.1256440430879593,
418
+ -0.044341038912534714,
419
+ -0.022799625992774963,
420
+ -0.05674752965569496
421
+ ],
422
+ "std": [
423
+ 0.09563682973384857,
424
+ 0.08831998705863953,
425
+ 0.42541226744651794,
426
+ 0.17224335670471191,
427
+ 0.21421362459659576,
428
+ 0.15103395283222198,
429
+ 0.2759263217449188
430
+ ],
431
+ "q01": [
432
+ -0.28211010098457334,
433
+ 0.1900009959936142,
434
+ -0.37696691751480105,
435
+ -0.5406084418296814,
436
+ -0.3891998648643494,
437
+ -0.42921523451805116,
438
+ -0.7201175212860107
439
+ ],
440
+ "q99": [
441
+ 0.18517665863037117,
442
+ 0.5846158027648926,
443
+ 1.1427187919616704,
444
+ 0.2580944597721106,
445
+ 0.5862018227577217,
446
+ 0.3721236944198609,
447
+ 0.335158181190491
448
+ ]
449
+ },
450
+ "right_arm": {
451
+ "min": [
452
+ -0.49507391452789307,
453
+ -0.35317879915237427,
454
+ -0.6871383190155029,
455
+ -0.9363890290260315,
456
+ -0.7568023204803467,
457
+ -0.4524245262145996,
458
+ -0.4588268995285034
459
+ ],
460
+ "max": [
461
+ 0.16140148043632507,
462
+ -0.1900009959936142,
463
+ 0.5362864136695862,
464
+ 0.395627498626709,
465
+ 0.5115647315979004,
466
+ 0.5737534165382385,
467
+ 0.6410111784934998
468
+ ],
469
+ "mean": [
470
+ -0.10634426772594452,
471
+ -0.2073768824338913,
472
+ 0.14511734247207642,
473
+ -0.19855530560016632,
474
+ -0.05260279402136803,
475
+ 0.18052348494529724,
476
+ 0.08728770911693573
477
+ ],
478
+ "std": [
479
+ 0.08726997673511505,
480
+ 0.025804132223129272,
481
+ 0.15625444054603577,
482
+ 0.24725356698036194,
483
+ 0.20767106115818024,
484
+ 0.16069163382053375,
485
+ 0.17235393822193146
486
+ ],
487
+ "q01": [
488
+ -0.3421173691749573,
489
+ -0.3095075190067291,
490
+ -0.29622817039489746,
491
+ -0.7417560338973999,
492
+ -0.6076870560646057,
493
+ -0.22892893254756927,
494
+ -0.3249402105808258
495
+ ],
496
+ "q99": [
497
+ 0.08254841715097437,
498
+ -0.1900009959936142,
499
+ 0.41086015105247503,
500
+ 0.27305958867073077,
501
+ 0.3908573389053362,
502
+ 0.5150728464126588,
503
+ 0.4772372245788577
504
+ ]
505
+ },
506
+ "rpy": {
507
+ "min": [
508
+ -0.13876836001873016,
509
+ -0.14725954830646515,
510
+ -0.47856518626213074
511
+ ],
512
+ "max": [
513
+ 0.18312667310237885,
514
+ 0.28792673349380493,
515
+ 0.2582152187824249
516
+ ],
517
+ "mean": [
518
+ 0.0005207702633924782,
519
+ 0.021904371678829193,
520
+ -0.026956554502248764
521
+ ],
522
+ "std": [
523
+ 0.028746996074914932,
524
+ 0.04320567101240158,
525
+ 0.08680225163698196
526
+ ],
527
+ "q01": [
528
+ -0.07442924678325653,
529
+ -0.0750456154346466,
530
+ -0.30597909688949587
531
+ ],
532
+ "q99": [
533
+ 0.10015777498483676,
534
+ 0.12030115425586704,
535
+ 0.1201828226447107
536
+ ]
537
+ },
538
+ "height": {
539
+ "min": [
540
+ 0.7400000095367432
541
+ ],
542
+ "max": [
543
+ 0.7400000095367432
544
+ ],
545
+ "mean": [
546
+ 0.740202009677887
547
+ ],
548
+ "std": [
549
+ 0.0002020601823283891
550
+ ],
551
+ "q01": [
552
+ 0.7400000095367432
553
+ ],
554
+ "q99": [
555
+ 0.7400000095367432
556
+ ]
557
+ },
558
+ "torso_vx": {
559
+ "min": [
560
+ -0.5
561
+ ],
562
+ "max": [
563
+ 0.5
564
+ ],
565
+ "mean": [
566
+ 0.013324149884283543
567
+ ],
568
+ "std": [
569
+ 0.11090783774852753
570
+ ],
571
+ "q01": [
572
+ -0.3940571188926697
573
+ ],
574
+ "q99": [
575
+ 0.49835217595100406
576
+ ]
577
+ },
578
+ "torso_vy": {
579
+ "min": [
580
+ -0.5
581
+ ],
582
+ "max": [
583
+ 0.5
584
+ ],
585
+ "mean": [
586
+ 0.026182036846876144
587
+ ],
588
+ "std": [
589
+ 0.10218460857868195
590
+ ],
591
+ "q01": [
592
+ 0.0
593
+ ],
594
+ "q99": [
595
+ 0.5
596
+ ]
597
+ },
598
+ "torso_vyaw": {
599
+ "min": [
600
+ -0.26161932945251465
601
+ ],
602
+ "max": [
603
+ 0.3454970121383667
604
+ ],
605
+ "mean": [
606
+ -0.0010659025283530354
607
+ ],
608
+ "std": [
609
+ 0.04677947238087654
610
+ ],
611
+ "q01": [
612
+ -0.11119558662176132
613
+ ],
614
+ "q99": [
615
+ 0.11862087398767479
616
+ ]
617
+ },
618
+ "target_yaw": {
619
+ "min": [
620
+ -0.06718750298023224
621
+ ],
622
+ "max": [
623
+ 0.2899305522441864
624
+ ],
625
+ "mean": [
626
+ 0.0027915823739022017
627
+ ],
628
+ "std": [
629
+ 0.02757135219871998
630
+ ],
631
+ "q01": [
632
+ 0.0
633
+ ],
634
+ "q99": [
635
+ 0.16874246895313402
636
+ ]
637
+ }
638
+ },
639
+ "relative_action": {}
640
+ }
641
+ }
gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/final_model_config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "Gr00tN1d6",
3
+ "model_dtype": "bfloat16",
4
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
5
+ "backbone_model_type": "eagle",
6
+ "model_revision": null,
7
+ "tune_top_llm_layers": 4,
8
+ "backbone_embedding_dim": 2048,
9
+ "tune_llm": false,
10
+ "tune_visual": false,
11
+ "select_layer": 16,
12
+ "reproject_vision": false,
13
+ "use_flash_attention": true,
14
+ "load_bf16": true,
15
+ "collator_overwrite_image_inputs": false,
16
+ "eagle_collator": true,
17
+ "backbone_trainable_params_fp32": true,
18
+ "apply_sincos_state_encoding": true,
19
+ "use_relative_action": true,
20
+ "max_state_dim": 128,
21
+ "max_action_dim": 128,
22
+ "action_horizon": 50,
23
+ "hidden_size": 1024,
24
+ "input_embedding_dim": 1536,
25
+ "add_pos_embed": true,
26
+ "attn_dropout": 0.2,
27
+ "use_vlln": true,
28
+ "max_seq_len": 1024,
29
+ "use_alternate_vl_dit": true,
30
+ "attend_text_every_n_blocks": 2,
31
+ "diffusion_model_cfg": {
32
+ "attention_head_dim": 48,
33
+ "dropout": 0.2,
34
+ "final_dropout": true,
35
+ "interleave_self_attention": true,
36
+ "norm_type": "ada_norm",
37
+ "num_attention_heads": 32,
38
+ "num_layers": 32,
39
+ "output_dim": 1024,
40
+ "positional_embeddings": null
41
+ },
42
+ "num_inference_timesteps": 4,
43
+ "noise_beta_alpha": 1.5,
44
+ "noise_beta_beta": 1.0,
45
+ "noise_s": 0.999,
46
+ "num_timestep_buckets": 1000,
47
+ "tune_projector": true,
48
+ "tune_diffusion_model": true,
49
+ "tune_vlln": true,
50
+ "state_dropout_prob": 0.0,
51
+ "state_additive_noise_scale": 0.0,
52
+ "max_num_embodiments": 32
53
+ }
gr00t/simple/G1WholebodyHandoverSonic-v0/experiment_cfg/final_processor_config.json ADDED
The diff for this file is too large to render. See raw diff
 
gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30064a66837d2ddfbd81b4a933d1d8972387264b7330b3d85ef85f9b064372a4
3
+ size 9719841825
gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/bf16_zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e0fe971417ea03f9ddd9720646144a93f50e23cdd750bfe5e232a71693731d6
3
+ size 9719835873
gr00t/simple/G1WholebodyHandoverSonic-v0/global_step40000/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae3f448f90a0b3ff3b26f1c3e30e76ef85ff0b0703365ce1846a51f247573f8c
3
+ size 9907202435
gr00t/simple/G1WholebodyHandoverSonic-v0/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step40000
gr00t/simple/G1WholebodyHandoverSonic-v0/model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37e5d522b08510cb8811292d1f65893a087a4900d5805bd558004308d6a0061b
3
+ size 4991091456
gr00t/simple/G1WholebodyHandoverSonic-v0/model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b0701110851e495d23dab745a5625c91feb2d4ecd86fda8e231a8184aeb6749
3
+ size 1582283096
gr00t/simple/G1WholebodyHandoverSonic-v0/model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
gr00t/simple/G1WholebodyHandoverSonic-v0/processor_config.json ADDED
@@ -0,0 +1,514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "Gr00tN1d6Processor",
3
+ "processor_kwargs": {
4
+ "modality_configs": {
5
+ "behavior_r1_pro": {
6
+ "video": {
7
+ "delta_indices": [
8
+ 0
9
+ ],
10
+ "modality_keys": [
11
+ "observation.images.rgb.head_256_256",
12
+ "observation.images.rgb.left_wrist_256_256",
13
+ "observation.images.rgb.right_wrist_256_256"
14
+ ],
15
+ "sin_cos_embedding_keys": null,
16
+ "mean_std_embedding_keys": null,
17
+ "action_configs": null
18
+ },
19
+ "state": {
20
+ "delta_indices": [
21
+ 0
22
+ ],
23
+ "modality_keys": [
24
+ "robot_pos",
25
+ "robot_ori_cos",
26
+ "robot_ori_sin",
27
+ "robot_2d_ori",
28
+ "robot_2d_ori_cos",
29
+ "robot_2d_ori_sin",
30
+ "robot_lin_vel",
31
+ "robot_ang_vel",
32
+ "arm_left_qpos",
33
+ "arm_left_qpos_sin",
34
+ "arm_left_qpos_cos",
35
+ "eef_left_pos",
36
+ "eef_left_quat",
37
+ "gripper_left_qpos",
38
+ "arm_right_qpos",
39
+ "arm_right_qpos_sin",
40
+ "arm_right_qpos_cos",
41
+ "eef_right_pos",
42
+ "eef_right_quat",
43
+ "gripper_right_qpos",
44
+ "trunk_qpos"
45
+ ],
46
+ "sin_cos_embedding_keys": null,
47
+ "mean_std_embedding_keys": null,
48
+ "action_configs": null
49
+ },
50
+ "action": {
51
+ "delta_indices": [
52
+ 0,
53
+ 1,
54
+ 2,
55
+ 3,
56
+ 4,
57
+ 5,
58
+ 6,
59
+ 7,
60
+ 8,
61
+ 9,
62
+ 10,
63
+ 11,
64
+ 12,
65
+ 13,
66
+ 14,
67
+ 15,
68
+ 16,
69
+ 17,
70
+ 18,
71
+ 19,
72
+ 20,
73
+ 21,
74
+ 22,
75
+ 23,
76
+ 24,
77
+ 25,
78
+ 26,
79
+ 27,
80
+ 28,
81
+ 29,
82
+ 30,
83
+ 31
84
+ ],
85
+ "modality_keys": [
86
+ "base",
87
+ "torso",
88
+ "left_arm",
89
+ "left_gripper",
90
+ "right_arm",
91
+ "right_gripper"
92
+ ],
93
+ "sin_cos_embedding_keys": null,
94
+ "mean_std_embedding_keys": null,
95
+ "action_configs": [
96
+ {
97
+ "rep": "ABSOLUTE",
98
+ "type": "NON_EEF",
99
+ "format": "DEFAULT",
100
+ "state_key": null
101
+ },
102
+ {
103
+ "rep": "RELATIVE",
104
+ "type": "NON_EEF",
105
+ "format": "DEFAULT",
106
+ "state_key": "trunk_qpos"
107
+ },
108
+ {
109
+ "rep": "RELATIVE",
110
+ "type": "NON_EEF",
111
+ "format": "DEFAULT",
112
+ "state_key": "arm_left_qpos"
113
+ },
114
+ {
115
+ "rep": "ABSOLUTE",
116
+ "type": "NON_EEF",
117
+ "format": "DEFAULT",
118
+ "state_key": null
119
+ },
120
+ {
121
+ "rep": "RELATIVE",
122
+ "type": "NON_EEF",
123
+ "format": "DEFAULT",
124
+ "state_key": "arm_right_qpos"
125
+ },
126
+ {
127
+ "rep": "ABSOLUTE",
128
+ "type": "NON_EEF",
129
+ "format": "DEFAULT",
130
+ "state_key": null
131
+ }
132
+ ]
133
+ },
134
+ "language": {
135
+ "delta_indices": [
136
+ 0
137
+ ],
138
+ "modality_keys": [
139
+ "annotation.human.coarse_action"
140
+ ],
141
+ "sin_cos_embedding_keys": null,
142
+ "mean_std_embedding_keys": null,
143
+ "action_configs": null
144
+ }
145
+ },
146
+ "gr1": {
147
+ "video": {
148
+ "delta_indices": [
149
+ 0
150
+ ],
151
+ "modality_keys": [
152
+ "ego_view_bg_crop_pad_res256_freq20"
153
+ ],
154
+ "sin_cos_embedding_keys": null,
155
+ "mean_std_embedding_keys": null,
156
+ "action_configs": null
157
+ },
158
+ "state": {
159
+ "delta_indices": [
160
+ 0
161
+ ],
162
+ "modality_keys": [
163
+ "left_arm",
164
+ "right_arm",
165
+ "left_hand",
166
+ "right_hand",
167
+ "waist"
168
+ ],
169
+ "sin_cos_embedding_keys": [
170
+ "left_arm",
171
+ "right_arm",
172
+ "left_hand",
173
+ "right_hand",
174
+ "waist"
175
+ ],
176
+ "mean_std_embedding_keys": null,
177
+ "action_configs": null
178
+ },
179
+ "action": {
180
+ "delta_indices": [
181
+ 0,
182
+ 1,
183
+ 2,
184
+ 3,
185
+ 4,
186
+ 5,
187
+ 6,
188
+ 7,
189
+ 8,
190
+ 9,
191
+ 10,
192
+ 11,
193
+ 12,
194
+ 13,
195
+ 14,
196
+ 15
197
+ ],
198
+ "modality_keys": [
199
+ "left_arm",
200
+ "right_arm",
201
+ "left_hand",
202
+ "right_hand",
203
+ "waist"
204
+ ],
205
+ "sin_cos_embedding_keys": null,
206
+ "mean_std_embedding_keys": null,
207
+ "action_configs": [
208
+ {
209
+ "rep": "RELATIVE",
210
+ "type": "NON_EEF",
211
+ "format": "DEFAULT",
212
+ "state_key": null
213
+ },
214
+ {
215
+ "rep": "RELATIVE",
216
+ "type": "NON_EEF",
217
+ "format": "DEFAULT",
218
+ "state_key": null
219
+ },
220
+ {
221
+ "rep": "RELATIVE",
222
+ "type": "NON_EEF",
223
+ "format": "DEFAULT",
224
+ "state_key": null
225
+ },
226
+ {
227
+ "rep": "RELATIVE",
228
+ "type": "NON_EEF",
229
+ "format": "DEFAULT",
230
+ "state_key": null
231
+ },
232
+ {
233
+ "rep": "ABSOLUTE",
234
+ "type": "NON_EEF",
235
+ "format": "DEFAULT",
236
+ "state_key": null
237
+ }
238
+ ]
239
+ },
240
+ "language": {
241
+ "delta_indices": [
242
+ 0
243
+ ],
244
+ "modality_keys": [
245
+ "task"
246
+ ],
247
+ "sin_cos_embedding_keys": null,
248
+ "mean_std_embedding_keys": null,
249
+ "action_configs": null
250
+ }
251
+ },
252
+ "robocasa_panda_omron": {
253
+ "video": {
254
+ "delta_indices": [
255
+ 0
256
+ ],
257
+ "modality_keys": [
258
+ "res256_image_side_0",
259
+ "res256_image_side_1",
260
+ "res256_image_wrist_0"
261
+ ],
262
+ "sin_cos_embedding_keys": null,
263
+ "mean_std_embedding_keys": null,
264
+ "action_configs": null
265
+ },
266
+ "state": {
267
+ "delta_indices": [
268
+ 0
269
+ ],
270
+ "modality_keys": [
271
+ "end_effector_position_relative",
272
+ "end_effector_rotation_relative",
273
+ "gripper_qpos",
274
+ "base_position",
275
+ "base_rotation"
276
+ ],
277
+ "sin_cos_embedding_keys": null,
278
+ "mean_std_embedding_keys": null,
279
+ "action_configs": null
280
+ },
281
+ "action": {
282
+ "delta_indices": [
283
+ 0,
284
+ 1,
285
+ 2,
286
+ 3,
287
+ 4,
288
+ 5,
289
+ 6,
290
+ 7,
291
+ 8,
292
+ 9,
293
+ 10,
294
+ 11,
295
+ 12,
296
+ 13,
297
+ 14,
298
+ 15
299
+ ],
300
+ "modality_keys": [
301
+ "end_effector_position",
302
+ "end_effector_rotation",
303
+ "gripper_close",
304
+ "base_motion",
305
+ "control_mode"
306
+ ],
307
+ "sin_cos_embedding_keys": null,
308
+ "mean_std_embedding_keys": null,
309
+ "action_configs": [
310
+ {
311
+ "rep": "ABSOLUTE",
312
+ "type": "NON_EEF",
313
+ "format": "DEFAULT",
314
+ "state_key": null
315
+ },
316
+ {
317
+ "rep": "ABSOLUTE",
318
+ "type": "NON_EEF",
319
+ "format": "DEFAULT",
320
+ "state_key": null
321
+ },
322
+ {
323
+ "rep": "ABSOLUTE",
324
+ "type": "NON_EEF",
325
+ "format": "DEFAULT",
326
+ "state_key": null
327
+ },
328
+ {
329
+ "rep": "ABSOLUTE",
330
+ "type": "NON_EEF",
331
+ "format": "DEFAULT",
332
+ "state_key": null
333
+ },
334
+ {
335
+ "rep": "ABSOLUTE",
336
+ "type": "NON_EEF",
337
+ "format": "DEFAULT",
338
+ "state_key": null
339
+ }
340
+ ]
341
+ },
342
+ "language": {
343
+ "delta_indices": [
344
+ 0
345
+ ],
346
+ "modality_keys": [
347
+ "annotation.human.action.task_description"
348
+ ],
349
+ "sin_cos_embedding_keys": null,
350
+ "mean_std_embedding_keys": null,
351
+ "action_configs": null
352
+ }
353
+ },
354
+ "g1_loco_downstream": {
355
+ "video": {
356
+ "delta_indices": [
357
+ 0
358
+ ],
359
+ "modality_keys": [
360
+ "rs_view"
361
+ ],
362
+ "sin_cos_embedding_keys": null,
363
+ "mean_std_embedding_keys": null,
364
+ "action_configs": null
365
+ },
366
+ "state": {
367
+ "delta_indices": [
368
+ 0
369
+ ],
370
+ "modality_keys": [
371
+ "left_hand",
372
+ "right_hand",
373
+ "left_arm",
374
+ "right_arm",
375
+ "rpy",
376
+ "height"
377
+ ],
378
+ "sin_cos_embedding_keys": null,
379
+ "mean_std_embedding_keys": null,
380
+ "action_configs": null
381
+ },
382
+ "action": {
383
+ "delta_indices": [
384
+ 0,
385
+ 1,
386
+ 2,
387
+ 3,
388
+ 4,
389
+ 5,
390
+ 6,
391
+ 7,
392
+ 8,
393
+ 9,
394
+ 10,
395
+ 11,
396
+ 12,
397
+ 13,
398
+ 14,
399
+ 15
400
+ ],
401
+ "modality_keys": [
402
+ "left_hand",
403
+ "right_hand",
404
+ "left_arm",
405
+ "right_arm",
406
+ "rpy",
407
+ "height",
408
+ "torso_vx",
409
+ "torso_vy",
410
+ "torso_vyaw",
411
+ "target_yaw"
412
+ ],
413
+ "sin_cos_embedding_keys": null,
414
+ "mean_std_embedding_keys": null,
415
+ "action_configs": [
416
+ {
417
+ "rep": "ABSOLUTE",
418
+ "type": "NON_EEF",
419
+ "format": "DEFAULT",
420
+ "state_key": null
421
+ },
422
+ {
423
+ "rep": "ABSOLUTE",
424
+ "type": "NON_EEF",
425
+ "format": "DEFAULT",
426
+ "state_key": null
427
+ },
428
+ {
429
+ "rep": "ABSOLUTE",
430
+ "type": "NON_EEF",
431
+ "format": "DEFAULT",
432
+ "state_key": null
433
+ },
434
+ {
435
+ "rep": "ABSOLUTE",
436
+ "type": "NON_EEF",
437
+ "format": "DEFAULT",
438
+ "state_key": null
439
+ },
440
+ {
441
+ "rep": "ABSOLUTE",
442
+ "type": "NON_EEF",
443
+ "format": "DEFAULT",
444
+ "state_key": null
445
+ },
446
+ {
447
+ "rep": "ABSOLUTE",
448
+ "type": "NON_EEF",
449
+ "format": "DEFAULT",
450
+ "state_key": null
451
+ },
452
+ {
453
+ "rep": "ABSOLUTE",
454
+ "type": "NON_EEF",
455
+ "format": "DEFAULT",
456
+ "state_key": null
457
+ },
458
+ {
459
+ "rep": "ABSOLUTE",
460
+ "type": "NON_EEF",
461
+ "format": "DEFAULT",
462
+ "state_key": null
463
+ },
464
+ {
465
+ "rep": "ABSOLUTE",
466
+ "type": "NON_EEF",
467
+ "format": "DEFAULT",
468
+ "state_key": null
469
+ },
470
+ {
471
+ "rep": "ABSOLUTE",
472
+ "type": "NON_EEF",
473
+ "format": "DEFAULT",
474
+ "state_key": null
475
+ }
476
+ ]
477
+ },
478
+ "language": {
479
+ "delta_indices": [
480
+ 0
481
+ ],
482
+ "modality_keys": [
483
+ "annotation.human.task_description"
484
+ ],
485
+ "sin_cos_embedding_keys": null,
486
+ "mean_std_embedding_keys": null,
487
+ "action_configs": null
488
+ }
489
+ }
490
+ },
491
+ "image_crop_size": null,
492
+ "image_target_size": null,
493
+ "use_albumentations": true,
494
+ "random_rotation_angle": null,
495
+ "color_jitter_params": {
496
+ "brightness": 0.3,
497
+ "contrast": 0.4,
498
+ "saturation": 0.5,
499
+ "hue": 0.08
500
+ },
501
+ "shortest_image_edge": 256,
502
+ "crop_fraction": 0.95,
503
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
504
+ "model_type": "eagle",
505
+ "formalize_language": true,
506
+ "max_state_dim": 128,
507
+ "max_action_dim": 128,
508
+ "max_action_horizon": 50,
509
+ "use_percentiles": false,
510
+ "clip_outliers": true,
511
+ "apply_sincos_state_encoding": true,
512
+ "use_relative_action": true
513
+ }
514
+ }
gr00t/simple/G1WholebodyHandoverSonic-v0/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44caf5bb1702a522aeaf2a9d1e49b9c9fd775c5e3d73d8cd353aabef30f7c12d
3
+ size 14917
gr00t/simple/G1WholebodyHandoverSonic-v0/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1ae6a9c6df00d7485d0112a045874badfec4fef392b009c521cb3acacfc61df
3
+ size 14917
gr00t/simple/G1WholebodyHandoverSonic-v0/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:566e63d72ec3169fd51f5dc061a30bf9c5195d001f715224cdd5f6178206f3e5
3
+ size 1465
gr00t/simple/G1WholebodyHandoverSonic-v0/statistics.json ADDED
The diff for this file is too large to render. See raw diff
 
gr00t/simple/G1WholebodyHandoverSonic-v0/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
gr00t/simple/G1WholebodyHandoverSonic-v0/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4404e426d15051e5b133af1bc4848b9f902fc3cd9bb345ce244e2c18c0019c40
3
+ size 7761
gr00t/simple/G1WholebodyHandoverSonic-v0/wandb_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"project": "finetune-gr00t-n1d6", "run_id": "G1WholebodyHandoverSonic-v0"}
gr00t/simple/G1WholebodyHandoverSonic-v0/zero_to_fp32.py ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+
3
+ # Copyright (c) Microsoft Corporation.
4
+ # SPDX-License-Identifier: Apache-2.0
5
+
6
+ # DeepSpeed Team
7
+
8
+ # This script extracts fp32 consolidated weights from a zero 1, 2 and 3 DeepSpeed checkpoints. It gets
9
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
10
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
11
+ # application.
12
+ #
13
+ # example:
14
+ # python zero_to_fp32.py . output_dir/
15
+ # or
16
+ # python zero_to_fp32.py . output_dir/ --safe_serialization
17
+
18
+ import argparse
19
+ import torch
20
+ import glob
21
+ import math
22
+ import os
23
+ import re
24
+ import gc
25
+ import json
26
+ import numpy as np
27
+ from tqdm import tqdm
28
+ from collections import OrderedDict
29
+ from dataclasses import dataclass
30
+
31
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
32
+ # DeepSpeed data structures it has to be available in the current python environment.
33
+ from deepspeed.utils import logger
34
+ from deepspeed.checkpoint.constants import (DS_VERSION, OPTIMIZER_STATE_DICT, SINGLE_PARTITION_OF_FP32_GROUPS,
35
+ FP32_FLAT_GROUPS, ZERO_STAGE, PARTITION_COUNT, PARAM_SHAPES, BUFFER_NAMES,
36
+ FROZEN_PARAM_SHAPES, FROZEN_PARAM_FRAGMENTS)
37
+
38
+
39
+ @dataclass
40
+ class zero_model_state:
41
+ buffers: dict()
42
+ param_shapes: dict()
43
+ shared_params: list
44
+ ds_version: int
45
+ frozen_param_shapes: dict()
46
+ frozen_param_fragments: dict()
47
+
48
+
49
+ debug = 0
50
+
51
+ # load to cpu
52
+ device = torch.device('cpu')
53
+
54
+
55
+ def atoi(text):
56
+ return int(text) if text.isdigit() else text
57
+
58
+
59
+ def natural_keys(text):
60
+ '''
61
+ alist.sort(key=natural_keys) sorts in human order
62
+ http://nedbatchelder.com/blog/200712/human_sorting.html
63
+ (See Toothy's implementation in the comments)
64
+ '''
65
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
66
+
67
+
68
+ def get_model_state_file(checkpoint_dir, zero_stage):
69
+ if not os.path.isdir(checkpoint_dir):
70
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
71
+
72
+ # there should be only one file
73
+ if zero_stage <= 2:
74
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
75
+ elif zero_stage == 3:
76
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
77
+
78
+ if not os.path.exists(file):
79
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
80
+
81
+ return file
82
+
83
+
84
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
85
+ # XXX: need to test that this simple glob rule works for multi-node setup too
86
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
87
+
88
+ if len(ckpt_files) == 0:
89
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
90
+
91
+ return ckpt_files
92
+
93
+
94
+ def get_optim_files(checkpoint_dir):
95
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
96
+
97
+
98
+ def get_model_state_files(checkpoint_dir):
99
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
100
+
101
+
102
+ def parse_model_states(files):
103
+ zero_model_states = []
104
+ for file in files:
105
+ state_dict = torch.load(file, map_location=device, weights_only=False)
106
+
107
+ if BUFFER_NAMES not in state_dict:
108
+ raise ValueError(f"{file} is not a model state checkpoint")
109
+ buffer_names = state_dict[BUFFER_NAMES]
110
+ if debug:
111
+ print("Found buffers:", buffer_names)
112
+
113
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
114
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
115
+ param_shapes = state_dict[PARAM_SHAPES]
116
+
117
+ # collect parameters that are included in param_shapes
118
+ param_names = []
119
+ for s in param_shapes:
120
+ for name in s.keys():
121
+ param_names.append(name)
122
+
123
+ # update with frozen parameters
124
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
125
+ if frozen_param_shapes is not None:
126
+ if debug:
127
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
128
+ param_names += list(frozen_param_shapes.keys())
129
+
130
+ # handle shared params
131
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
132
+
133
+ ds_version = state_dict.get(DS_VERSION, None)
134
+
135
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
136
+
137
+ z_model_state = zero_model_state(buffers=buffers,
138
+ param_shapes=param_shapes,
139
+ shared_params=shared_params,
140
+ ds_version=ds_version,
141
+ frozen_param_shapes=frozen_param_shapes,
142
+ frozen_param_fragments=frozen_param_fragments)
143
+ zero_model_states.append(z_model_state)
144
+
145
+ return zero_model_states
146
+
147
+
148
+ def parse_optim_states(files, ds_checkpoint_dir):
149
+ total_files = len(files)
150
+ state_dicts = []
151
+ for f in tqdm(files, desc='Loading checkpoint shards'):
152
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
153
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
154
+ # and also handle the case where it was already removed by another helper script
155
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
156
+ state_dicts.append(state_dict)
157
+
158
+ if ZERO_STAGE not in state_dicts[0][OPTIMIZER_STATE_DICT]:
159
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
160
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
161
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
162
+
163
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
164
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
165
+ # use the max of the partition_count to get the dp world_size.
166
+
167
+ if type(world_size) is list:
168
+ world_size = max(world_size)
169
+
170
+ if world_size != total_files:
171
+ raise ValueError(
172
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
173
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
174
+ )
175
+
176
+ # the groups are named differently in each stage
177
+ if zero_stage <= 2:
178
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
179
+ elif zero_stage == 3:
180
+ fp32_groups_key = FP32_FLAT_GROUPS
181
+ else:
182
+ raise ValueError(f"unknown zero stage {zero_stage}")
183
+
184
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
185
+ return zero_stage, world_size, fp32_flat_groups
186
+
187
+
188
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
189
+ """
190
+ Returns fp32 state_dict reconstructed from ds checkpoint
191
+
192
+ Args:
193
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
194
+
195
+ """
196
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
197
+
198
+ optim_files = get_optim_files(ds_checkpoint_dir)
199
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
200
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
201
+
202
+ model_files = get_model_state_files(ds_checkpoint_dir)
203
+
204
+ zero_model_states = parse_model_states(model_files)
205
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
206
+
207
+ if zero_stage <= 2:
208
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
209
+ exclude_frozen_parameters)
210
+ elif zero_stage == 3:
211
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
212
+ exclude_frozen_parameters)
213
+
214
+
215
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
216
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
217
+ return
218
+
219
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
220
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
221
+
222
+ if debug:
223
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
224
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
225
+
226
+ wanted_params = len(frozen_param_shapes)
227
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
228
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
229
+ print(f'Frozen params: Have {avail_numel} numels to process.')
230
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
231
+
232
+ total_params = 0
233
+ total_numel = 0
234
+ for name, shape in frozen_param_shapes.items():
235
+ total_params += 1
236
+ unpartitioned_numel = shape.numel()
237
+ total_numel += unpartitioned_numel
238
+
239
+ state_dict[name] = frozen_param_fragments[name]
240
+
241
+ if debug:
242
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
243
+
244
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
245
+
246
+
247
+ def _has_callable(obj, fn):
248
+ attr = getattr(obj, fn, None)
249
+ return callable(attr)
250
+
251
+
252
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
253
+ param_shapes = zero_model_states[0].param_shapes
254
+
255
+ # Reconstruction protocol:
256
+ #
257
+ # XXX: document this
258
+
259
+ if debug:
260
+ for i in range(world_size):
261
+ for j in range(len(fp32_flat_groups[0])):
262
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
263
+
264
+ # XXX: memory usage doubles here (zero2)
265
+ num_param_groups = len(fp32_flat_groups[0])
266
+ merged_single_partition_of_fp32_groups = []
267
+ for i in range(num_param_groups):
268
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
269
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
270
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
271
+ avail_numel = sum(
272
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
273
+
274
+ if debug:
275
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
276
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
277
+ # not asserting if there is a mismatch due to possible padding
278
+ print(f"Have {avail_numel} numels to process.")
279
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
280
+
281
+ # params
282
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
283
+ # out-of-core computing solution
284
+ total_numel = 0
285
+ total_params = 0
286
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
287
+ offset = 0
288
+ avail_numel = full_single_fp32_vector.numel()
289
+ for name, shape in shapes.items():
290
+
291
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
292
+ total_numel += unpartitioned_numel
293
+ total_params += 1
294
+
295
+ if debug:
296
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
297
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
298
+ offset += unpartitioned_numel
299
+
300
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
301
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
302
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
303
+ # live optimizer object, so we are checking that the numbers are within the right range
304
+ align_to = 2 * world_size
305
+
306
+ def zero2_align(x):
307
+ return align_to * math.ceil(x / align_to)
308
+
309
+ if debug:
310
+ print(f"original offset={offset}, avail_numel={avail_numel}")
311
+
312
+ offset = zero2_align(offset)
313
+ avail_numel = zero2_align(avail_numel)
314
+
315
+ if debug:
316
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
317
+
318
+ # Sanity check
319
+ if offset != avail_numel:
320
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
321
+
322
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
323
+
324
+
325
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
326
+ exclude_frozen_parameters):
327
+ state_dict = OrderedDict()
328
+
329
+ # buffers
330
+ buffers = zero_model_states[0].buffers
331
+ state_dict.update(buffers)
332
+ if debug:
333
+ print(f"added {len(buffers)} buffers")
334
+
335
+ if not exclude_frozen_parameters:
336
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
337
+
338
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
339
+
340
+ # recover shared parameters
341
+ for pair in zero_model_states[0].shared_params:
342
+ if pair[1] in state_dict:
343
+ state_dict[pair[0]] = state_dict[pair[1]]
344
+
345
+ return state_dict
346
+
347
+
348
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
349
+ remainder = unpartitioned_numel % world_size
350
+ padding_numel = (world_size - remainder) if remainder else 0
351
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
352
+ return partitioned_numel, padding_numel
353
+
354
+
355
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
356
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
357
+ return
358
+
359
+ if debug:
360
+ for i in range(world_size):
361
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
362
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
363
+
364
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
365
+ wanted_params = len(frozen_param_shapes)
366
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
367
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
368
+ print(f'Frozen params: Have {avail_numel} numels to process.')
369
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
370
+
371
+ total_params = 0
372
+ total_numel = 0
373
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
374
+ total_params += 1
375
+ unpartitioned_numel = shape.numel()
376
+ total_numel += unpartitioned_numel
377
+
378
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
379
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
380
+
381
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
382
+
383
+ if debug:
384
+ print(
385
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
386
+ )
387
+
388
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
389
+
390
+
391
+ class GatheredTensor:
392
+ """
393
+ A pseudo tensor that collects partitioned weights.
394
+ It is more memory efficient when there are multiple groups.
395
+ """
396
+
397
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
398
+ self.flat_groups = flat_groups
399
+ self.flat_groups_offset = flat_groups_offset
400
+ self.offset = offset
401
+ self.partitioned_numel = partitioned_numel
402
+ self.shape = shape
403
+ self.dtype = self.flat_groups[0][0].dtype
404
+
405
+ def contiguous(self):
406
+ """
407
+ Merge partitioned weights from flat_groups into a single tensor.
408
+ """
409
+ end_idx = self.offset + self.partitioned_numel
410
+ world_size = len(self.flat_groups)
411
+ pad_flat_param_chunks = []
412
+
413
+ for rank_i in range(world_size):
414
+ # for each rank, we need to collect weights from related group/groups
415
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
416
+ start_group_id = None
417
+ end_group_id = None
418
+ for group_id in range(len(self.flat_groups_offset)):
419
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
420
+ start_group_id = group_id
421
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
422
+ end_group_id = group_id
423
+ break
424
+ # collect weights from related group/groups
425
+ for group_id in range(start_group_id, end_group_id + 1):
426
+ flat_tensor = flat_groups_at_rank_i[group_id]
427
+ start_offset = self.offset - self.flat_groups_offset[group_id]
428
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
429
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
430
+
431
+ # collect weights from all ranks
432
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
433
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
434
+ return param
435
+
436
+
437
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
438
+ param_shapes = zero_model_states[0].param_shapes
439
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
440
+
441
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
442
+ # param, re-consolidating each param, while dealing with padding if any
443
+
444
+ # merge list of dicts, preserving order
445
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
446
+
447
+ if debug:
448
+ for i in range(world_size):
449
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
450
+
451
+ wanted_params = len(param_shapes)
452
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
453
+ # not asserting if there is a mismatch due to possible padding
454
+ avail_numel = fp32_flat_groups[0].numel() * world_size
455
+ print(f"Trainable params: Have {avail_numel} numels to process.")
456
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
457
+
458
+ # params
459
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
460
+ # out-of-core computing solution
461
+ offset = 0
462
+ total_numel = 0
463
+ total_params = 0
464
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
465
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
466
+ unpartitioned_numel = shape.numel()
467
+ total_numel += unpartitioned_numel
468
+ total_params += 1
469
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
470
+
471
+ if debug:
472
+ print(
473
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
474
+ )
475
+
476
+ # memory efficient tensor
477
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
478
+ state_dict[name] = tensor
479
+ offset += partitioned_numel
480
+
481
+ offset *= world_size
482
+
483
+ # Sanity check
484
+ if offset != avail_numel:
485
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
486
+
487
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
488
+
489
+
490
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
491
+ exclude_frozen_parameters):
492
+ state_dict = OrderedDict()
493
+
494
+ # buffers
495
+ buffers = zero_model_states[0].buffers
496
+ state_dict.update(buffers)
497
+ if debug:
498
+ print(f"added {len(buffers)} buffers")
499
+
500
+ if not exclude_frozen_parameters:
501
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
502
+
503
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
504
+
505
+ # recover shared parameters
506
+ for pair in zero_model_states[0].shared_params:
507
+ if pair[1] in state_dict:
508
+ state_dict[pair[0]] = state_dict[pair[1]]
509
+
510
+ return state_dict
511
+
512
+
513
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
514
+ """
515
+ Convert state_dict of GatheredTensor to torch tensor
516
+ """
517
+ torch_state_dict = {}
518
+ converted_tensors = {}
519
+ for name, tensor in state_dict.items():
520
+ tensor_id = id(tensor)
521
+ if tensor_id in converted_tensors: # shared tensors
522
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
523
+ torch_state_dict[name] = shared_tensor
524
+ else:
525
+ converted_tensors[tensor_id] = name
526
+ if return_empty_tensor:
527
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
528
+ else:
529
+ torch_state_dict[name] = tensor.contiguous()
530
+ return torch_state_dict
531
+
532
+
533
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
534
+ tag=None,
535
+ exclude_frozen_parameters=False,
536
+ lazy_mode=False):
537
+ """
538
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
539
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
540
+ via a model hub.
541
+
542
+ Args:
543
+ - ``checkpoint_dir``: path to the desired checkpoint folder
544
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in 'latest' file. e.g., ``global_step14``
545
+ - ``exclude_frozen_parameters``: exclude frozen parameters
546
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
547
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
548
+
549
+ Returns:
550
+ - pytorch ``state_dict``
551
+
552
+ A typical usage might be ::
553
+
554
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
555
+ # do the training and checkpoint saving
556
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
557
+ model = model.cpu() # move to cpu
558
+ model.load_state_dict(state_dict)
559
+ # submit to model hub or save the model to share with others
560
+
561
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
562
+ application. i.e. you will need to re-initialize the deepspeed engine, since
563
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
564
+
565
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
566
+
567
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
568
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
569
+ the checkpoint. Or you can load state_dict in lazy mode ::
570
+
571
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
572
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
573
+ for name, lazy_tensor in state_dict.item():
574
+ tensor = lazy_tensor.contiguous() # to cpu
575
+ print(name, tensor)
576
+ # del tensor to release memory if it no longer in use
577
+ """
578
+ if tag is None:
579
+ latest_path = os.path.join(checkpoint_dir, 'latest')
580
+ if os.path.isfile(latest_path):
581
+ with open(latest_path, 'r') as fd:
582
+ tag = fd.read().strip()
583
+ else:
584
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
585
+
586
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
587
+
588
+ if not os.path.isdir(ds_checkpoint_dir):
589
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
590
+
591
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
592
+ if lazy_mode:
593
+ return state_dict
594
+ else:
595
+ return to_torch_tensor(state_dict)
596
+
597
+
598
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
599
+ output_dir,
600
+ max_shard_size="5GB",
601
+ safe_serialization=False,
602
+ tag=None,
603
+ exclude_frozen_parameters=False):
604
+ """
605
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
606
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
607
+
608
+ Args:
609
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
610
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
611
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
612
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
613
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
614
+ - ``exclude_frozen_parameters``: exclude frozen parameters
615
+ """
616
+
617
+ # Dependency pre-check
618
+ if safe_serialization:
619
+ try:
620
+ from safetensors.torch import save_file
621
+ except ImportError:
622
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
623
+ raise
624
+ if max_shard_size is not None:
625
+ try:
626
+ from huggingface_hub import split_torch_state_dict_into_shards
627
+ except ImportError:
628
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
629
+ raise
630
+
631
+ # Convert zero checkpoint to state_dict
632
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
633
+ tag,
634
+ exclude_frozen_parameters,
635
+ lazy_mode=True)
636
+
637
+ # Shard the model if it is too big.
638
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
639
+ if max_shard_size is not None:
640
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
641
+ # an memory-efficient approach for sharding
642
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
643
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
644
+ filename_pattern=filename_pattern,
645
+ max_shard_size=max_shard_size)
646
+ else:
647
+ from collections import namedtuple
648
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
649
+ state_dict_split = StateDictSplit(is_sharded=False,
650
+ filename_to_tensors={weights_name: list(state_dict.keys())})
651
+
652
+ # Save the model by shard
653
+ os.makedirs(output_dir, exist_ok=True)
654
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
655
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
656
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
657
+ shard_state_dict = to_torch_tensor(shard_state_dict)
658
+ output_path = os.path.join(output_dir, shard_file)
659
+ if safe_serialization:
660
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
661
+ else:
662
+ torch.save(shard_state_dict, output_path)
663
+ # release the memory of current shard
664
+ for tensor_name in list(shard_state_dict.keys()):
665
+ del state_dict[tensor_name]
666
+ del shard_state_dict[tensor_name]
667
+ del shard_state_dict
668
+ gc.collect()
669
+
670
+ # Save index if sharded
671
+ if state_dict_split.is_sharded:
672
+ index = {
673
+ "metadata": state_dict_split.metadata,
674
+ "weight_map": state_dict_split.tensor_to_filename,
675
+ }
676
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
677
+ save_index_file = os.path.join(output_dir, save_index_file)
678
+ with open(save_index_file, "w", encoding="utf-8") as f:
679
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
680
+ f.write(content)
681
+
682
+
683
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
684
+ """
685
+ 1. Put the provided model to cpu
686
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
687
+ 3. Load it into the provided model
688
+
689
+ Args:
690
+ - ``model``: the model object to update
691
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
692
+ - ``tag``: checkpoint tag used as a unique identifier for checkpoint. If not provided will attempt to load tag in the file named ``latest`` in the checkpoint folder, e.g., ``global_step14``
693
+
694
+ Returns:
695
+ - ``model`: modified model
696
+
697
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
698
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
699
+ conveniently placed for you in the checkpoint folder.
700
+
701
+ A typical usage might be ::
702
+
703
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
704
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
705
+ # submit to model hub or save the model to share with others
706
+
707
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
708
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
709
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
710
+
711
+ """
712
+ logger.info("Extracting fp32 weights")
713
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
714
+
715
+ logger.info("Overwriting model with fp32 weights")
716
+ model = model.cpu()
717
+ model.load_state_dict(state_dict, strict=False)
718
+
719
+ return model
720
+
721
+
722
+ if __name__ == "__main__":
723
+ parser = argparse.ArgumentParser()
724
+ parser.add_argument("checkpoint_dir",
725
+ type=str,
726
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
727
+ parser.add_argument("output_dir",
728
+ type=str,
729
+ help="directory to the pytorch fp32 state_dict output files"
730
+ "(e.g. path/checkpoint-12-output/)")
731
+ parser.add_argument(
732
+ "--max_shard_size",
733
+ type=str,
734
+ default="5GB",
735
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
736
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
737
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
738
+ "without CPU OOM issues.")
739
+ parser.add_argument(
740
+ "--safe_serialization",
741
+ default=False,
742
+ action='store_true',
743
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
744
+ parser.add_argument("-t",
745
+ "--tag",
746
+ type=str,
747
+ default=None,
748
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
749
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
750
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
751
+ args = parser.parse_args()
752
+
753
+ debug = args.debug
754
+
755
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
756
+ args.output_dir,
757
+ max_shard_size=args.max_shard_size,
758
+ safe_serialization=args.safe_serialization,
759
+ tag=args.tag,
760
+ exclude_frozen_parameters=args.exclude_frozen_parameters)