pravsels commited on
Commit
f1d4a97
·
verified ·
1 Parent(s): 05c8102

Upload GR00T N1.7 checkpoint step 20000 to repo root

Browse files
config.json ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "action_horizon": 40,
3
+ "add_pos_embed": true,
4
+ "apply_sincos_state_encoding": false,
5
+ "architectures": [
6
+ "Gr00tN1d7"
7
+ ],
8
+ "attn_dropout": 0.2,
9
+ "attn_implementation": null,
10
+ "backbone_embedding_dim": 2048,
11
+ "backbone_trainable_params_fp32": true,
12
+ "color_jitter_params": {
13
+ "brightness": 0.3,
14
+ "contrast": 0.4,
15
+ "hue": 0.08,
16
+ "saturation": 0.5
17
+ },
18
+ "crop_fraction": 0.95,
19
+ "diffusion_model_cfg": {
20
+ "attention_head_dim": 48,
21
+ "dropout": 0.2,
22
+ "final_dropout": true,
23
+ "interleave_self_attention": true,
24
+ "norm_type": "ada_norm",
25
+ "num_attention_heads": 32,
26
+ "num_layers": 32,
27
+ "output_dim": 1024,
28
+ "positional_embeddings": null
29
+ },
30
+ "dtype": "bfloat16",
31
+ "exclude_state": false,
32
+ "formalize_language": true,
33
+ "hidden_size": 1024,
34
+ "image_crop_size": [
35
+ 230,
36
+ 230
37
+ ],
38
+ "image_target_size": [
39
+ 256,
40
+ 256
41
+ ],
42
+ "letter_box_transform": false,
43
+ "load_bf16": true,
44
+ "max_action_dim": 132,
45
+ "max_num_embodiments": 32,
46
+ "max_seq_len": 1024,
47
+ "max_state_dim": 132,
48
+ "model_dtype": "bfloat16",
49
+ "model_name": "nvidia/Cosmos-Reason2-2B",
50
+ "model_type": "Gr00tN1d7",
51
+ "noise_beta_alpha": 1.5,
52
+ "noise_beta_beta": 1.0,
53
+ "noise_s": 0.999,
54
+ "num_inference_timesteps": 4,
55
+ "num_timestep_buckets": 1000,
56
+ "random_history_crop": true,
57
+ "random_rotation_angle": 0,
58
+ "reproject_vision": false,
59
+ "rtc_ramp_rate": 6.0,
60
+ "select_layer": 16,
61
+ "shortest_image_edge": 256,
62
+ "state_dropout_prob": 0.2,
63
+ "state_gaussian_noise_std": 0.0,
64
+ "transformers_version": "4.57.3",
65
+ "tune_diffusion_model": true,
66
+ "tune_linear": true,
67
+ "tune_llm": false,
68
+ "tune_projector": true,
69
+ "tune_top_llm_layers": 0,
70
+ "tune_visual": false,
71
+ "tune_vlln": true,
72
+ "use_albumentations": true,
73
+ "use_alternate_vl_dit": true,
74
+ "use_flash_attention": true,
75
+ "use_future_tokens": false,
76
+ "use_mean_std": false,
77
+ "use_percentiles": true,
78
+ "use_vl_self_attention": true,
79
+ "use_vlln": true,
80
+ "vl_self_attention_cfg": {
81
+ "attention_head_dim": 64,
82
+ "dropout": 0.2,
83
+ "final_dropout": true,
84
+ "num_attention_heads": 32,
85
+ "num_layers": 4,
86
+ "positional_embeddings": null
87
+ }
88
+ }
embodiment_id.json ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "robocasa_panda_omron": 13,
3
+ "oxe_droid": 17,
4
+ "oxe_fractal": 18,
5
+ "oxe_language_table": 19,
6
+ "oxe_bridge": 20,
7
+ "unknown": 22,
8
+ "gr1_unified": 20,
9
+ "agibot": 26,
10
+ "sim_behavior_r1_pro": 23,
11
+ "xdof": 24,
12
+ "xdof_oss_data": 25,
13
+ "unitree_g1_full_body_with_waist_height_nav_cmd": 25,
14
+ "real_r1_pro_sharpa": 27,
15
+ "real_r1_pro_sharpa_add_view": 27,
16
+ "real_r1_pro_sharpa_relative_arm_joint": 26,
17
+ "real_r1_pro_sharpa_delta_eef": 26,
18
+ "real_r1_pro_sharpa_absolute_eef": 26,
19
+ "real_r1_pro_sharpa_meanstd": 26,
20
+ "real_r1_pro_sharpa_relative_eef": 26,
21
+ "real_r1_pro_sharpa_relative_eef_add_view": 26,
22
+ "real_r1_pro_sharpa_relative_eef_relative_hand": 26,
23
+ "real_r1_pro_sharpa_relative_eef_human": 26,
24
+ "real_r1_pro_sharpa_relative_eef_human_add_view": 26,
25
+ "real_r1_pro_sharpa_relative_eef_human_relative_hand": 26,
26
+ "real_r1_pro_sharpa_relative_eef_egodex": 26,
27
+ "real_r1_pro_sharpa_relative_eef_egodex_relative_hand": 26,
28
+ "real_r1_pro_sharpa_relative_eef_egodex_wrist_only": 26,
29
+ "real_r1_pro_sharpa_relative_eef_maxinsights": 26,
30
+ "real_r1_pro_sharpa_relative_eef_maxinsights_relative_hand": 26,
31
+ "real_r1_pro_sharpa_relative_eef_mecka": 26,
32
+ "real_r1_pro_sharpa_relative_eef_mecka_relative_hand": 26,
33
+ "real_g1_relative_eef_absolute_joints": 25,
34
+ "real_g1_relative_eef_absolute_joints_wrist_cam": 25,
35
+ "real_g1_relative_eef_relative_joints": 25,
36
+ "real_r1_pro_sharpa_relative_eef_relative_hand_relative_joint": 26,
37
+ "real_r1_pro_sharpa_relative_joint": 29,
38
+ "oxe_droid_relative_eef_relative_joint": 24,
39
+ "oxe_droid_relative_eef_relative_joint_swapped": 24,
40
+ "oxe_droid_relative_eef_relative_joint_upweight_z": 24,
41
+ "oxe_droid_relative_eef_relative_joint_upweight_z_swapped": 24,
42
+ "oxe_droid_relative_eef_relative_joint_3view": 24,
43
+ "oxe_droid_relative_eef_relative_joint_3view_swapped": 24,
44
+ "oxe_droid_relative_eef": 24,
45
+ "oxe_droid_joint_position_relative": 24,
46
+ "xdof_relative_eef_relative_joint": 27,
47
+ "xdof_relative_eef_relative_joint_subtask": 27,
48
+ "xdof_relative_eef": 27,
49
+ "xdof_relative_joint": 28,
50
+ "simpler_env_google": 0,
51
+ "simpler_env_widowx": 1,
52
+ "libero_sim": 2,
53
+ "droid_sim": 3,
54
+ "new_embodiment": 10,
55
+ "robocasa_gr1_tabletop": 10,
56
+ "unitree_g1_sonic": 11
57
+ }
experiment_cfg/conf.yaml ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ load_config_path: null
2
+ model:
3
+ model_type: Gr00tN1d7
4
+ model_dtype: bfloat16
5
+ model_name: nvidia/Cosmos-Reason2-2B
6
+ backbone_model_type: qwen
7
+ model_revision: null
8
+ tune_top_llm_layers: 0
9
+ backbone_embedding_dim: 2048
10
+ tune_llm: false
11
+ tune_visual: false
12
+ select_layer: 12
13
+ reproject_vision: false
14
+ use_flash_attention: true
15
+ load_bf16: true
16
+ backbone_trainable_params_fp32: true
17
+ image_crop_size:
18
+ - 230
19
+ - 230
20
+ image_target_size:
21
+ - 256
22
+ - 256
23
+ shortest_image_edge: null
24
+ crop_fraction: null
25
+ random_rotation_angle: null
26
+ color_jitter_params:
27
+ brightness: 0.3
28
+ contrast: 0.4
29
+ saturation: 0.5
30
+ hue: 0.08
31
+ use_albumentations_transforms: true
32
+ letter_box_transform: false
33
+ extra_augmentation_config: null
34
+ formalize_language: true
35
+ apply_sincos_state_encoding: false
36
+ use_percentiles: true
37
+ use_relative_action: true
38
+ max_state_dim: 132
39
+ max_action_dim: 132
40
+ action_horizon: 40
41
+ hidden_size: 1024
42
+ input_embedding_dim: 1536
43
+ state_history_length: 1
44
+ add_pos_embed: true
45
+ attn_dropout: 0.2
46
+ use_vlln: true
47
+ max_seq_len: 1024
48
+ use_alternate_vl_dit: true
49
+ attend_text_every_n_blocks: 2
50
+ diffusion_model_cfg:
51
+ positional_embeddings: null
52
+ num_layers: 16
53
+ num_attention_heads: 32
54
+ attention_head_dim: 48
55
+ norm_type: ada_norm
56
+ dropout: 0.2
57
+ final_dropout: true
58
+ output_dim: 1024
59
+ interleave_self_attention: true
60
+ num_inference_timesteps: 4
61
+ noise_beta_alpha: 1.5
62
+ noise_beta_beta: 1.0
63
+ noise_s: 0.999
64
+ num_timestep_buckets: 1000
65
+ tune_projector: true
66
+ tune_diffusion_model: true
67
+ tune_vlln: true
68
+ state_dropout_prob: 0.2
69
+ exclude_state: false
70
+ use_mean_std: false
71
+ max_num_embodiments: 32
72
+ data:
73
+ datasets:
74
+ - dataset_paths:
75
+ - /workspace/vast_runs/groot/datasets/ring_insert
76
+ embodiment_tag: new_embodiment
77
+ mix_ratio: 1.0
78
+ dataset_type: physical_embodiment
79
+ val_dataset_path: null
80
+ modality_configs:
81
+ new_embodiment:
82
+ video:
83
+ delta_indices:
84
+ - 0
85
+ modality_keys:
86
+ - front
87
+ - wrist
88
+ - top
89
+ sin_cos_embedding_keys: null
90
+ mean_std_embedding_keys: null
91
+ action_configs: null
92
+ state:
93
+ delta_indices:
94
+ - 0
95
+ modality_keys:
96
+ - single_arm
97
+ - gripper
98
+ sin_cos_embedding_keys: null
99
+ mean_std_embedding_keys: null
100
+ action_configs: null
101
+ action:
102
+ delta_indices:
103
+ - 0
104
+ - 1
105
+ - 2
106
+ - 3
107
+ - 4
108
+ - 5
109
+ - 6
110
+ - 7
111
+ - 8
112
+ - 9
113
+ - 10
114
+ - 11
115
+ - 12
116
+ - 13
117
+ - 14
118
+ - 15
119
+ modality_keys:
120
+ - single_arm
121
+ - gripper
122
+ sin_cos_embedding_keys: null
123
+ mean_std_embedding_keys: null
124
+ action_configs:
125
+ - rep: RELATIVE
126
+ type: NON_EEF
127
+ format: DEFAULT
128
+ state_key: null
129
+ - rep: ABSOLUTE
130
+ type: NON_EEF
131
+ format: DEFAULT
132
+ state_key: null
133
+ language:
134
+ delta_indices:
135
+ - 0
136
+ modality_keys:
137
+ - annotation.human.task_description
138
+ sin_cos_embedding_keys: null
139
+ mean_std_embedding_keys: null
140
+ action_configs: null
141
+ download_cache: false
142
+ shard_size: 1024
143
+ episode_sampling_rate: 0.1
144
+ num_shards_per_epoch: 100000
145
+ override_pretraining_statistics: true
146
+ mode: single_turn
147
+ random_chop: 0.0
148
+ mock_dataset_mode: false
149
+ shuffle: true
150
+ seed: 42
151
+ multiprocessing_context: fork
152
+ allow_padding: false
153
+ subsample_ratio: 1.0
154
+ image_crop_size:
155
+ - 244
156
+ - 244
157
+ image_target_size:
158
+ - 224
159
+ - 224
160
+ training:
161
+ output_dir: /workspace/vast_runs/groot/checkpoints/groot_ring_insert
162
+ experiment_name: groot_ring_insert
163
+ max_steps: 20000
164
+ global_batch_size: 32
165
+ per_gpu_batch_size: null
166
+ gradient_accumulation_steps: 1
167
+ learning_rate: 0.0001
168
+ lr_scheduler_type: cosine
169
+ weight_decay: 1.0e-05
170
+ warmup_ratio: 0.05
171
+ warmup_steps: 0
172
+ max_grad_norm: 1.0
173
+ optim: adamw_torch
174
+ start_from_checkpoint: nvidia/GR00T-N1.7-3B
175
+ skip_weight_loading: false
176
+ tf32: true
177
+ fp16: false
178
+ bf16: true
179
+ eval_bf16: true
180
+ logging_steps: 10
181
+ save_steps: 5000
182
+ save_total_limit: 5
183
+ save_vl_model: false
184
+ save_only_model: false
185
+ resume_from_checkpoint: false
186
+ upload_checkpoints: false
187
+ upload_every: 1000
188
+ upload_last_n_checkpoints: 5
189
+ max_concurrent_uploads: 2
190
+ eval_strategy: 'no'
191
+ eval_steps: 500
192
+ eval_set_split_ratio: 0.1
193
+ eval_batch_size: 2
194
+ save_best_eval_metric_name: ''
195
+ save_best_eval_metric_greater_is_better: true
196
+ deepspeed_stage: 2
197
+ gradient_checkpointing: false
198
+ transformers_trust_remote_code: true
199
+ transformers_local_files_only: false
200
+ transformers_cache_dir: null
201
+ transformers_access_token: null
202
+ use_ddp: false
203
+ ddp_bucket_cap_mb: 100
204
+ num_gpus: 4
205
+ dataloader_num_workers: 8
206
+ remove_unused_columns: false
207
+ use_wandb: true
208
+ wandb_project: groot_ring_insert
209
+ enable_profiling: false
210
+ max_retries: 3
211
+ assert_loss_less_than: null
212
+ add_rl_callback: false
213
+ enable_open_loop_eval: false
214
+ open_loop_eval_traj_ids:
215
+ - 0
216
+ open_loop_eval_steps_per_traj: 100
217
+ open_loop_eval_plot_indices: null
218
+ max_steps: 20000
219
+ save_steps: 5000
experiment_cfg/config.yaml ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ load_config_path: null
2
+ model:
3
+ model_type: Gr00tN1d7
4
+ model_dtype: bfloat16
5
+ model_name: nvidia/Cosmos-Reason2-2B
6
+ backbone_model_type: qwen
7
+ model_revision: null
8
+ tune_top_llm_layers: 0
9
+ backbone_embedding_dim: 2048
10
+ tune_llm: false
11
+ tune_visual: false
12
+ select_layer: 12
13
+ reproject_vision: false
14
+ use_flash_attention: true
15
+ load_bf16: true
16
+ backbone_trainable_params_fp32: true
17
+ image_crop_size:
18
+ - 230
19
+ - 230
20
+ image_target_size:
21
+ - 256
22
+ - 256
23
+ shortest_image_edge: null
24
+ crop_fraction: null
25
+ random_rotation_angle: null
26
+ color_jitter_params:
27
+ brightness: 0.3
28
+ contrast: 0.4
29
+ saturation: 0.5
30
+ hue: 0.08
31
+ use_albumentations_transforms: true
32
+ letter_box_transform: false
33
+ extra_augmentation_config: null
34
+ formalize_language: true
35
+ apply_sincos_state_encoding: false
36
+ use_percentiles: true
37
+ use_relative_action: true
38
+ max_state_dim: 132
39
+ max_action_dim: 132
40
+ action_horizon: 40
41
+ hidden_size: 1024
42
+ input_embedding_dim: 1536
43
+ state_history_length: 1
44
+ add_pos_embed: true
45
+ attn_dropout: 0.2
46
+ use_vlln: true
47
+ max_seq_len: 1024
48
+ use_alternate_vl_dit: true
49
+ attend_text_every_n_blocks: 2
50
+ diffusion_model_cfg:
51
+ positional_embeddings: null
52
+ num_layers: 16
53
+ num_attention_heads: 32
54
+ attention_head_dim: 48
55
+ norm_type: ada_norm
56
+ dropout: 0.2
57
+ final_dropout: true
58
+ output_dim: 1024
59
+ interleave_self_attention: true
60
+ num_inference_timesteps: 4
61
+ noise_beta_alpha: 1.5
62
+ noise_beta_beta: 1.0
63
+ noise_s: 0.999
64
+ num_timestep_buckets: 1000
65
+ tune_projector: true
66
+ tune_diffusion_model: true
67
+ tune_vlln: true
68
+ state_dropout_prob: 0.2
69
+ exclude_state: false
70
+ use_mean_std: false
71
+ max_num_embodiments: 32
72
+ data:
73
+ datasets:
74
+ - dataset_paths:
75
+ - /workspace/vast_runs/groot/datasets/ring_insert
76
+ embodiment_tag: new_embodiment
77
+ mix_ratio: 1.0
78
+ dataset_type: physical_embodiment
79
+ val_dataset_path: null
80
+ modality_configs:
81
+ new_embodiment:
82
+ video:
83
+ delta_indices:
84
+ - 0
85
+ modality_keys:
86
+ - front
87
+ - wrist
88
+ - top
89
+ sin_cos_embedding_keys: null
90
+ mean_std_embedding_keys: null
91
+ action_configs: null
92
+ state:
93
+ delta_indices:
94
+ - 0
95
+ modality_keys:
96
+ - single_arm
97
+ - gripper
98
+ sin_cos_embedding_keys: null
99
+ mean_std_embedding_keys: null
100
+ action_configs: null
101
+ action:
102
+ delta_indices:
103
+ - 0
104
+ - 1
105
+ - 2
106
+ - 3
107
+ - 4
108
+ - 5
109
+ - 6
110
+ - 7
111
+ - 8
112
+ - 9
113
+ - 10
114
+ - 11
115
+ - 12
116
+ - 13
117
+ - 14
118
+ - 15
119
+ modality_keys:
120
+ - single_arm
121
+ - gripper
122
+ sin_cos_embedding_keys: null
123
+ mean_std_embedding_keys: null
124
+ action_configs:
125
+ - rep: relative
126
+ type: non_eef
127
+ format: default
128
+ state_key: null
129
+ - rep: absolute
130
+ type: non_eef
131
+ format: default
132
+ state_key: null
133
+ language:
134
+ delta_indices:
135
+ - 0
136
+ modality_keys:
137
+ - annotation.human.task_description
138
+ sin_cos_embedding_keys: null
139
+ mean_std_embedding_keys: null
140
+ action_configs: null
141
+ download_cache: false
142
+ shard_size: 1024
143
+ episode_sampling_rate: 0.1
144
+ num_shards_per_epoch: 100000
145
+ override_pretraining_statistics: true
146
+ mode: single_turn
147
+ random_chop: 0.0
148
+ mock_dataset_mode: false
149
+ shuffle: true
150
+ seed: 42
151
+ multiprocessing_context: fork
152
+ allow_padding: false
153
+ subsample_ratio: 1.0
154
+ image_crop_size:
155
+ - 244
156
+ - 244
157
+ image_target_size:
158
+ - 224
159
+ - 224
160
+ training:
161
+ output_dir: /workspace/vast_runs/groot/checkpoints/groot_ring_insert
162
+ experiment_name: groot_ring_insert
163
+ max_steps: 20000
164
+ global_batch_size: 32
165
+ per_gpu_batch_size: null
166
+ gradient_accumulation_steps: 1
167
+ learning_rate: 0.0001
168
+ lr_scheduler_type: cosine
169
+ weight_decay: 1.0e-05
170
+ warmup_ratio: 0.05
171
+ warmup_steps: 0
172
+ max_grad_norm: 1.0
173
+ optim: adamw_torch
174
+ start_from_checkpoint: nvidia/GR00T-N1.7-3B
175
+ skip_weight_loading: false
176
+ tf32: true
177
+ fp16: false
178
+ bf16: true
179
+ eval_bf16: true
180
+ logging_steps: 10
181
+ save_steps: 5000
182
+ save_total_limit: 5
183
+ save_vl_model: false
184
+ save_only_model: false
185
+ resume_from_checkpoint: false
186
+ upload_checkpoints: false
187
+ upload_every: 1000
188
+ upload_last_n_checkpoints: 5
189
+ max_concurrent_uploads: 2
190
+ eval_strategy: 'no'
191
+ eval_steps: 500
192
+ eval_set_split_ratio: 0.1
193
+ eval_batch_size: 2
194
+ save_best_eval_metric_name: ''
195
+ save_best_eval_metric_greater_is_better: true
196
+ deepspeed_stage: 2
197
+ gradient_checkpointing: false
198
+ transformers_trust_remote_code: true
199
+ transformers_local_files_only: false
200
+ transformers_cache_dir: null
201
+ transformers_access_token: null
202
+ use_ddp: false
203
+ ddp_bucket_cap_mb: 100
204
+ num_gpus: 4
205
+ dataloader_num_workers: 8
206
+ remove_unused_columns: false
207
+ use_wandb: true
208
+ wandb_project: groot_ring_insert
209
+ enable_profiling: false
210
+ max_retries: 3
211
+ assert_loss_less_than: null
212
+ add_rl_callback: false
213
+ enable_open_loop_eval: false
214
+ open_loop_eval_traj_ids:
215
+ - 0
216
+ open_loop_eval_steps_per_traj: 100
217
+ open_loop_eval_plot_indices: null
experiment_cfg/dataset_statistics.json ADDED
@@ -0,0 +1,824 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "new_embodiment": {
3
+ "state": {
4
+ "single_arm": {
5
+ "min": [
6
+ -29.010988235473633,
7
+ -101.84615325927734,
8
+ -25.846153259277344,
9
+ -3.780219793319702,
10
+ -30.63736343383789
11
+ ],
12
+ "max": [
13
+ 39.120880126953125,
14
+ 30.19780158996582,
15
+ 96.26373291015625,
16
+ 99.86813354492188,
17
+ 33.71428680419922
18
+ ],
19
+ "mean": [
20
+ 1.988936185836792,
21
+ -38.90863800048828,
22
+ 54.020042419433594,
23
+ 49.90645980834961,
24
+ -0.4925313889980316
25
+ ],
26
+ "std": [
27
+ 13.722591400146484,
28
+ 35.96825408935547,
29
+ 31.793231964111328,
30
+ 21.93545150756836,
31
+ 9.928781509399414
32
+ ],
33
+ "q01": [
34
+ -23.824174880981445,
35
+ -101.31867980957031,
36
+ -11.245714569091794,
37
+ 0.35164836049079895,
38
+ -21.318681716918945
39
+ ],
40
+ "q99": [
41
+ 35.9560432434082,
42
+ 13.05494499206543,
43
+ 96.17582702636719,
44
+ 87.38461303710938,
45
+ 30.373626708984375
46
+ ]
47
+ },
48
+ "gripper": {
49
+ "min": [
50
+ 0.8867667317390442
51
+ ],
52
+ "max": [
53
+ 28.376535415649414
54
+ ],
55
+ "mean": [
56
+ 6.725670337677002
57
+ ],
58
+ "std": [
59
+ 5.633188724517822
60
+ ],
61
+ "q01": [
62
+ 0.9549795389175415
63
+ ],
64
+ "q99": [
65
+ 21.759891510009766
66
+ ]
67
+ }
68
+ },
69
+ "action": {
70
+ "single_arm": {
71
+ "min": [
72
+ -29.318681716918945,
73
+ -102.989013671875,
74
+ -29.098901748657227,
75
+ -4.175824165344238,
76
+ -31.340660095214844
77
+ ],
78
+ "max": [
79
+ 39.60439682006836,
80
+ 29.758241653442383,
81
+ 97.67032623291016,
82
+ 100.35164642333984,
83
+ 34.41758346557617
84
+ ],
85
+ "mean": [
86
+ 2.0507652759552,
87
+ -39.47334289550781,
88
+ 52.88246536254883,
89
+ 49.540916442871094,
90
+ -0.48444971442222595
91
+ ],
92
+ "std": [
93
+ 13.752706527709961,
94
+ 35.919918060302734,
95
+ 32.46714401245117,
96
+ 21.90213966369629,
97
+ 9.983773231506348
98
+ ],
99
+ "q01": [
100
+ -24.043956756591797,
101
+ -101.93406677246094,
102
+ -13.953406238555905,
103
+ 0.04395604506134987,
104
+ -21.758241653442383
105
+ ],
106
+ "q99": [
107
+ 36.01934097290033,
108
+ 12.79120922088623,
109
+ 97.23076629638672,
110
+ 87.34066009521484,
111
+ 30.373626708984375
112
+ ]
113
+ },
114
+ "gripper": {
115
+ "min": [
116
+ 0.0
117
+ ],
118
+ "max": [
119
+ 29.505582809448242
120
+ ],
121
+ "mean": [
122
+ 5.165055751800537
123
+ ],
124
+ "std": [
125
+ 6.453084945678711
126
+ ],
127
+ "q01": [
128
+ 0.6379585266113281
129
+ ],
130
+ "q99": [
131
+ 22.408292770385742
132
+ ]
133
+ }
134
+ },
135
+ "relative_action": {
136
+ "single_arm": {
137
+ "min": [
138
+ [
139
+ -14.461539268493652,
140
+ -31.20879364013672,
141
+ -30.417583465576172,
142
+ -23.164833068847656,
143
+ -13.274724960327148
144
+ ],
145
+ [
146
+ -14.98901081085205,
147
+ -35.78022003173828,
148
+ -34.4615364074707,
149
+ -23.164833068847656,
150
+ -15.648351669311523
151
+ ],
152
+ [
153
+ -15.164835929870605,
154
+ -40.087913513183594,
155
+ -38.417579650878906,
156
+ -24.21977996826172,
157
+ -18.461538314819336
158
+ ],
159
+ [
160
+ -15.69230842590332,
161
+ -44.39560317993164,
162
+ -42.109893798828125,
163
+ -27.20879364013672,
164
+ -21.098899841308594
165
+ ],
166
+ [
167
+ -17.9780216217041,
168
+ -48.52747344970703,
169
+ -45.53845977783203,
170
+ -30.02198028564453,
171
+ -22.85714340209961
172
+ ],
173
+ [
174
+ -19.560440063476562,
175
+ -53.89011001586914,
176
+ -48.43955993652344,
177
+ -32.395599365234375,
178
+ -25.05494499206543
179
+ ],
180
+ [
181
+ -20.96703338623047,
182
+ -59.9560432434082,
183
+ -50.989013671875,
184
+ -34.15384292602539,
185
+ -27.516483306884766
186
+ ],
187
+ [
188
+ -22.10988998413086,
189
+ -64.17582702636719,
190
+ -53.27472686767578,
191
+ -36.879119873046875,
192
+ -29.802196502685547
193
+ ],
194
+ [
195
+ -23.076923370361328,
196
+ -66.19779968261719,
197
+ -56.43955993652344,
198
+ -39.340660095214844,
199
+ -31.47252655029297
200
+ ],
201
+ [
202
+ -23.78022003173828,
203
+ -68.13187408447266,
204
+ -59.78022003173828,
205
+ -41.71428680419922,
206
+ -32.087913513183594
207
+ ],
208
+ [
209
+ -24.571428298950195,
210
+ -70.94506072998047,
211
+ -62.94505310058594,
212
+ -43.912086486816406,
213
+ -32.61538314819336
214
+ ],
215
+ [
216
+ -25.626375198364258,
217
+ -73.84616088867188,
218
+ -65.84615325927734,
219
+ -46.5494499206543,
220
+ -33.406593322753906
221
+ ],
222
+ [
223
+ -26.417583465576172,
224
+ -76.5714340209961,
225
+ -68.13186645507812,
226
+ -49.53845977783203,
227
+ -34.81318664550781
228
+ ],
229
+ [
230
+ -27.208789825439453,
231
+ -79.20878601074219,
232
+ -71.56044006347656,
233
+ -51.5604362487793,
234
+ -35.9560432434082
235
+ ],
236
+ [
237
+ -27.824174880981445,
238
+ -82.1098861694336,
239
+ -74.81318664550781,
240
+ -53.14285659790039,
241
+ -36.83516311645508
242
+ ],
243
+ [
244
+ -28.52747344970703,
245
+ -85.010986328125,
246
+ -77.97801971435547,
247
+ -54.989009857177734,
248
+ -37.89011001586914
249
+ ]
250
+ ],
251
+ "max": [
252
+ [
253
+ 9.89011001586914,
254
+ 23.824172973632812,
255
+ 36.57142639160156,
256
+ 27.736263275146484,
257
+ 13.714284896850586
258
+ ],
259
+ [
260
+ 12.967033386230469,
261
+ 27.868133544921875,
262
+ 42.4615364074707,
263
+ 30.10988998413086,
264
+ 14.153846740722656
265
+ ],
266
+ [
267
+ 15.95604419708252,
268
+ 32.43955993652344,
269
+ 47.912086486816406,
270
+ 31.692306518554688,
271
+ 17.406593322753906
272
+ ],
273
+ [
274
+ 18.85714340209961,
275
+ 36.57142639160156,
276
+ 53.274723052978516,
277
+ 34.32966995239258,
278
+ 20.483516693115234
279
+ ],
280
+ [
281
+ 21.406593322753906,
282
+ 39.384613037109375,
283
+ 58.5494499206543,
284
+ 37.58241653442383,
285
+ 23.560440063476562
286
+ ],
287
+ [
288
+ 23.60439682006836,
289
+ 42.02198028564453,
290
+ 62.5054931640625,
291
+ 39.9560432434082,
292
+ 26.549449920654297
293
+ ],
294
+ [
295
+ 25.538463592529297,
296
+ 45.890106201171875,
297
+ 65.84615325927734,
298
+ 42.32966995239258,
299
+ 29.538461685180664
300
+ ],
301
+ [
302
+ 27.38461685180664,
303
+ 49.75823974609375,
304
+ 67.86812591552734,
305
+ 43.912086486816406,
306
+ 32.52747344970703
307
+ ],
308
+ [
309
+ 28.703296661376953,
310
+ 53.45054626464844,
311
+ 71.47252655029297,
312
+ 45.31867980957031,
313
+ 35.42857360839844
314
+ ],
315
+ [
316
+ 30.02198028564453,
317
+ 56.9670295715332,
318
+ 75.25274658203125,
319
+ 46.4615364074707,
320
+ 37.5384635925293
321
+ ],
322
+ [
323
+ 31.60439682006836,
324
+ 60.131866455078125,
325
+ 79.38461303710938,
326
+ 47.07692337036133,
327
+ 39.29670333862305
328
+ ],
329
+ [
330
+ 32.92307662963867,
331
+ 63.03296661376953,
332
+ 83.16483306884766,
333
+ 47.9560432434082,
334
+ 40.263736724853516
335
+ ],
336
+ [
337
+ 33.978023529052734,
338
+ 65.84615325927734,
339
+ 87.29669952392578,
340
+ 49.978023529052734,
341
+ 41.14285659790039
342
+ ],
343
+ [
344
+ 34.76923370361328,
345
+ 68.4835205078125,
346
+ 91.07691955566406,
347
+ 52.17582321166992,
348
+ 41.75823974609375
349
+ ],
350
+ [
351
+ 36.087913513183594,
352
+ 71.03296661376953,
353
+ 94.4175796508789,
354
+ 54.81318283081055,
355
+ 41.75823974609375
356
+ ],
357
+ [
358
+ 37.05494689941406,
359
+ 73.4065933227539,
360
+ 97.75823974609375,
361
+ 57.27472686767578,
362
+ 41.75823974609375
363
+ ]
364
+ ],
365
+ "mean": [
366
+ [
367
+ 0.05252271890640259,
368
+ -0.44961366057395935,
369
+ -1.3810067176818848,
370
+ -0.5383102297782898,
371
+ 0.005542324390262365
372
+ ],
373
+ [
374
+ 0.05060017108917236,
375
+ -0.4308803975582123,
376
+ -1.4068167209625244,
377
+ -0.593940258026123,
378
+ 0.004673561081290245
379
+ ],
380
+ [
381
+ 0.04949820041656494,
382
+ -0.41805994510650635,
383
+ -1.4250603914260864,
384
+ -0.6486067175865173,
385
+ 0.003708319505676627
386
+ ],
387
+ [
388
+ 0.04928917437791824,
389
+ -0.4097505807876587,
390
+ -1.4366508722305298,
391
+ -0.7017847895622253,
392
+ 0.002847608644515276
393
+ ],
394
+ [
395
+ 0.04973168298602104,
396
+ -0.4044969081878662,
397
+ -1.442812204360962,
398
+ -0.7526053190231323,
399
+ 0.0021236210595816374
400
+ ],
401
+ [
402
+ 0.05041532218456268,
403
+ -0.4011270999908447,
404
+ -1.4456192255020142,
405
+ -0.7994228005409241,
406
+ 0.001351392944343388
407
+ ],
408
+ [
409
+ 0.05106696859002113,
410
+ -0.3986898362636566,
411
+ -1.4464950561523438,
412
+ -0.8404057025909424,
413
+ 0.0006355035002343357
414
+ ],
415
+ [
416
+ 0.0515415295958519,
417
+ -0.3965660333633423,
418
+ -1.4468375444412231,
419
+ -0.8742049932479858,
420
+ -8.84718174347654e-05
421
+ ],
422
+ [
423
+ 0.05195971578359604,
424
+ -0.39476478099823,
425
+ -1.4468951225280762,
426
+ -0.8984988927841187,
427
+ -0.0007319324067793787
428
+ ],
429
+ [
430
+ 0.052176933735609055,
431
+ -0.3930343687534332,
432
+ -1.4468693733215332,
433
+ -0.9146161675453186,
434
+ -0.0013030839618295431
435
+ ],
436
+ [
437
+ 0.05216075852513313,
438
+ -0.3915066123008728,
439
+ -1.4468547105789185,
440
+ -0.9235863089561462,
441
+ -0.0018822313286364079
442
+ ],
443
+ [
444
+ 0.052007805556058884,
445
+ -0.39036324620246887,
446
+ -1.4468398094177246,
447
+ -0.9282782077789307,
448
+ -0.002397017553448677
449
+ ],
450
+ [
451
+ 0.05167792737483978,
452
+ -0.3895268738269806,
453
+ -1.4468237161636353,
454
+ -0.9304037094116211,
455
+ -0.0029279994778335094
456
+ ],
457
+ [
458
+ 0.05130806565284729,
459
+ -0.3888275623321533,
460
+ -1.4468061923980713,
461
+ -0.9320605993270874,
462
+ -0.003442761255428195
463
+ ],
464
+ [
465
+ 0.05096229910850525,
466
+ -0.38813528418540955,
467
+ -1.446787714958191,
468
+ -0.9335735440254211,
469
+ -0.003949629608541727
470
+ ],
471
+ [
472
+ 0.05056795850396156,
473
+ -0.38745182752609253,
474
+ -1.4467723369598389,
475
+ -0.93507981300354,
476
+ -0.004440249875187874
477
+ ]
478
+ ],
479
+ "std": [
480
+ [
481
+ 1.4878755807876587,
482
+ 5.839897632598877,
483
+ 5.374911308288574,
484
+ 3.176649332046509,
485
+ 1.5652546882629395
486
+ ],
487
+ [
488
+ 1.9109783172607422,
489
+ 7.644970417022705,
490
+ 6.917716026306152,
491
+ 4.120389461517334,
492
+ 1.981215238571167
493
+ ],
494
+ [
495
+ 2.321254253387451,
496
+ 9.430123329162598,
497
+ 8.453091621398926,
498
+ 5.043785095214844,
499
+ 2.3793013095855713
500
+ ],
501
+ [
502
+ 2.716085910797119,
503
+ 11.187356948852539,
504
+ 9.970100402832031,
505
+ 5.940429210662842,
506
+ 2.756856918334961
507
+ ],
508
+ [
509
+ 3.093921422958374,
510
+ 12.91049575805664,
511
+ 11.461906433105469,
512
+ 6.8076252937316895,
513
+ 3.1135854721069336
514
+ ],
515
+ [
516
+ 3.4536941051483154,
517
+ 14.595410346984863,
518
+ 12.921976089477539,
519
+ 7.646265983581543,
520
+ 3.4501616954803467
521
+ ],
522
+ [
523
+ 3.7960422039031982,
524
+ 16.23885726928711,
525
+ 14.347005844116211,
526
+ 8.458425521850586,
527
+ 3.767953395843506
528
+ ],
529
+ [
530
+ 4.122044086456299,
531
+ 17.838661193847656,
532
+ 15.734045028686523,
533
+ 9.246739387512207,
534
+ 4.068443298339844
535
+ ],
536
+ [
537
+ 4.432971954345703,
538
+ 19.39406967163086,
539
+ 17.082509994506836,
540
+ 10.015328407287598,
541
+ 4.352938652038574
542
+ ],
543
+ [
544
+ 4.72984504699707,
545
+ 20.904521942138672,
546
+ 18.392000198364258,
547
+ 10.765315055847168,
548
+ 4.622180938720703
549
+ ],
550
+ [
551
+ 5.013516426086426,
552
+ 22.37005615234375,
553
+ 19.66269302368164,
554
+ 11.497218132019043,
555
+ 4.8769989013671875
556
+ ],
557
+ [
558
+ 5.284946918487549,
559
+ 23.79131317138672,
560
+ 20.894948959350586,
561
+ 12.208915710449219,
562
+ 5.117739677429199
563
+ ],
564
+ [
565
+ 5.544953346252441,
566
+ 25.16900062561035,
567
+ 22.08959197998047,
568
+ 12.899317741394043,
569
+ 5.345024108886719
570
+ ],
571
+ [
572
+ 5.794323444366455,
573
+ 26.503883361816406,
574
+ 23.24732780456543,
575
+ 13.566927909851074,
576
+ 5.559260845184326
577
+ ],
578
+ [
579
+ 6.033751964569092,
580
+ 27.797048568725586,
581
+ 24.36910057067871,
582
+ 14.212467193603516,
583
+ 5.760995864868164
584
+ ],
585
+ [
586
+ 6.2639055252075195,
587
+ 29.049880981445312,
588
+ 25.455867767333984,
589
+ 14.83670711517334,
590
+ 5.951050758361816
591
+ ]
592
+ ],
593
+ "q01": [
594
+ [
595
+ -4.4395599365234375,
596
+ -15.64834976196289,
597
+ -14.241758346557617,
598
+ -10.392964935302734,
599
+ -5.362637042999268
600
+ ],
601
+ [
602
+ -5.846153736114502,
603
+ -20.370985717773436,
604
+ -17.934066772460938,
605
+ -13.381978607177734,
606
+ -6.857142791748047
607
+ ],
608
+ [
609
+ -7.076923370361328,
610
+ -24.96703338623047,
611
+ -21.538461685180664,
612
+ -16.483516693115234,
613
+ -8.239120788574219
614
+ ],
615
+ [
616
+ -8.458901443481444,
617
+ -29.51384506225586,
618
+ -25.23076629638672,
619
+ -19.359998321533205,
620
+ -9.318680763244629
621
+ ],
622
+ [
623
+ -9.626373291015625,
624
+ -33.934065704345706,
625
+ -28.659341278076173,
626
+ -21.934066772460938,
627
+ -10.349011192321777
628
+ ],
629
+ [
630
+ -10.681318969726563,
631
+ -38.24176025390625,
632
+ -31.912086486816406,
633
+ -24.219778900146483,
634
+ -11.491868057250976
635
+ ],
636
+ [
637
+ -12.151208915710448,
638
+ -42.54945373535156,
639
+ -35.05230651855469,
640
+ -26.24176025390625,
641
+ -12.546813049316405
642
+ ],
643
+ [
644
+ -13.406594009399415,
645
+ -46.80791015625,
646
+ -38.15384948730469,
647
+ -28.18989044189453,
648
+ -13.538462371826173
649
+ ],
650
+ [
651
+ -14.197803230285645,
652
+ -50.637359619140625,
653
+ -40.70329559326172,
654
+ -30.26109848022461,
655
+ -14.217143096923827
656
+ ],
657
+ [
658
+ -15.316043891906737,
659
+ -54.5054931640625,
660
+ -43.340660095214844,
661
+ -32.107252807617186,
662
+ -15.09626350402832
663
+ ],
664
+ [
665
+ -16.19516471862793,
666
+ -58.17318603515625,
667
+ -45.77758346557617,
668
+ -33.7775845336914,
669
+ -15.799560585021972
670
+ ],
671
+ [
672
+ -17.01098960876465,
673
+ -61.53846633911133,
674
+ -47.99999893188477,
675
+ -35.359999389648436,
676
+ -16.52747344970703
677
+ ],
678
+ [
679
+ -17.86549476623535,
680
+ -64.96703338623047,
681
+ -49.73362609863281,
682
+ -36.829890441894534,
683
+ -17.118240814208985
684
+ ],
685
+ [
686
+ -18.74461654663086,
687
+ -67.86813354492188,
688
+ -51.78022003173828,
689
+ -38.021975402832034,
690
+ -17.670330047607422
691
+ ],
692
+ [
693
+ -19.4479118347168,
694
+ -70.8325259399414,
695
+ -53.689669342041014,
696
+ -39.115603637695315,
697
+ -18.0219783782959
698
+ ],
699
+ [
700
+ -19.975384216308594,
701
+ -73.4698876953125,
702
+ -55.20878875732422,
703
+ -40.395605926513674,
704
+ -18.197802963256837
705
+ ]
706
+ ],
707
+ "q99": [
708
+ [
709
+ 4.9424173164367105,
710
+ 12.395605087280273,
711
+ 14.832527618408145,
712
+ 9.274726333618164,
713
+ 6.065934181213379
714
+ ],
715
+ [
716
+ 6.373626098632813,
717
+ 16.439558868408202,
718
+ 19.692310333251953,
719
+ 12.414945220947208,
720
+ 7.824175567626953
721
+ ],
722
+ [
723
+ 7.6043965530395505,
724
+ 20.307693481445312,
725
+ 24.76659164428705,
726
+ 15.316043472289982,
727
+ 9.318681449890137
728
+ ],
729
+ [
730
+ 9.010988235473633,
731
+ 24.0,
732
+ 29.689670715331975,
733
+ 18.065935974121093,
734
+ 10.876483001708927
735
+ ],
736
+ [
737
+ 10.329669952392578,
738
+ 27.60439682006836,
739
+ 34.524837951660096,
740
+ 20.61538314819336,
741
+ 11.868132591247559
742
+ ],
743
+ [
744
+ 11.359999694824161,
745
+ 31.208793106079103,
746
+ 39.032969360351565,
747
+ 23.11560638427723,
748
+ 13.074285278320255
749
+ ],
750
+ [
751
+ 12.439559936523438,
752
+ 34.72527313232422,
753
+ 43.81890029907215,
754
+ 25.601759414672795,
755
+ 13.802198143005372
756
+ ],
757
+ [
758
+ 13.46988967895502,
759
+ 37.80219924926758,
760
+ 47.79956100463861,
761
+ 28.351648330688477,
762
+ 14.593406677246094
763
+ ],
764
+ [
765
+ 14.261098899841251,
766
+ 41.29406616210932,
767
+ 51.73099060058582,
768
+ 30.412306442260626,
769
+ 15.184175949096621
770
+ ],
771
+ [
772
+ 15.25274658203125,
773
+ 44.395605926513674,
774
+ 55.71164855957026,
775
+ 32.722637634277284,
776
+ 15.736263275146484
777
+ ],
778
+ [
779
+ 16.04395622253418,
780
+ 47.62373504638666,
781
+ 59.755604248046815,
782
+ 34.56879196166987,
783
+ 16.52747344970703
784
+ ],
785
+ [
786
+ 16.810548400878847,
787
+ 50.261098480224554,
788
+ 63.71164581298822,
789
+ 36.17582321166992,
790
+ 17.445274429321174
791
+ ],
792
+ [
793
+ 17.865494766235294,
794
+ 52.98637161254877,
795
+ 67.29142852783191,
796
+ 37.73362503051752,
797
+ 18.197802963256837
798
+ ],
799
+ [
800
+ 18.769229888916016,
801
+ 55.56043899536133,
802
+ 70.41758514404297,
803
+ 39.31604431152338,
804
+ 18.612747650146428
805
+ ],
806
+ [
807
+ 19.736263275146484,
808
+ 58.373626708984375,
809
+ 73.38197204589838,
810
+ 40.1072517395019,
811
+ 18.876483001708927
812
+ ],
813
+ [
814
+ 20.703296127319337,
815
+ 60.48351943969727,
816
+ 75.86813354492188,
817
+ 41.689668273925726,
818
+ 19.25274658203125
819
+ ]
820
+ ]
821
+ }
822
+ }
823
+ }
824
+ }
experiment_cfg/final_model_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "Gr00tN1d7",
3
+ "model_dtype": "bfloat16",
4
+ "model_name": "nvidia/Cosmos-Reason2-2B",
5
+ "backbone_model_type": "qwen",
6
+ "model_revision": null,
7
+ "tune_top_llm_layers": 0,
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
+ "backbone_trainable_params_fp32": true,
16
+ "letter_box_transform": false,
17
+ "extra_augmentation_config": null,
18
+ "apply_sincos_state_encoding": false,
19
+ "use_percentiles": true,
20
+ "use_relative_action": false,
21
+ "max_state_dim": 132,
22
+ "max_action_dim": 132,
23
+ "action_horizon": 40,
24
+ "hidden_size": 1024,
25
+ "input_embedding_dim": 1536,
26
+ "state_history_length": 1,
27
+ "add_pos_embed": true,
28
+ "attn_dropout": 0.2,
29
+ "use_vlln": true,
30
+ "max_seq_len": 1024,
31
+ "use_alternate_vl_dit": true,
32
+ "attend_text_every_n_blocks": 2,
33
+ "diffusion_model_cfg": {
34
+ "attention_head_dim": 48,
35
+ "dropout": 0.2,
36
+ "final_dropout": true,
37
+ "interleave_self_attention": true,
38
+ "norm_type": "ada_norm",
39
+ "num_attention_heads": 32,
40
+ "num_layers": 32,
41
+ "output_dim": 1024,
42
+ "positional_embeddings": null
43
+ },
44
+ "num_inference_timesteps": 4,
45
+ "noise_beta_alpha": 1.5,
46
+ "noise_beta_beta": 1.0,
47
+ "noise_s": 0.999,
48
+ "num_timestep_buckets": 1000,
49
+ "tune_projector": true,
50
+ "tune_diffusion_model": true,
51
+ "tune_vlln": true,
52
+ "state_dropout_prob": 0.2,
53
+ "exclude_state": false,
54
+ "use_mean_std": false,
55
+ "max_num_embodiments": 32
56
+ }
experiment_cfg/final_processor_config.json ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40903368fc70fdbaf66926b298c0460a48cd4a53d316bd6ba64c3b65643741bb
3
+ size 4990519232
model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07fe081ef81c3a1f72b40cf6c87ad4ebd90d6284758d2b8ba4e5c796444aaf07
3
+ size 1919980184
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
processor_config.json ADDED
@@ -0,0 +1,1124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "Gr00tN1d7Processor",
3
+ "processor_kwargs": {
4
+ "modality_configs": {
5
+ "real_g1_relative_eef_relative_joints": {
6
+ "video": {
7
+ "delta_indices": [
8
+ -20,
9
+ 0
10
+ ],
11
+ "modality_keys": [
12
+ "ego_view"
13
+ ],
14
+ "sin_cos_embedding_keys": null,
15
+ "mean_std_embedding_keys": null,
16
+ "action_configs": null
17
+ },
18
+ "state": {
19
+ "delta_indices": [
20
+ 0
21
+ ],
22
+ "modality_keys": [
23
+ "left_wrist_eef_9d",
24
+ "right_wrist_eef_9d",
25
+ "left_hand",
26
+ "right_hand",
27
+ "left_arm",
28
+ "right_arm",
29
+ "waist"
30
+ ],
31
+ "sin_cos_embedding_keys": null,
32
+ "mean_std_embedding_keys": null,
33
+ "action_configs": null
34
+ },
35
+ "action": {
36
+ "delta_indices": [
37
+ 0,
38
+ 1,
39
+ 2,
40
+ 3,
41
+ 4,
42
+ 5,
43
+ 6,
44
+ 7,
45
+ 8,
46
+ 9,
47
+ 10,
48
+ 11,
49
+ 12,
50
+ 13,
51
+ 14,
52
+ 15,
53
+ 16,
54
+ 17,
55
+ 18,
56
+ 19,
57
+ 20,
58
+ 21,
59
+ 22,
60
+ 23,
61
+ 24,
62
+ 25,
63
+ 26,
64
+ 27,
65
+ 28,
66
+ 29,
67
+ 30,
68
+ 31,
69
+ 32,
70
+ 33,
71
+ 34,
72
+ 35,
73
+ 36,
74
+ 37,
75
+ 38,
76
+ 39
77
+ ],
78
+ "modality_keys": [
79
+ "left_wrist_eef_9d",
80
+ "right_wrist_eef_9d",
81
+ "left_hand",
82
+ "right_hand",
83
+ "left_arm",
84
+ "right_arm",
85
+ "waist",
86
+ "base_height_command",
87
+ "navigate_command"
88
+ ],
89
+ "sin_cos_embedding_keys": null,
90
+ "mean_std_embedding_keys": null,
91
+ "action_configs": [
92
+ {
93
+ "rep": "RELATIVE",
94
+ "type": "EEF",
95
+ "format": "XYZ_ROT6D",
96
+ "state_key": "left_wrist_eef_9d"
97
+ },
98
+ {
99
+ "rep": "RELATIVE",
100
+ "type": "EEF",
101
+ "format": "XYZ_ROT6D",
102
+ "state_key": "right_wrist_eef_9d"
103
+ },
104
+ {
105
+ "rep": "ABSOLUTE",
106
+ "type": "NON_EEF",
107
+ "format": "DEFAULT",
108
+ "state_key": "left_hand"
109
+ },
110
+ {
111
+ "rep": "ABSOLUTE",
112
+ "type": "NON_EEF",
113
+ "format": "DEFAULT",
114
+ "state_key": "right_hand"
115
+ },
116
+ {
117
+ "rep": "RELATIVE",
118
+ "type": "NON_EEF",
119
+ "format": "DEFAULT",
120
+ "state_key": "left_arm"
121
+ },
122
+ {
123
+ "rep": "RELATIVE",
124
+ "type": "NON_EEF",
125
+ "format": "DEFAULT",
126
+ "state_key": "right_arm"
127
+ },
128
+ {
129
+ "rep": "ABSOLUTE",
130
+ "type": "NON_EEF",
131
+ "format": "DEFAULT",
132
+ "state_key": "waist"
133
+ },
134
+ {
135
+ "rep": "ABSOLUTE",
136
+ "type": "NON_EEF",
137
+ "format": "DEFAULT",
138
+ "state_key": "base_height_command"
139
+ },
140
+ {
141
+ "rep": "ABSOLUTE",
142
+ "type": "NON_EEF",
143
+ "format": "DEFAULT",
144
+ "state_key": "navigate_command"
145
+ }
146
+ ]
147
+ },
148
+ "language": {
149
+ "delta_indices": [
150
+ 0
151
+ ],
152
+ "modality_keys": [
153
+ "annotation.human.task_description"
154
+ ],
155
+ "sin_cos_embedding_keys": null,
156
+ "mean_std_embedding_keys": null,
157
+ "action_configs": null
158
+ }
159
+ },
160
+ "real_r1_pro_sharpa_relative_eef_mecka": {
161
+ "video": {
162
+ "delta_indices": [
163
+ -30,
164
+ 0
165
+ ],
166
+ "modality_keys": [
167
+ "ego_view_cropratio_res320x240_freq30"
168
+ ],
169
+ "sin_cos_embedding_keys": null,
170
+ "mean_std_embedding_keys": null,
171
+ "action_configs": null
172
+ },
173
+ "state": {
174
+ "delta_indices": [
175
+ 0
176
+ ],
177
+ "modality_keys": [
178
+ "left_wrist_eef",
179
+ "right_wrist_eef",
180
+ "left_hand_joints",
181
+ "right_hand_joints"
182
+ ],
183
+ "sin_cos_embedding_keys": null,
184
+ "mean_std_embedding_keys": null,
185
+ "action_configs": null
186
+ },
187
+ "action": {
188
+ "delta_indices": [
189
+ 0,
190
+ 1,
191
+ 2,
192
+ 3,
193
+ 4,
194
+ 5,
195
+ 6,
196
+ 7,
197
+ 8,
198
+ 9,
199
+ 10,
200
+ 11,
201
+ 12,
202
+ 13,
203
+ 14,
204
+ 15,
205
+ 16,
206
+ 17,
207
+ 18,
208
+ 19,
209
+ 20,
210
+ 21,
211
+ 22,
212
+ 23,
213
+ 24,
214
+ 25,
215
+ 26,
216
+ 27,
217
+ 28,
218
+ 29,
219
+ 30,
220
+ 31,
221
+ 32,
222
+ 33,
223
+ 34,
224
+ 35,
225
+ 36,
226
+ 37,
227
+ 38,
228
+ 39
229
+ ],
230
+ "modality_keys": [
231
+ "left_wrist_eef",
232
+ "right_wrist_eef",
233
+ "left_hand_joints",
234
+ "right_hand_joints"
235
+ ],
236
+ "sin_cos_embedding_keys": null,
237
+ "mean_std_embedding_keys": null,
238
+ "action_configs": [
239
+ {
240
+ "rep": "RELATIVE",
241
+ "type": "EEF",
242
+ "format": "XYZ_ROT6D",
243
+ "state_key": "left_wrist_eef"
244
+ },
245
+ {
246
+ "rep": "RELATIVE",
247
+ "type": "EEF",
248
+ "format": "XYZ_ROT6D",
249
+ "state_key": "right_wrist_eef"
250
+ },
251
+ {
252
+ "rep": "ABSOLUTE",
253
+ "type": "NON_EEF",
254
+ "format": "DEFAULT",
255
+ "state_key": "left_hand_joints"
256
+ },
257
+ {
258
+ "rep": "ABSOLUTE",
259
+ "type": "NON_EEF",
260
+ "format": "DEFAULT",
261
+ "state_key": "right_hand_joints"
262
+ }
263
+ ]
264
+ },
265
+ "language": {
266
+ "delta_indices": [
267
+ 0
268
+ ],
269
+ "modality_keys": [
270
+ "annotation.human.coarse_action"
271
+ ],
272
+ "sin_cos_embedding_keys": null,
273
+ "mean_std_embedding_keys": null,
274
+ "action_configs": null
275
+ }
276
+ },
277
+ "real_r1_pro_sharpa_relative_eef_human": {
278
+ "video": {
279
+ "delta_indices": [
280
+ -20,
281
+ 0
282
+ ],
283
+ "modality_keys": [
284
+ "ego_view_res320x240_freq20",
285
+ "left_wrist_view_res320x240_freq20",
286
+ "right_wrist_view_res320x240_freq20"
287
+ ],
288
+ "sin_cos_embedding_keys": null,
289
+ "mean_std_embedding_keys": null,
290
+ "action_configs": null
291
+ },
292
+ "state": {
293
+ "delta_indices": [
294
+ 0
295
+ ],
296
+ "modality_keys": [
297
+ "left_wrist_eef",
298
+ "right_wrist_eef",
299
+ "left_hand_joints",
300
+ "right_hand_joints"
301
+ ],
302
+ "sin_cos_embedding_keys": null,
303
+ "mean_std_embedding_keys": null,
304
+ "action_configs": null
305
+ },
306
+ "action": {
307
+ "delta_indices": [
308
+ 0,
309
+ 1,
310
+ 2,
311
+ 3,
312
+ 4,
313
+ 5,
314
+ 6,
315
+ 7,
316
+ 8,
317
+ 9,
318
+ 10,
319
+ 11,
320
+ 12,
321
+ 13,
322
+ 14,
323
+ 15,
324
+ 16,
325
+ 17,
326
+ 18,
327
+ 19,
328
+ 20,
329
+ 21,
330
+ 22,
331
+ 23,
332
+ 24,
333
+ 25,
334
+ 26,
335
+ 27,
336
+ 28,
337
+ 29,
338
+ 30,
339
+ 31,
340
+ 32,
341
+ 33,
342
+ 34,
343
+ 35,
344
+ 36,
345
+ 37,
346
+ 38,
347
+ 39
348
+ ],
349
+ "modality_keys": [
350
+ "left_wrist_eef",
351
+ "right_wrist_eef",
352
+ "left_hand_joints",
353
+ "right_hand_joints"
354
+ ],
355
+ "sin_cos_embedding_keys": null,
356
+ "mean_std_embedding_keys": null,
357
+ "action_configs": [
358
+ {
359
+ "rep": "RELATIVE",
360
+ "type": "EEF",
361
+ "format": "XYZ_ROT6D",
362
+ "state_key": "left_wrist_eef"
363
+ },
364
+ {
365
+ "rep": "RELATIVE",
366
+ "type": "EEF",
367
+ "format": "XYZ_ROT6D",
368
+ "state_key": "right_wrist_eef"
369
+ },
370
+ {
371
+ "rep": "ABSOLUTE",
372
+ "type": "NON_EEF",
373
+ "format": "DEFAULT",
374
+ "state_key": "left_hand_joints"
375
+ },
376
+ {
377
+ "rep": "ABSOLUTE",
378
+ "type": "NON_EEF",
379
+ "format": "DEFAULT",
380
+ "state_key": "right_hand_joints"
381
+ }
382
+ ]
383
+ },
384
+ "language": {
385
+ "delta_indices": [
386
+ 0
387
+ ],
388
+ "modality_keys": [
389
+ "annotation.human.coarse_action"
390
+ ],
391
+ "sin_cos_embedding_keys": null,
392
+ "mean_std_embedding_keys": null,
393
+ "action_configs": null
394
+ }
395
+ },
396
+ "real_r1_pro_sharpa_relative_eef": {
397
+ "video": {
398
+ "delta_indices": [
399
+ -20,
400
+ 0
401
+ ],
402
+ "modality_keys": [
403
+ "ego_view_res320x240_freq20",
404
+ "left_wrist_view_res320x240_freq20",
405
+ "right_wrist_view_res320x240_freq20"
406
+ ],
407
+ "sin_cos_embedding_keys": null,
408
+ "mean_std_embedding_keys": null,
409
+ "action_configs": null
410
+ },
411
+ "state": {
412
+ "delta_indices": [
413
+ 0
414
+ ],
415
+ "modality_keys": [
416
+ "left_wrist_eef",
417
+ "right_wrist_eef",
418
+ "left_hand_joints",
419
+ "right_hand_joints"
420
+ ],
421
+ "sin_cos_embedding_keys": null,
422
+ "mean_std_embedding_keys": null,
423
+ "action_configs": null
424
+ },
425
+ "action": {
426
+ "delta_indices": [
427
+ 0,
428
+ 1,
429
+ 2,
430
+ 3,
431
+ 4,
432
+ 5,
433
+ 6,
434
+ 7,
435
+ 8,
436
+ 9,
437
+ 10,
438
+ 11,
439
+ 12,
440
+ 13,
441
+ 14,
442
+ 15,
443
+ 16,
444
+ 17,
445
+ 18,
446
+ 19,
447
+ 20,
448
+ 21,
449
+ 22,
450
+ 23,
451
+ 24,
452
+ 25,
453
+ 26,
454
+ 27,
455
+ 28,
456
+ 29,
457
+ 30,
458
+ 31,
459
+ 32,
460
+ 33,
461
+ 34,
462
+ 35,
463
+ 36,
464
+ 37,
465
+ 38,
466
+ 39
467
+ ],
468
+ "modality_keys": [
469
+ "left_wrist_eef",
470
+ "right_wrist_eef",
471
+ "left_hand_joints",
472
+ "right_hand_joints"
473
+ ],
474
+ "sin_cos_embedding_keys": null,
475
+ "mean_std_embedding_keys": null,
476
+ "action_configs": [
477
+ {
478
+ "rep": "RELATIVE",
479
+ "type": "EEF",
480
+ "format": "XYZ_ROT6D",
481
+ "state_key": "left_wrist_eef"
482
+ },
483
+ {
484
+ "rep": "RELATIVE",
485
+ "type": "EEF",
486
+ "format": "XYZ_ROT6D",
487
+ "state_key": "right_wrist_eef"
488
+ },
489
+ {
490
+ "rep": "ABSOLUTE",
491
+ "type": "NON_EEF",
492
+ "format": "DEFAULT",
493
+ "state_key": "left_hand_joints"
494
+ },
495
+ {
496
+ "rep": "ABSOLUTE",
497
+ "type": "NON_EEF",
498
+ "format": "DEFAULT",
499
+ "state_key": "right_hand_joints"
500
+ }
501
+ ]
502
+ },
503
+ "language": {
504
+ "delta_indices": [
505
+ 0
506
+ ],
507
+ "modality_keys": [
508
+ "annotation.human.coarse_action"
509
+ ],
510
+ "sin_cos_embedding_keys": null,
511
+ "mean_std_embedding_keys": null,
512
+ "action_configs": null
513
+ }
514
+ },
515
+ "xdof_relative_eef_relative_joint": {
516
+ "video": {
517
+ "delta_indices": [
518
+ -30,
519
+ 0
520
+ ],
521
+ "modality_keys": [
522
+ "top_camera-images-rgb_320_240",
523
+ "left_camera-images-rgb_320_240",
524
+ "right_camera-images-rgb_320_240"
525
+ ],
526
+ "sin_cos_embedding_keys": null,
527
+ "mean_std_embedding_keys": null,
528
+ "action_configs": null
529
+ },
530
+ "state": {
531
+ "delta_indices": [
532
+ 0
533
+ ],
534
+ "modality_keys": [
535
+ "left_wrist_eef",
536
+ "right_wrist_eef",
537
+ "left_gripper_pos",
538
+ "right_gripper_pos",
539
+ "left_joint_pos",
540
+ "right_joint_pos"
541
+ ],
542
+ "sin_cos_embedding_keys": null,
543
+ "mean_std_embedding_keys": null,
544
+ "action_configs": null
545
+ },
546
+ "action": {
547
+ "delta_indices": [
548
+ 0,
549
+ 1,
550
+ 2,
551
+ 3,
552
+ 4,
553
+ 5,
554
+ 6,
555
+ 7,
556
+ 8,
557
+ 9,
558
+ 10,
559
+ 11,
560
+ 12,
561
+ 13,
562
+ 14,
563
+ 15,
564
+ 16,
565
+ 17,
566
+ 18,
567
+ 19,
568
+ 20,
569
+ 21,
570
+ 22,
571
+ 23,
572
+ 24,
573
+ 25,
574
+ 26,
575
+ 27,
576
+ 28,
577
+ 29,
578
+ 30,
579
+ 31,
580
+ 32,
581
+ 33,
582
+ 34,
583
+ 35,
584
+ 36,
585
+ 37,
586
+ 38,
587
+ 39
588
+ ],
589
+ "modality_keys": [
590
+ "left_wrist_eef",
591
+ "right_wrist_eef",
592
+ "left_gripper_pos",
593
+ "right_gripper_pos",
594
+ "left_joint_pos",
595
+ "right_joint_pos"
596
+ ],
597
+ "sin_cos_embedding_keys": null,
598
+ "mean_std_embedding_keys": null,
599
+ "action_configs": [
600
+ {
601
+ "rep": "RELATIVE",
602
+ "type": "EEF",
603
+ "format": "XYZ_ROT6D",
604
+ "state_key": "left_wrist_eef"
605
+ },
606
+ {
607
+ "rep": "RELATIVE",
608
+ "type": "EEF",
609
+ "format": "XYZ_ROT6D",
610
+ "state_key": "right_wrist_eef"
611
+ },
612
+ {
613
+ "rep": "ABSOLUTE",
614
+ "type": "NON_EEF",
615
+ "format": "DEFAULT",
616
+ "state_key": "left_gripper_pos"
617
+ },
618
+ {
619
+ "rep": "ABSOLUTE",
620
+ "type": "NON_EEF",
621
+ "format": "DEFAULT",
622
+ "state_key": "right_gripper_pos"
623
+ },
624
+ {
625
+ "rep": "RELATIVE",
626
+ "type": "NON_EEF",
627
+ "format": "DEFAULT",
628
+ "state_key": "left_joint_pos"
629
+ },
630
+ {
631
+ "rep": "RELATIVE",
632
+ "type": "NON_EEF",
633
+ "format": "DEFAULT",
634
+ "state_key": "right_joint_pos"
635
+ }
636
+ ]
637
+ },
638
+ "language": {
639
+ "delta_indices": [
640
+ 0
641
+ ],
642
+ "modality_keys": [
643
+ "annotation.task"
644
+ ],
645
+ "sin_cos_embedding_keys": null,
646
+ "mean_std_embedding_keys": null,
647
+ "action_configs": null
648
+ }
649
+ },
650
+ "real_r1_pro_sharpa_relative_eef_maxinsights": {
651
+ "video": {
652
+ "delta_indices": [
653
+ -30,
654
+ 0
655
+ ],
656
+ "modality_keys": [
657
+ "ego_view_cropratio_res320x240_freq30"
658
+ ],
659
+ "sin_cos_embedding_keys": null,
660
+ "mean_std_embedding_keys": null,
661
+ "action_configs": null
662
+ },
663
+ "state": {
664
+ "delta_indices": [
665
+ 0
666
+ ],
667
+ "modality_keys": [
668
+ "left_wrist_eef",
669
+ "right_wrist_eef",
670
+ "left_hand_joints",
671
+ "right_hand_joints"
672
+ ],
673
+ "sin_cos_embedding_keys": null,
674
+ "mean_std_embedding_keys": null,
675
+ "action_configs": null
676
+ },
677
+ "action": {
678
+ "delta_indices": [
679
+ 0,
680
+ 1,
681
+ 2,
682
+ 3,
683
+ 4,
684
+ 5,
685
+ 6,
686
+ 7,
687
+ 8,
688
+ 9,
689
+ 10,
690
+ 11,
691
+ 12,
692
+ 13,
693
+ 14,
694
+ 15,
695
+ 16,
696
+ 17,
697
+ 18,
698
+ 19,
699
+ 20,
700
+ 21,
701
+ 22,
702
+ 23,
703
+ 24,
704
+ 25,
705
+ 26,
706
+ 27,
707
+ 28,
708
+ 29,
709
+ 30,
710
+ 31,
711
+ 32,
712
+ 33,
713
+ 34,
714
+ 35,
715
+ 36,
716
+ 37,
717
+ 38,
718
+ 39
719
+ ],
720
+ "modality_keys": [
721
+ "left_wrist_eef",
722
+ "right_wrist_eef",
723
+ "left_hand_joints",
724
+ "right_hand_joints"
725
+ ],
726
+ "sin_cos_embedding_keys": null,
727
+ "mean_std_embedding_keys": null,
728
+ "action_configs": [
729
+ {
730
+ "rep": "RELATIVE",
731
+ "type": "EEF",
732
+ "format": "XYZ_ROT6D",
733
+ "state_key": "left_wrist_eef"
734
+ },
735
+ {
736
+ "rep": "RELATIVE",
737
+ "type": "EEF",
738
+ "format": "XYZ_ROT6D",
739
+ "state_key": "right_wrist_eef"
740
+ },
741
+ {
742
+ "rep": "ABSOLUTE",
743
+ "type": "NON_EEF",
744
+ "format": "DEFAULT",
745
+ "state_key": "left_hand_joints"
746
+ },
747
+ {
748
+ "rep": "ABSOLUTE",
749
+ "type": "NON_EEF",
750
+ "format": "DEFAULT",
751
+ "state_key": "right_hand_joints"
752
+ }
753
+ ]
754
+ },
755
+ "language": {
756
+ "delta_indices": [
757
+ 0
758
+ ],
759
+ "modality_keys": [
760
+ "annotation.human.coarse_action"
761
+ ],
762
+ "sin_cos_embedding_keys": null,
763
+ "mean_std_embedding_keys": null,
764
+ "action_configs": null
765
+ }
766
+ },
767
+ "xdof_relative_eef_relative_joint_subtask": {
768
+ "video": {
769
+ "delta_indices": [
770
+ -30,
771
+ 0
772
+ ],
773
+ "modality_keys": [
774
+ "top_camera-images-rgb_320_240",
775
+ "left_camera-images-rgb_320_240",
776
+ "right_camera-images-rgb_320_240"
777
+ ],
778
+ "sin_cos_embedding_keys": null,
779
+ "mean_std_embedding_keys": null,
780
+ "action_configs": null
781
+ },
782
+ "state": {
783
+ "delta_indices": [
784
+ 0
785
+ ],
786
+ "modality_keys": [
787
+ "left_wrist_eef",
788
+ "right_wrist_eef",
789
+ "left_gripper_pos",
790
+ "right_gripper_pos",
791
+ "left_joint_pos",
792
+ "right_joint_pos"
793
+ ],
794
+ "sin_cos_embedding_keys": null,
795
+ "mean_std_embedding_keys": null,
796
+ "action_configs": null
797
+ },
798
+ "action": {
799
+ "delta_indices": [
800
+ 0,
801
+ 1,
802
+ 2,
803
+ 3,
804
+ 4,
805
+ 5,
806
+ 6,
807
+ 7,
808
+ 8,
809
+ 9,
810
+ 10,
811
+ 11,
812
+ 12,
813
+ 13,
814
+ 14,
815
+ 15,
816
+ 16,
817
+ 17,
818
+ 18,
819
+ 19,
820
+ 20,
821
+ 21,
822
+ 22,
823
+ 23,
824
+ 24,
825
+ 25,
826
+ 26,
827
+ 27,
828
+ 28,
829
+ 29,
830
+ 30,
831
+ 31,
832
+ 32,
833
+ 33,
834
+ 34,
835
+ 35,
836
+ 36,
837
+ 37,
838
+ 38,
839
+ 39
840
+ ],
841
+ "modality_keys": [
842
+ "left_wrist_eef",
843
+ "right_wrist_eef",
844
+ "left_gripper_pos",
845
+ "right_gripper_pos",
846
+ "left_joint_pos",
847
+ "right_joint_pos"
848
+ ],
849
+ "sin_cos_embedding_keys": null,
850
+ "mean_std_embedding_keys": null,
851
+ "action_configs": [
852
+ {
853
+ "rep": "RELATIVE",
854
+ "type": "EEF",
855
+ "format": "XYZ_ROT6D",
856
+ "state_key": "left_wrist_eef"
857
+ },
858
+ {
859
+ "rep": "RELATIVE",
860
+ "type": "EEF",
861
+ "format": "XYZ_ROT6D",
862
+ "state_key": "right_wrist_eef"
863
+ },
864
+ {
865
+ "rep": "ABSOLUTE",
866
+ "type": "NON_EEF",
867
+ "format": "DEFAULT",
868
+ "state_key": "left_gripper_pos"
869
+ },
870
+ {
871
+ "rep": "ABSOLUTE",
872
+ "type": "NON_EEF",
873
+ "format": "DEFAULT",
874
+ "state_key": "right_gripper_pos"
875
+ },
876
+ {
877
+ "rep": "RELATIVE",
878
+ "type": "NON_EEF",
879
+ "format": "DEFAULT",
880
+ "state_key": "left_joint_pos"
881
+ },
882
+ {
883
+ "rep": "RELATIVE",
884
+ "type": "NON_EEF",
885
+ "format": "DEFAULT",
886
+ "state_key": "right_joint_pos"
887
+ }
888
+ ]
889
+ },
890
+ "language": {
891
+ "delta_indices": [
892
+ 0
893
+ ],
894
+ "modality_keys": [
895
+ "annotation.sub_task"
896
+ ],
897
+ "sin_cos_embedding_keys": null,
898
+ "mean_std_embedding_keys": null,
899
+ "action_configs": null
900
+ }
901
+ },
902
+ "oxe_droid_relative_eef_relative_joint": {
903
+ "video": {
904
+ "delta_indices": [
905
+ -15,
906
+ 0
907
+ ],
908
+ "modality_keys": [
909
+ "exterior_image_1_left",
910
+ "wrist_image_left"
911
+ ],
912
+ "sin_cos_embedding_keys": null,
913
+ "mean_std_embedding_keys": null,
914
+ "action_configs": null
915
+ },
916
+ "state": {
917
+ "delta_indices": [
918
+ 0
919
+ ],
920
+ "modality_keys": [
921
+ "eef_9d",
922
+ "gripper_position",
923
+ "joint_position"
924
+ ],
925
+ "sin_cos_embedding_keys": null,
926
+ "mean_std_embedding_keys": null,
927
+ "action_configs": null
928
+ },
929
+ "action": {
930
+ "delta_indices": [
931
+ 0,
932
+ 1,
933
+ 2,
934
+ 3,
935
+ 4,
936
+ 5,
937
+ 6,
938
+ 7,
939
+ 8,
940
+ 9,
941
+ 10,
942
+ 11,
943
+ 12,
944
+ 13,
945
+ 14,
946
+ 15,
947
+ 16,
948
+ 17,
949
+ 18,
950
+ 19,
951
+ 20,
952
+ 21,
953
+ 22,
954
+ 23,
955
+ 24,
956
+ 25,
957
+ 26,
958
+ 27,
959
+ 28,
960
+ 29,
961
+ 30,
962
+ 31,
963
+ 32,
964
+ 33,
965
+ 34,
966
+ 35,
967
+ 36,
968
+ 37,
969
+ 38,
970
+ 39
971
+ ],
972
+ "modality_keys": [
973
+ "eef_9d",
974
+ "gripper_position",
975
+ "joint_position"
976
+ ],
977
+ "sin_cos_embedding_keys": null,
978
+ "mean_std_embedding_keys": null,
979
+ "action_configs": [
980
+ {
981
+ "rep": "RELATIVE",
982
+ "type": "EEF",
983
+ "format": "XYZ_ROT6D",
984
+ "state_key": "eef_9d"
985
+ },
986
+ {
987
+ "rep": "ABSOLUTE",
988
+ "type": "NON_EEF",
989
+ "format": "DEFAULT",
990
+ "state_key": "gripper_position"
991
+ },
992
+ {
993
+ "rep": "RELATIVE",
994
+ "type": "NON_EEF",
995
+ "format": "DEFAULT",
996
+ "state_key": "joint_position"
997
+ }
998
+ ]
999
+ },
1000
+ "language": {
1001
+ "delta_indices": [
1002
+ 0
1003
+ ],
1004
+ "modality_keys": [
1005
+ "annotation.language.language_instruction"
1006
+ ],
1007
+ "sin_cos_embedding_keys": null,
1008
+ "mean_std_embedding_keys": null,
1009
+ "action_configs": null
1010
+ }
1011
+ },
1012
+ "new_embodiment": {
1013
+ "video": {
1014
+ "delta_indices": [
1015
+ 0
1016
+ ],
1017
+ "modality_keys": [
1018
+ "front",
1019
+ "wrist",
1020
+ "top"
1021
+ ],
1022
+ "sin_cos_embedding_keys": null,
1023
+ "mean_std_embedding_keys": null,
1024
+ "action_configs": null
1025
+ },
1026
+ "state": {
1027
+ "delta_indices": [
1028
+ 0
1029
+ ],
1030
+ "modality_keys": [
1031
+ "single_arm",
1032
+ "gripper"
1033
+ ],
1034
+ "sin_cos_embedding_keys": null,
1035
+ "mean_std_embedding_keys": null,
1036
+ "action_configs": null
1037
+ },
1038
+ "action": {
1039
+ "delta_indices": [
1040
+ 0,
1041
+ 1,
1042
+ 2,
1043
+ 3,
1044
+ 4,
1045
+ 5,
1046
+ 6,
1047
+ 7,
1048
+ 8,
1049
+ 9,
1050
+ 10,
1051
+ 11,
1052
+ 12,
1053
+ 13,
1054
+ 14,
1055
+ 15
1056
+ ],
1057
+ "modality_keys": [
1058
+ "single_arm",
1059
+ "gripper"
1060
+ ],
1061
+ "sin_cos_embedding_keys": null,
1062
+ "mean_std_embedding_keys": null,
1063
+ "action_configs": [
1064
+ {
1065
+ "rep": "RELATIVE",
1066
+ "type": "NON_EEF",
1067
+ "format": "DEFAULT",
1068
+ "state_key": null
1069
+ },
1070
+ {
1071
+ "rep": "ABSOLUTE",
1072
+ "type": "NON_EEF",
1073
+ "format": "DEFAULT",
1074
+ "state_key": null
1075
+ }
1076
+ ]
1077
+ },
1078
+ "language": {
1079
+ "delta_indices": [
1080
+ 0
1081
+ ],
1082
+ "modality_keys": [
1083
+ "annotation.human.task_description"
1084
+ ],
1085
+ "sin_cos_embedding_keys": null,
1086
+ "mean_std_embedding_keys": null,
1087
+ "action_configs": null
1088
+ }
1089
+ }
1090
+ },
1091
+ "image_crop_size": [
1092
+ 230,
1093
+ 230
1094
+ ],
1095
+ "image_target_size": [
1096
+ 256,
1097
+ 256
1098
+ ],
1099
+ "use_albumentations": true,
1100
+ "random_rotation_angle": 0,
1101
+ "color_jitter_params": {
1102
+ "brightness": 0.3,
1103
+ "contrast": 0.4,
1104
+ "saturation": 0.5,
1105
+ "hue": 0.08
1106
+ },
1107
+ "shortest_image_edge": 256,
1108
+ "crop_fraction": 0.95,
1109
+ "letter_box_transform": false,
1110
+ "model_name": "nvidia/Cosmos-Reason2-2B",
1111
+ "model_type": "qwen",
1112
+ "formalize_language": true,
1113
+ "max_state_dim": 132,
1114
+ "max_action_dim": 132,
1115
+ "max_action_horizon": 40,
1116
+ "use_percentiles": true,
1117
+ "use_mean_std": false,
1118
+ "clip_outliers": true,
1119
+ "apply_sincos_state_encoding": false,
1120
+ "use_relative_action": true,
1121
+ "exclude_state": false,
1122
+ "state_dropout_prob": 0.2
1123
+ }
1124
+ }
statistics.json ADDED
The diff for this file is too large to render. See raw diff
 
wandb_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"project": "groot_ring_insert", "run_id": "groot_ring_insert"}
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)