andyrikin commited on
Commit
da749f2
·
verified ·
1 Parent(s): a418443

Upload 21 files

Browse files
checkpoint-100000/config.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "action_horizon": 50,
3
+ "add_pos_embed": true,
4
+ "apply_sincos_state_encoding": true,
5
+ "architectures": [
6
+ "Gr00tN1d6"
7
+ ],
8
+ "attn_dropout": 0.2,
9
+ "attn_implementation": null,
10
+ "backbone_embedding_dim": 2048,
11
+ "backbone_model_type": "eagle",
12
+ "backbone_trainable_params_fp32": true,
13
+ "collator_overwrite_image_inputs": false,
14
+ "color_jitter_params": {
15
+ "brightness": 0.1,
16
+ "contrast": 0.1,
17
+ "hue": 0.1,
18
+ "saturation": 0.1
19
+ },
20
+ "crop_fraction": 0.95,
21
+ "diffusion_model_cfg": {
22
+ "attention_head_dim": 48,
23
+ "dropout": 0.2,
24
+ "final_dropout": true,
25
+ "interleave_self_attention": true,
26
+ "norm_type": "ada_norm",
27
+ "num_attention_heads": 32,
28
+ "num_layers": 32,
29
+ "output_dim": 1024,
30
+ "positional_embeddings": null
31
+ },
32
+ "eagle_collator": true,
33
+ "formalize_language": true,
34
+ "gemma_collator": false,
35
+ "hidden_size": 1024,
36
+ "image_crop_size": null,
37
+ "image_target_size": null,
38
+ "input_embedding_dim": 1536,
39
+ "load_bf16": true,
40
+ "max_action_dim": 128,
41
+ "max_num_embodiments": 32,
42
+ "max_seq_len": 1024,
43
+ "max_state_dim": 128,
44
+ "model_dtype": "bfloat16",
45
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
46
+ "model_type": "Gr00tN1d6",
47
+ "noise_beta_alpha": 1.5,
48
+ "noise_beta_beta": 1.0,
49
+ "noise_s": 0.999,
50
+ "num_inference_timesteps": 4,
51
+ "num_timestep_buckets": 1000,
52
+ "random_rotation_angle": null,
53
+ "reproject_vision": false,
54
+ "select_layer": 16,
55
+ "shortest_image_edge": 256,
56
+ "state_dropout_prob": 0.0,
57
+ "torch_dtype": "bfloat16",
58
+ "transformers_version": "4.51.3",
59
+ "tune_diffusion_model": false,
60
+ "tune_llm": false,
61
+ "tune_projector": true,
62
+ "tune_top_llm_layers": 4,
63
+ "tune_visual": false,
64
+ "tune_vlln": true,
65
+ "use_albumentations_transforms": true,
66
+ "use_alternate_vl_dit": true,
67
+ "use_flash_attention": true,
68
+ "use_relative_action": true,
69
+ "use_vlln": true
70
+ }
checkpoint-100000/embodiment_id.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "robocasa_panda_omron": 13,
3
+ "gr1": 20,
4
+ "behavior_r1_pro": 24,
5
+ "unitree_g1": 8,
6
+ "oxe_google": 0,
7
+ "oxe_widowx": 1,
8
+ "libero_panda": 2,
9
+ "oxe_droid": 16,
10
+ "new_embodiment": 10
11
+ }
checkpoint-100000/experiment_cfg/conf.yaml ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ load_config_path: null
2
+ model:
3
+ model_type: Gr00tN1d6
4
+ model_dtype: bfloat16
5
+ model_name: nvidia/Eagle-Block2A-2B-v2
6
+ backbone_model_type: eagle
7
+ model_revision: null
8
+ tune_top_llm_layers: 4
9
+ backbone_embedding_dim: 2048
10
+ tune_llm: false
11
+ tune_visual: false
12
+ select_layer: 16
13
+ reproject_vision: false
14
+ use_flash_attention: true
15
+ load_bf16: false
16
+ collator_overwrite_image_inputs: false
17
+ eagle_collator: true
18
+ backbone_trainable_params_fp32: true
19
+ image_crop_size: null
20
+ image_target_size: null
21
+ shortest_image_edge: 256
22
+ crop_fraction: 0.95
23
+ random_rotation_angle: null
24
+ color_jitter_params:
25
+ brightness: 0.3
26
+ contrast: 0.4
27
+ saturation: 0.5
28
+ hue: 0.08
29
+ use_albumentations_transforms: true
30
+ formalize_language: true
31
+ apply_sincos_state_encoding: false
32
+ use_relative_action: true
33
+ max_state_dim: 29
34
+ max_action_dim: 29
35
+ action_horizon: 16
36
+ hidden_size: 1024
37
+ input_embedding_dim: 1536
38
+ add_pos_embed: true
39
+ attn_dropout: 0.2
40
+ use_vlln: true
41
+ max_seq_len: 1024
42
+ use_alternate_vl_dit: true
43
+ attend_text_every_n_blocks: 2
44
+ diffusion_model_cfg:
45
+ positional_embeddings: null
46
+ num_layers: 32
47
+ num_attention_heads: 32
48
+ attention_head_dim: 48
49
+ norm_type: ada_norm
50
+ dropout: 0.2
51
+ final_dropout: true
52
+ output_dim: 1024
53
+ interleave_self_attention: true
54
+ num_inference_timesteps: 4
55
+ noise_beta_alpha: 1.5
56
+ noise_beta_beta: 1.0
57
+ noise_s: 0.999
58
+ num_timestep_buckets: 1000
59
+ tune_projector: true
60
+ tune_diffusion_model: false
61
+ tune_vlln: true
62
+ state_dropout_prob: 0.0
63
+ state_additive_noise_scale: 0.0
64
+ max_num_embodiments: 32
65
+ data:
66
+ datasets:
67
+ - dataset_paths:
68
+ - /home/fotisinc01/Isaac-GR00T/demo_data/DataSet2
69
+ embodiment_tag: new_embodiment
70
+ mix_ratio: 1.0
71
+ dataset_type: physical_embodiment
72
+ val_dataset_path: null
73
+ modality_configs:
74
+ new_embodiment:
75
+ video:
76
+ delta_indices:
77
+ - 0
78
+ modality_keys:
79
+ - front
80
+ - wrist
81
+ sin_cos_embedding_keys: null
82
+ mean_std_embedding_keys: null
83
+ action_configs: null
84
+ state:
85
+ delta_indices:
86
+ - 0
87
+ modality_keys:
88
+ - single_arm
89
+ - gripper
90
+ sin_cos_embedding_keys: null
91
+ mean_std_embedding_keys: null
92
+ action_configs: null
93
+ action:
94
+ delta_indices:
95
+ - 0
96
+ - 1
97
+ - 2
98
+ - 3
99
+ - 4
100
+ - 5
101
+ - 6
102
+ - 7
103
+ - 8
104
+ - 9
105
+ - 10
106
+ - 11
107
+ - 12
108
+ - 13
109
+ - 14
110
+ - 15
111
+ modality_keys:
112
+ - single_arm
113
+ - gripper
114
+ sin_cos_embedding_keys: null
115
+ mean_std_embedding_keys: null
116
+ action_configs:
117
+ - rep: RELATIVE
118
+ type: NON_EEF
119
+ format: DEFAULT
120
+ state_key: null
121
+ - rep: ABSOLUTE
122
+ type: NON_EEF
123
+ format: DEFAULT
124
+ state_key: null
125
+ language:
126
+ delta_indices:
127
+ - 0
128
+ modality_keys:
129
+ - annotation.human.task_description
130
+ sin_cos_embedding_keys: null
131
+ mean_std_embedding_keys: null
132
+ action_configs: null
133
+ download_cache: false
134
+ shard_size: 1024
135
+ episode_sampling_rate: 0.1
136
+ num_shards_per_epoch: 100000
137
+ override_pretraining_statistics: false
138
+ mode: single_turn
139
+ random_chop: 0.0
140
+ mock_dataset_mode: false
141
+ shuffle: true
142
+ seed: 42
143
+ multiprocessing_context: fork
144
+ allow_padding: false
145
+ subsample_ratio: 1.0
146
+ image_crop_size:
147
+ - 244
148
+ - 244
149
+ image_target_size:
150
+ - 224
151
+ - 224
152
+ video_backend: torchcodec
153
+ training:
154
+ output_dir: /home/fotisinc01/D1S/ur5e_finetune
155
+ experiment_name: null
156
+ max_steps: 100000
157
+ global_batch_size: 32
158
+ batch_size: null
159
+ gradient_accumulation_steps: 1
160
+ learning_rate: 0.0001
161
+ lr_scheduler_type: cosine
162
+ weight_decay: 1.0e-05
163
+ warmup_ratio: 0.05
164
+ warmup_steps: 0
165
+ max_grad_norm: 1.0
166
+ optim: adamw_torch
167
+ start_from_checkpoint: nvidia/GR00T-N1.6-3B
168
+ tf32: true
169
+ fp16: false
170
+ bf16: true
171
+ eval_bf16: true
172
+ logging_steps: 10
173
+ save_steps: 2000
174
+ save_total_limit: 5
175
+ save_vl_model: false
176
+ upload_checkpoints: false
177
+ upload_every: 1000
178
+ upload_last_n_checkpoints: 5
179
+ max_concurrent_uploads: 2
180
+ eval_strategy: 'no'
181
+ eval_steps: 500
182
+ eval_set_split_ratio: 0.1
183
+ eval_batch_size: 2
184
+ save_best_eval_metric_name: ''
185
+ save_best_eval_metric_greater_is_better: true
186
+ deepspeed_stage: 2
187
+ gradient_checkpointing: false
188
+ transformers_trust_remote_code: true
189
+ transformers_local_files_only: false
190
+ transformers_cache_dir: null
191
+ transformers_access_token: null
192
+ use_ddp: false
193
+ ddp_bucket_cap_mb: 100
194
+ num_gpus: 4
195
+ dataloader_num_workers: 4
196
+ remove_unused_columns: false
197
+ use_wandb: false
198
+ wandb_project: finetune-gr00t-n1d6
199
+ enable_profiling: false
200
+ max_retries: 3
201
+ assert_loss_less_than: null
202
+ add_rl_callback: false
203
+ enable_open_loop_eval: false
204
+ open_loop_eval_traj_ids:
205
+ - 0
206
+ open_loop_eval_steps_per_traj: 100
207
+ open_loop_eval_plot_indices: null
208
+ max_steps: 100000
209
+ save_steps: 2000
checkpoint-100000/experiment_cfg/config.yaml ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !!python/object:gr00t.configs.base_config.Config
2
+ data: !!python/object:gr00t.configs.data.data_config.DataConfig
3
+ allow_padding: false
4
+ datasets:
5
+ - !!python/object:gr00t.configs.data.data_config.SingleDatasetConfig
6
+ dataset_paths:
7
+ - /home/fotisinc01/Isaac-GR00T/demo_data/DataSet2
8
+ dataset_type: physical_embodiment
9
+ embodiment_tag: new_embodiment
10
+ mix_ratio: 1.0
11
+ val_dataset_path: null
12
+ download_cache: false
13
+ episode_sampling_rate: 0.1
14
+ image_crop_size:
15
+ - 244
16
+ - 244
17
+ image_target_size:
18
+ - 224
19
+ - 224
20
+ mock_dataset_mode: false
21
+ modality_configs:
22
+ new_embodiment:
23
+ action: !!python/object:gr00t.data.types.ModalityConfig
24
+ action_configs:
25
+ - !!python/object:gr00t.data.types.ActionConfig
26
+ format: &id001 !!python/object/apply:gr00t.data.types.ActionFormat
27
+ - default
28
+ rep: !!python/object/apply:gr00t.data.types.ActionRepresentation
29
+ - relative
30
+ state_key: null
31
+ type: &id002 !!python/object/apply:gr00t.data.types.ActionType
32
+ - non_eef
33
+ - !!python/object:gr00t.data.types.ActionConfig
34
+ format: *id001
35
+ rep: !!python/object/apply:gr00t.data.types.ActionRepresentation
36
+ - absolute
37
+ state_key: null
38
+ type: *id002
39
+ delta_indices:
40
+ - 0
41
+ - 1
42
+ - 2
43
+ - 3
44
+ - 4
45
+ - 5
46
+ - 6
47
+ - 7
48
+ - 8
49
+ - 9
50
+ - 10
51
+ - 11
52
+ - 12
53
+ - 13
54
+ - 14
55
+ - 15
56
+ mean_std_embedding_keys: null
57
+ modality_keys:
58
+ - single_arm
59
+ - gripper
60
+ sin_cos_embedding_keys: null
61
+ language: !!python/object:gr00t.data.types.ModalityConfig
62
+ action_configs: null
63
+ delta_indices:
64
+ - 0
65
+ mean_std_embedding_keys: null
66
+ modality_keys:
67
+ - annotation.human.task_description
68
+ sin_cos_embedding_keys: null
69
+ state: !!python/object:gr00t.data.types.ModalityConfig
70
+ action_configs: null
71
+ delta_indices:
72
+ - 0
73
+ mean_std_embedding_keys: null
74
+ modality_keys:
75
+ - single_arm
76
+ - gripper
77
+ sin_cos_embedding_keys: null
78
+ video: !!python/object:gr00t.data.types.ModalityConfig
79
+ action_configs: null
80
+ delta_indices:
81
+ - 0
82
+ mean_std_embedding_keys: null
83
+ modality_keys:
84
+ - front
85
+ - wrist
86
+ sin_cos_embedding_keys: null
87
+ mode: single_turn
88
+ multiprocessing_context: fork
89
+ num_shards_per_epoch: 100000
90
+ override_pretraining_statistics: false
91
+ random_chop: 0.0
92
+ seed: 42
93
+ shard_size: 1024
94
+ shuffle: true
95
+ subsample_ratio: 1.0
96
+ video_backend: torchcodec
97
+ load_config_path: null
98
+ model: !!python/object:gr00t.configs.model.gr00t_n1d6.Gr00tN1d6Config
99
+ _attn_implementation_autoset: false
100
+ _attn_implementation_internal: null
101
+ _commit_hash: null
102
+ _name_or_path: ''
103
+ add_cross_attention: false
104
+ architectures: null
105
+ backbone_model_type: eagle
106
+ backbone_trainable_params_fp32: true
107
+ bad_words_ids: null
108
+ begin_suppress_tokens: null
109
+ bos_token_id: null
110
+ chunk_size_feed_forward: 0
111
+ color_jitter_params:
112
+ brightness: 0.3
113
+ contrast: 0.4
114
+ hue: 0.08
115
+ saturation: 0.5
116
+ cross_attention_hidden_size: null
117
+ decoder_start_token_id: null
118
+ diffusion_model_cfg:
119
+ attention_head_dim: 48
120
+ dropout: 0.2
121
+ final_dropout: true
122
+ interleave_self_attention: true
123
+ norm_type: ada_norm
124
+ num_attention_heads: 32
125
+ num_layers: 32
126
+ output_dim: 1024
127
+ positional_embeddings: null
128
+ diversity_penalty: 0.0
129
+ do_sample: false
130
+ eagle_collator: true
131
+ early_stopping: false
132
+ encoder_no_repeat_ngram_size: 0
133
+ eos_token_id: null
134
+ exponential_decay_length_penalty: null
135
+ finetuning_task: null
136
+ forced_bos_token_id: null
137
+ forced_eos_token_id: null
138
+ id2label:
139
+ 0: LABEL_0
140
+ 1: LABEL_1
141
+ is_decoder: false
142
+ is_encoder_decoder: false
143
+ label2id:
144
+ LABEL_0: 0
145
+ LABEL_1: 1
146
+ length_penalty: 1.0
147
+ load_bf16: false
148
+ max_length: 20
149
+ min_length: 0
150
+ model_name: nvidia/Eagle-Block2A-2B-v2
151
+ no_repeat_ngram_size: 0
152
+ num_beam_groups: 1
153
+ num_beams: 1
154
+ num_return_sequences: 1
155
+ output_attentions: false
156
+ output_hidden_states: false
157
+ output_scores: false
158
+ pad_token_id: null
159
+ prefix: null
160
+ problem_type: null
161
+ pruned_heads: {}
162
+ random_rotation_angle: null
163
+ remove_invalid_values: false
164
+ repetition_penalty: 1.0
165
+ reproject_vision: false
166
+ return_dict: true
167
+ return_dict_in_generate: false
168
+ sep_token_id: null
169
+ state_dropout_prob: 0.0
170
+ suppress_tokens: null
171
+ task_specific_params: null
172
+ temperature: 1.0
173
+ tf_legacy_loss: false
174
+ tie_encoder_decoder: false
175
+ tie_word_embeddings: true
176
+ tokenizer_class: null
177
+ top_k: 50
178
+ top_p: 1.0
179
+ torch_dtype: null
180
+ torchscript: false
181
+ transformers_version: null
182
+ tune_diffusion_model: false
183
+ tune_llm: false
184
+ tune_projector: true
185
+ tune_visual: false
186
+ typical_p: 1.0
187
+ use_bfloat16: false
188
+ use_relative_action: true
189
+ training: !!python/object:gr00t.configs.training.training_config.TrainingConfig
190
+ add_rl_callback: false
191
+ assert_loss_less_than: null
192
+ batch_size: null
193
+ bf16: true
194
+ dataloader_num_workers: 4
195
+ ddp_bucket_cap_mb: 100
196
+ deepspeed_stage: 2
197
+ enable_open_loop_eval: false
198
+ enable_profiling: false
199
+ eval_batch_size: 2
200
+ eval_bf16: true
201
+ eval_set_split_ratio: 0.1
202
+ eval_steps: 500
203
+ eval_strategy: 'no'
204
+ experiment_name: null
205
+ fp16: false
206
+ global_batch_size: 32
207
+ gradient_accumulation_steps: 1
208
+ gradient_checkpointing: false
209
+ learning_rate: 0.0001
210
+ logging_steps: 10
211
+ lr_scheduler_type: cosine
212
+ max_concurrent_uploads: 2
213
+ max_grad_norm: 1.0
214
+ max_retries: 3
215
+ max_steps: 100000
216
+ num_gpus: 4
217
+ open_loop_eval_plot_indices: null
218
+ open_loop_eval_steps_per_traj: 100
219
+ open_loop_eval_traj_ids:
220
+ - 0
221
+ optim: adamw_torch
222
+ output_dir: /home/fotisinc01/D1S/ur5e_finetune
223
+ remove_unused_columns: false
224
+ save_best_eval_metric_greater_is_better: true
225
+ save_best_eval_metric_name: ''
226
+ save_steps: 2000
227
+ save_total_limit: 5
228
+ save_vl_model: false
229
+ start_from_checkpoint: nvidia/GR00T-N1.6-3B
230
+ tf32: true
231
+ transformers_access_token: null
232
+ transformers_cache_dir: null
233
+ transformers_local_files_only: false
234
+ transformers_trust_remote_code: true
235
+ upload_checkpoints: false
236
+ upload_every: 1000
237
+ upload_last_n_checkpoints: 5
238
+ use_ddp: false
239
+ use_wandb: false
240
+ wandb_project: finetune-gr00t-n1d6
241
+ warmup_ratio: 0.05
242
+ warmup_steps: 0
243
+ weight_decay: 1.0e-05
checkpoint-100000/experiment_cfg/dataset_statistics.json ADDED
@@ -0,0 +1,932 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "new_embodiment": {
3
+ "state": {
4
+ "single_arm": {
5
+ "min": [
6
+ 67.029541015625,
7
+ -99.99787902832031,
8
+ 119.99635314941406,
9
+ -140.28578186035156,
10
+ -90.10130310058594,
11
+ -112.9889907836914
12
+ ],
13
+ "max": [
14
+ 105.6177749633789,
15
+ -77.78331756591797,
16
+ 137.35816955566406,
17
+ -109.99929809570312,
18
+ -89.89762115478516,
19
+ -74.32592010498047
20
+ ],
21
+ "mean": [
22
+ 86.10012817382812,
23
+ -85.37252807617188,
24
+ 126.7602767944336,
25
+ -131.0440673828125,
26
+ -89.9991226196289,
27
+ -93.8736801147461
28
+ ],
29
+ "std": [
30
+ 14.892157554626465,
31
+ 6.903073310852051,
32
+ 4.997873306274414,
33
+ 9.562726974487305,
34
+ 0.047469977290495236,
35
+ 14.904440879821747
36
+ ],
37
+ "q01": [
38
+ 67.87848411560059,
39
+ -99.9629135131836,
40
+ 120.00053405761719,
41
+ -140.2123260498047,
42
+ -90.08702087402344,
43
+ -112.16383361816406
44
+ ],
45
+ "q99": [
46
+ 105.60716247558594,
47
+ -77.81645965576172,
48
+ 136.87142944335938,
49
+ -109.99980163574219,
50
+ -89.90962219238281,
51
+ -74.37679222106934
52
+ ]
53
+ },
54
+ "gripper": {
55
+ "min": [
56
+ 0.0
57
+ ],
58
+ "max": [
59
+ 1.0
60
+ ],
61
+ "mean": [
62
+ 0.6192861199378967
63
+ ],
64
+ "std": [
65
+ 0.485497385263443
66
+ ],
67
+ "q01": [
68
+ 0.0
69
+ ],
70
+ "q99": [
71
+ 1.0
72
+ ]
73
+ }
74
+ },
75
+ "action": {
76
+ "single_arm": {
77
+ "min": [
78
+ 67.05335235595703,
79
+ -100.0,
80
+ 120.0,
81
+ -140.27828979492188,
82
+ -90.10308837890625,
83
+ -112.98888397216797
84
+ ],
85
+ "max": [
86
+ 105.61236572265625,
87
+ -77.81704711914062,
88
+ 137.35064697265625,
89
+ -110.0,
90
+ -89.89803314208984,
91
+ -74.31143951416016
92
+ ],
93
+ "mean": [
94
+ 86.10040283203125,
95
+ -85.3731689453125,
96
+ 126.75997161865234,
97
+ -131.04676818847656,
98
+ -89.99909210205078,
99
+ -93.87364196777344
100
+ ],
101
+ "std": [
102
+ 14.892980575561523,
103
+ 6.90336370468138,
104
+ 4.998412132263093,
105
+ 9.564056396484375,
106
+ 0.04777370766229926,
107
+ 14.904519081115692
108
+ ],
109
+ "q01": [
110
+ 67.87898658752441,
111
+ -99.96501922607422,
112
+ 120.0,
113
+ -140.21205139160156,
114
+ -90.08860778808594,
115
+ -112.16386413574219
116
+ ],
117
+ "q99": [
118
+ 105.60699462890625,
119
+ -77.81751251220703,
120
+ 136.87181091308594,
121
+ -110.0,
122
+ -89.909423828125,
123
+ -74.3769605255127
124
+ ]
125
+ },
126
+ "gripper": {
127
+ "min": [
128
+ 0.0
129
+ ],
130
+ "max": [
131
+ 1.0
132
+ ],
133
+ "mean": [
134
+ 0.6192861199378967
135
+ ],
136
+ "std": [
137
+ 0.485497385263443
138
+ ],
139
+ "q01": [
140
+ 0.0
141
+ ],
142
+ "q99": [
143
+ 1.0
144
+ ]
145
+ }
146
+ },
147
+ "relative_action": {
148
+ "single_arm": {
149
+ "min": [
150
+ [
151
+ -0.33333587646484375,
152
+ -0.33333587646484375,
153
+ -0.333343505859375,
154
+ -5.3443145751953125,
155
+ -0.17539215087890625,
156
+ -0.33333587646484375
157
+ ],
158
+ [
159
+ -1.0162200927734375,
160
+ -0.99530029296875,
161
+ -1.0168609619140625,
162
+ -5.3443145751953125,
163
+ -0.19951629638671875,
164
+ -1.0000381469726562
165
+ ],
166
+ [
167
+ -1.68798828125,
168
+ -1.6564712524414062,
169
+ -1.682586669921875,
170
+ -5.5667266845703125,
171
+ -0.199493408203125,
172
+ -1.6667251586914062
173
+ ],
174
+ [
175
+ -2.3594207763671875,
176
+ -2.3170318603515625,
177
+ -2.34857177734375,
178
+ -5.6769561767578125,
179
+ -0.19918060302734375,
180
+ -2.3333816528320312
181
+ ],
182
+ [
183
+ -3.030548095703125,
184
+ -2.9770126342773438,
185
+ -3.0147323608398438,
186
+ -5.6769561767578125,
187
+ -0.19889068603515625,
188
+ -3.0000076293945312
189
+ ],
190
+ [
191
+ -3.7012176513671875,
192
+ -3.636444091796875,
193
+ -3.681396484375,
194
+ -5.6769561767578125,
195
+ -0.1985931396484375,
196
+ -3.6666717529296875
197
+ ],
198
+ [
199
+ -4.3802490234375,
200
+ -4.295310974121094,
201
+ -4.347526550292969,
202
+ -5.6769561767578125,
203
+ -0.19834136962890625,
204
+ -4.333343505859375
205
+ ],
206
+ [
207
+ -5.045494079589844,
208
+ -4.9553375244140625,
209
+ -5.015602111816406,
210
+ -5.6769561767578125,
211
+ -0.1979827880859375,
212
+ -5.000007629394531
213
+ ],
214
+ [
215
+ -5.717376708984375,
216
+ -5.615272521972656,
217
+ -5.681098937988281,
218
+ -6.0488128662109375,
219
+ -0.1976776123046875,
220
+ -5.6666717529296875
221
+ ],
222
+ [
223
+ -6.389076232910156,
224
+ -6.275184631347656,
225
+ -6.3486480712890625,
226
+ -6.6556396484375,
227
+ -0.19757843017578125,
228
+ -6.3333282470703125
229
+ ],
230
+ [
231
+ -7.06060791015625,
232
+ -6.9349822998046875,
233
+ -7.016349792480469,
234
+ -7.2411956787109375,
235
+ -0.19756317138671875,
236
+ -6.999992370605469
237
+ ],
238
+ [
239
+ -7.731986999511719,
240
+ -7.5947113037109375,
241
+ -7.683509826660156,
242
+ -7.9083251953125,
243
+ -0.19756317138671875,
244
+ -7.666656494140625
245
+ ],
246
+ [
247
+ -8.403182983398438,
248
+ -8.254341125488281,
249
+ -8.35174560546875,
250
+ -8.575454711914062,
251
+ -0.1975555419921875,
252
+ -8.33331298828125
253
+ ],
254
+ [
255
+ -9.074241638183594,
256
+ -8.913963317871094,
257
+ -9.018180847167969,
258
+ -9.242477416992188,
259
+ -0.19756317138671875,
260
+ -8.999977111816406
261
+ ],
262
+ [
263
+ -9.745086669921875,
264
+ -9.573501586914062,
265
+ -9.686698913574219,
266
+ -9.90948486328125,
267
+ -0.1975555419921875,
268
+ -9.666641235351562
269
+ ],
270
+ [
271
+ -10.415824890136719,
272
+ -10.232963562011719,
273
+ -10.352272033691406,
274
+ -10.5765380859375,
275
+ -0.1975555419921875,
276
+ -10.333305358886719
277
+ ]
278
+ ],
279
+ "max": [
280
+ [
281
+ 0.33333587646484375,
282
+ 0.33713531494140625,
283
+ 0.333343505859375,
284
+ 0.4148101806640625,
285
+ 0.1791534423828125,
286
+ 0.33333587646484375
287
+ ],
288
+ [
289
+ 1.0198593139648438,
290
+ 1.0226211547851562,
291
+ 1.01947021484375,
292
+ 1.1087646484375,
293
+ 0.17545318603515625,
294
+ 1.0001068115234375
295
+ ],
296
+ [
297
+ 1.6839447021484375,
298
+ 1.6938629150390625,
299
+ 1.6868743896484375,
300
+ 1.8275604248046875,
301
+ 0.177520751953125,
302
+ 1.6668167114257812
303
+ ],
304
+ [
305
+ 2.348419189453125,
306
+ 2.3662338256835938,
307
+ 2.3558731079101562,
308
+ 2.5438079833984375,
309
+ 0.177520751953125,
310
+ 2.333526611328125
311
+ ],
312
+ [
313
+ 3.0132827758789062,
314
+ 3.0375518798828125,
315
+ 3.0225143432617188,
316
+ 3.2547149658203125,
317
+ 0.177520751953125,
318
+ 3.0002365112304688
319
+ ],
320
+ [
321
+ 3.6785354614257812,
322
+ 3.7078781127929688,
323
+ 3.6903610229492188,
324
+ 3.9779052734375,
325
+ 0.177520751953125,
326
+ 3.6669387817382812
327
+ ],
328
+ [
329
+ 4.344139099121094,
330
+ 4.377891540527344,
331
+ 4.358390808105469,
332
+ 4.64886474609375,
333
+ 0.177520751953125,
334
+ 4.3336029052734375
335
+ ],
336
+ [
337
+ 5.010032653808594,
338
+ 5.047309875488281,
339
+ 5.0265350341796875,
340
+ 5.3502655029296875,
341
+ 0.177520751953125,
342
+ 5.000282287597656
343
+ ],
344
+ [
345
+ 5.676445007324219,
346
+ 5.7174530029296875,
347
+ 5.6926116943359375,
348
+ 6.04620361328125,
349
+ 0.177520751953125,
350
+ 5.6668701171875
351
+ ],
352
+ [
353
+ 6.343650817871094,
354
+ 6.3861236572265625,
355
+ 6.359428405761719,
356
+ 6.7547760009765625,
357
+ 0.177520751953125,
358
+ 6.333549499511719
359
+ ],
360
+ [
361
+ 7.010200500488281,
362
+ 7.054069519042969,
363
+ 7.0263214111328125,
364
+ 7.35455322265625,
365
+ 0.177520751953125,
366
+ 7.0002288818359375
367
+ ],
368
+ [
369
+ 7.6777496337890625,
370
+ 7.721626281738281,
371
+ 7.693153381347656,
372
+ 7.7168121337890625,
373
+ 0.177520751953125,
374
+ 7.6668853759765625
375
+ ],
376
+ [
377
+ 8.34356689453125,
378
+ 8.389404296875,
379
+ 8.359626770019531,
380
+ 8.354034423828125,
381
+ 0.177520751953125,
382
+ 8.33355712890625
383
+ ],
384
+ [
385
+ 9.012992858886719,
386
+ 9.056854248046875,
387
+ 9.026206970214844,
388
+ 9.021858215332031,
389
+ 0.177520751953125,
390
+ 9.000205993652344
391
+ ],
392
+ [
393
+ 9.681045532226562,
394
+ 9.723846435546875,
395
+ 9.692695617675781,
396
+ 9.689598083496094,
397
+ 0.177520751953125,
398
+ 9.6668701171875
399
+ ],
400
+ [
401
+ 10.348480224609375,
402
+ 10.390754699707031,
403
+ 10.358604431152344,
404
+ 10.357330322265625,
405
+ 0.177520751953125,
406
+ 10.33355712890625
407
+ ]
408
+ ],
409
+ "mean": [
410
+ [
411
+ 0.017563458532094955,
412
+ -0.0007745116599835455,
413
+ -0.00024147587828338146,
414
+ -0.0025552152656018734,
415
+ -0.00025703050778247416,
416
+ 0.01716936193406582
417
+ ],
418
+ [
419
+ 0.049417026340961456,
420
+ -0.0007738808053545654,
421
+ -0.00024147587828338146,
422
+ -0.0025552152656018734,
423
+ -0.00025577182532288134,
424
+ 0.04987418279051781
425
+ ],
426
+ [
427
+ 0.0781405121088028,
428
+ -0.002619839971885085,
429
+ -0.002080883365124464,
430
+ -0.0007093104650266469,
431
+ -0.00025451311375945807,
432
+ 0.07939272373914719
433
+ ],
434
+ [
435
+ 0.10360169410705566,
436
+ -0.006880330387502909,
437
+ -0.006324384361505508,
438
+ 0.0035387366078794003,
439
+ -0.00025325443129986525,
440
+ 0.10562215745449066
441
+ ],
442
+ [
443
+ 0.12588447332382202,
444
+ -0.013561434112489223,
445
+ -0.012975107878446579,
446
+ 0.010187937878072262,
447
+ -0.0002519957488402724,
448
+ 0.1286352127790451
449
+ ],
450
+ [
451
+ 0.1449972689151764,
452
+ -0.022663138806819916,
453
+ -0.022034015506505966,
454
+ 0.01923746056854725,
455
+ -0.0002507370663806796,
456
+ 0.14845424890518188
457
+ ],
458
+ [
459
+ 0.1610686033964157,
460
+ -0.03418374061584473,
461
+ -0.033500052988529205,
462
+ 0.030688190832734108,
463
+ -0.00024947835481725633,
464
+ 0.16522514820098877
465
+ ],
466
+ [
467
+ 0.17436173558235168,
468
+ -0.04812226817011833,
469
+ -0.04737452417612076,
470
+ 0.044540006667375565,
471
+ -0.0002482196723576635,
472
+ 0.17920301854610443
473
+ ],
474
+ [
475
+ 0.18501678109169006,
476
+ -0.06447844207286835,
477
+ -0.0636560246348381,
478
+ 0.06079335883259773,
479
+ -0.0002469609898980707,
480
+ 0.1905173659324646
481
+ ],
482
+ [
483
+ 0.19314585626125336,
484
+ -0.08324725180864334,
485
+ -0.0823432132601738,
486
+ 0.07944769412279129,
487
+ -0.0002457023074384779,
488
+ 0.19929541647434235
489
+ ],
490
+ [
491
+ 0.19885700941085815,
492
+ -0.10442840307950974,
493
+ -0.10343678295612335,
494
+ 0.10049951076507568,
495
+ -0.00024444362497888505,
496
+ 0.20565716922283173
497
+ ],
498
+ [
499
+ 0.2021627575159073,
500
+ -0.12802045047283173,
501
+ -0.12693294882774353,
502
+ 0.12395504862070084,
503
+ -0.000243184927967377,
504
+ 0.20960263907909393
505
+ ],
506
+ [
507
+ 0.20306000113487244,
508
+ -0.15402059257030487,
509
+ -0.15283238887786865,
510
+ 0.14981186389923096,
511
+ -0.00024192623095586896,
512
+ 0.21115879714488983
513
+ ],
514
+ [
515
+ 0.201552614569664,
516
+ -0.18242709338665009,
517
+ -0.181138277053833,
518
+ 0.17807936668395996,
519
+ -0.00024066754849627614,
520
+ 0.21031096577644348
521
+ ],
522
+ [
523
+ 0.1976405680179596,
524
+ -0.21322979032993317,
525
+ -0.2117607146501541,
526
+ 0.20874834060668945,
527
+ -0.0002394088514847681,
528
+ 0.20704428851604462
529
+ ],
530
+ [
531
+ 0.19316567480564117,
532
+ -0.2462776005268097,
533
+ -0.2445387989282608,
534
+ 0.24181991815567017,
535
+ -0.00023815016902517527,
536
+ 0.20234234631061554
537
+ ]
538
+ ],
539
+ "std": [
540
+ [
541
+ 0.1927369385957718,
542
+ 0.16475534439086914,
543
+ 0.12267962843179703,
544
+ 0.22130374610424042,
545
+ 0.02982749603688717,
546
+ 0.19272559881210327
547
+ ],
548
+ [
549
+ 0.5763731002807617,
550
+ 0.4931168854236603,
551
+ 0.363586962223053,
552
+ 0.6126241087913513,
553
+ 0.022323807701468468,
554
+ 0.5758746862411499
555
+ ],
556
+ [
557
+ 0.9591054320335388,
558
+ 0.8134579658508301,
559
+ 0.5973342657089233,
560
+ 1.004992961883545,
561
+ 0.028005259111523628,
562
+ 0.958050549030304
563
+ ],
564
+ [
565
+ 1.3400073051452637,
566
+ 1.124655842781067,
567
+ 0.822861909866333,
568
+ 1.3925635814666748,
569
+ 0.029515234753489494,
570
+ 1.3384379148483276
571
+ ],
572
+ [
573
+ 1.7202503681182861,
574
+ 1.426303744316101,
575
+ 1.039721965789795,
576
+ 1.7743152379989624,
577
+ 0.028534606099128723,
578
+ 1.7182751893997192
579
+ ],
580
+ [
581
+ 2.099561929702759,
582
+ 1.7181326150894165,
583
+ 1.2475587129592896,
584
+ 2.1498425006866455,
585
+ 0.03016386367380619,
586
+ 2.097123861312866
587
+ ],
588
+ [
589
+ 2.479346752166748,
590
+ 1.9998877048492432,
591
+ 1.446136236190796,
592
+ 2.5190212726593018,
593
+ 0.03145182877779007,
594
+ 2.4765260219573975
595
+ ],
596
+ [
597
+ 2.858341693878174,
598
+ 2.2713615894317627,
599
+ 1.6356769800186157,
600
+ 2.8816592693328857,
601
+ 0.03210904076695442,
602
+ 2.8549203872680664
603
+ ],
604
+ [
605
+ 3.237518787384033,
606
+ 2.532468318939209,
607
+ 1.8165247440338135,
608
+ 3.2376115322113037,
609
+ 0.033071618527173996,
610
+ 3.233898401260376
611
+ ],
612
+ [
613
+ 3.617147922515869,
614
+ 2.7828636169433594,
615
+ 1.987851619720459,
616
+ 3.5868680477142334,
617
+ 0.03395386040210724,
618
+ 3.6130433082580566
619
+ ],
620
+ [
621
+ 3.9971232414245605,
622
+ 3.0229735374450684,
623
+ 2.1511051654815674,
624
+ 3.9293532371520996,
625
+ 0.03488593176007271,
626
+ 3.9923572540283203
627
+ ],
628
+ [
629
+ 4.377017974853516,
630
+ 3.2535548210144043,
631
+ 2.304555892944336,
632
+ 4.2653913497924805,
633
+ 0.03579387441277504,
634
+ 4.371703147888184
635
+ ],
636
+ [
637
+ 4.756685256958008,
638
+ 3.4732558727264404,
639
+ 2.448528289794922,
640
+ 4.595556735992432,
641
+ 0.03667939081788063,
642
+ 4.750643253326416
643
+ ],
644
+ [
645
+ 5.136702060699463,
646
+ 3.6848437786102295,
647
+ 2.583000421524048,
648
+ 4.920444965362549,
649
+ 0.03754409775137901,
650
+ 5.130343437194824
651
+ ],
652
+ [
653
+ 5.516831398010254,
654
+ 3.8865880966186523,
655
+ 2.707683563232422,
656
+ 5.238101005554199,
657
+ 0.03838953375816345,
658
+ 5.51028299331665
659
+ ],
660
+ [
661
+ 5.8940043449401855,
662
+ 4.0803632736206055,
663
+ 2.8238182067871094,
664
+ 5.550077438354492,
665
+ 0.03921635448932648,
666
+ 5.888287544250488
667
+ ]
668
+ ],
669
+ "q01": [
670
+ [
671
+ -0.33333587646484375,
672
+ -0.33333587646484375,
673
+ -0.33333587646484375,
674
+ -0.3627943420410156,
675
+ -0.11291549682617187,
676
+ -0.33333587646484375
677
+ ],
678
+ [
679
+ -1.0051040649414062,
680
+ -0.9939041137695312,
681
+ -1.0003662109375,
682
+ -1.0274227905273436,
683
+ -0.08977508544921875,
684
+ -1.0
685
+ ],
686
+ [
687
+ -1.6768646240234375,
688
+ -1.6542129516601562,
689
+ -1.6670989990234375,
690
+ -1.6969479370117186,
691
+ -0.10626564025878905,
692
+ -1.6666641235351562
693
+ ],
694
+ [
695
+ -2.3527603149414062,
696
+ -2.314544677734375,
697
+ -2.3336643981933594,
698
+ -2.358081512451172,
699
+ -0.11114616394042968,
700
+ -2.3333206176757812
701
+ ],
702
+ [
703
+ -3.0245361328125,
704
+ -2.9745941162109375,
705
+ -3.000114669799805,
706
+ -3.0102670288085935,
707
+ -0.11000221252441406,
708
+ -2.999969482421875
709
+ ],
710
+ [
711
+ -3.6961443328857424,
712
+ -3.63446044921875,
713
+ -3.6663970947265625,
714
+ -3.67529296875,
715
+ -0.11250740051269531,
716
+ -3.6666336059570312
717
+ ],
718
+ [
719
+ -4.367683410644531,
720
+ -4.29400634765625,
721
+ -4.332451095581055,
722
+ -4.341423034667969,
723
+ -0.11609695434570312,
724
+ -4.3332977294921875
725
+ ],
726
+ [
727
+ -5.039024353027344,
728
+ -4.9538421630859375,
729
+ -4.9983062744140625,
730
+ -5.0077362060546875,
731
+ -0.11707374572753906,
732
+ -4.9999542236328125
733
+ ],
734
+ [
735
+ -5.710334777832031,
736
+ -5.613594055175781,
737
+ -5.663909912109375,
738
+ -5.674308776855469,
739
+ -0.1184058380126953,
740
+ -5.6666107177734375
741
+ ],
742
+ [
743
+ -6.3816680908203125,
744
+ -6.273292541503906,
745
+ -6.205591278076172,
746
+ -6.341003646850586,
747
+ -0.12022422790527344,
748
+ -6.3332672119140625
749
+ ],
750
+ [
751
+ -7.052825927734375,
752
+ -6.93292236328125,
753
+ -6.527348175048828,
754
+ -7.007782669067383,
755
+ -0.12160606384277343,
756
+ -6.9999237060546875
757
+ ],
758
+ [
759
+ -7.723884582519531,
760
+ -7.5924835205078125,
761
+ -6.988225708007812,
762
+ -7.674904098510742,
763
+ -0.12289474487304687,
764
+ -7.6665802001953125
765
+ ],
766
+ [
767
+ -8.394752731323242,
768
+ -8.251983642578125,
769
+ -7.252942352294922,
770
+ -8.341934432983399,
771
+ -0.1239947509765625,
772
+ -8.333244323730469
773
+ ],
774
+ [
775
+ -9.065445175170899,
776
+ -8.911422729492188,
777
+ -7.6605093383789065,
778
+ -9.009048690795899,
779
+ -0.1254681396484375,
780
+ -8.999900817871094
781
+ ],
782
+ [
783
+ -9.735931396484375,
784
+ -9.570762634277344,
785
+ -8.122162246704102,
786
+ -9.675994873046875,
787
+ -0.12700950622558593,
788
+ -9.66656494140625
789
+ ],
790
+ [
791
+ -10.406219482421875,
792
+ -10.230117797851562,
793
+ -8.372242584228516,
794
+ -10.342903137207031,
795
+ -0.1281067657470703,
796
+ -10.333213806152344
797
+ ]
798
+ ],
799
+ "q99": [
800
+ [
801
+ 0.33333587646484375,
802
+ 0.33333587646484375,
803
+ 0.33333587646484375,
804
+ 0.3562020874023437,
805
+ 0.11016891479492186,
806
+ 0.33333587646484375
807
+ ],
808
+ [
809
+ 1.0000228881835938,
810
+ 1.004486083984375,
811
+ 1.001190185546875,
812
+ 1.0253605651855469,
813
+ 0.08598579406738271,
814
+ 1.0
815
+ ],
816
+ [
817
+ 1.6666641235351562,
818
+ 1.675262451171875,
819
+ 1.6688385009765625,
820
+ 1.6978773498535156,
821
+ 0.1044704437255859,
822
+ 1.666656494140625
823
+ ],
824
+ [
825
+ 2.3331072235107424,
826
+ 2.3457412719726562,
827
+ 2.3362884521484375,
828
+ 2.361202239990234,
829
+ 0.10615768432617179,
830
+ 2.33331298828125
831
+ ],
832
+ [
833
+ 2.99947380065918,
834
+ 3.0157930755615237,
835
+ 3.0036468505859375,
836
+ 3.01007080078125,
837
+ 0.10431831359863275,
838
+ 2.999969482421875
839
+ ],
840
+ [
841
+ 3.665679931640625,
842
+ 3.6858291625976562,
843
+ 3.6710357666015625,
844
+ 3.6778793334960938,
845
+ 0.10748336791992186,
846
+ 3.6666183471679688
847
+ ],
848
+ [
849
+ 4.331390838623047,
850
+ 4.355224609375,
851
+ 4.33824203491211,
852
+ 4.345794677734375,
853
+ 0.10840629577636718,
854
+ 4.3332672119140625
855
+ ],
856
+ [
857
+ 4.996635665893555,
858
+ 5.023857574462891,
859
+ 5.00537109375,
860
+ 5.013740539550781,
861
+ 0.11093162536621093,
862
+ 4.9999237060546875
863
+ ],
864
+ [
865
+ 5.66143798828125,
866
+ 5.69189453125,
867
+ 5.672355651855469,
868
+ 5.68157958984375,
869
+ 0.11253540039062493,
870
+ 5.666572570800781
871
+ ],
872
+ [
873
+ 6.3259053039550786,
874
+ 6.359248275756836,
875
+ 6.339127044677735,
876
+ 6.349365234375,
877
+ 0.11400741577148432,
878
+ 6.333221435546875
879
+ ],
880
+ [
881
+ 6.990143737792969,
882
+ 7.025950775146484,
883
+ 7.005851745605469,
884
+ 7.01715087890625,
885
+ 0.1147308349609375,
886
+ 6.9998779296875
887
+ ],
888
+ [
889
+ 7.654167861938476,
890
+ 7.692070236206055,
891
+ 7.671982040405274,
892
+ 7.684898376464844,
893
+ 0.11598991394042968,
894
+ 7.666526794433594
895
+ ],
896
+ [
897
+ 8.317773513793945,
898
+ 8.355377197265625,
899
+ 8.337784042358399,
900
+ 8.352699279785156,
901
+ 0.11663078308105468,
902
+ 8.333175659179688
903
+ ],
904
+ [
905
+ 8.981483688354492,
906
+ 9.016597366333007,
907
+ 9.001999130249024,
908
+ 9.020492553710938,
909
+ 0.11754631042480468,
910
+ 8.999832153320312
911
+ ],
912
+ [
913
+ 9.644996871948242,
914
+ 9.676035308837891,
915
+ 9.661668472290039,
916
+ 9.688179016113281,
917
+ 0.11818832397460932,
918
+ 9.666481018066406
919
+ ],
920
+ [
921
+ 10.308242797851562,
922
+ 10.326130676269532,
923
+ 10.170925064086912,
924
+ 10.355789184570312,
925
+ 0.11917922973632811,
926
+ 10.333122253417969
927
+ ]
928
+ ]
929
+ }
930
+ }
931
+ }
932
+ }
checkpoint-100000/experiment_cfg/final_model_config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "Gr00tN1d6",
3
+ "model_dtype": "bfloat16",
4
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
5
+ "backbone_model_type": "eagle",
6
+ "model_revision": null,
7
+ "tune_top_llm_layers": 4,
8
+ "backbone_embedding_dim": 2048,
9
+ "tune_llm": false,
10
+ "tune_visual": false,
11
+ "select_layer": 16,
12
+ "reproject_vision": false,
13
+ "use_flash_attention": true,
14
+ "load_bf16": true,
15
+ "collator_overwrite_image_inputs": false,
16
+ "eagle_collator": true,
17
+ "backbone_trainable_params_fp32": true,
18
+ "apply_sincos_state_encoding": true,
19
+ "use_relative_action": true,
20
+ "max_state_dim": 128,
21
+ "max_action_dim": 128,
22
+ "action_horizon": 50,
23
+ "hidden_size": 1024,
24
+ "input_embedding_dim": 1536,
25
+ "add_pos_embed": true,
26
+ "attn_dropout": 0.2,
27
+ "use_vlln": true,
28
+ "max_seq_len": 1024,
29
+ "use_alternate_vl_dit": true,
30
+ "attend_text_every_n_blocks": 2,
31
+ "diffusion_model_cfg": {
32
+ "attention_head_dim": 48,
33
+ "dropout": 0.2,
34
+ "final_dropout": true,
35
+ "interleave_self_attention": true,
36
+ "norm_type": "ada_norm",
37
+ "num_attention_heads": 32,
38
+ "num_layers": 32,
39
+ "output_dim": 1024,
40
+ "positional_embeddings": null
41
+ },
42
+ "num_inference_timesteps": 4,
43
+ "noise_beta_alpha": 1.5,
44
+ "noise_beta_beta": 1.0,
45
+ "noise_s": 0.999,
46
+ "num_timestep_buckets": 1000,
47
+ "tune_projector": true,
48
+ "tune_diffusion_model": false,
49
+ "tune_vlln": true,
50
+ "state_dropout_prob": 0.0,
51
+ "state_additive_noise_scale": 0.0,
52
+ "max_num_embodiments": 32
53
+ }
checkpoint-100000/experiment_cfg/final_processor_config.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100000/global_step100000/bf16_zero_pp_rank_0_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d31477b03095c5715245c4d78bb731e9c6b6856470b09c10d7041e917a9bfe3
3
+ size 6338960625
checkpoint-100000/global_step100000/mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36e52c0133179b5c08c8930a5613474029cba9a003af4f33fd4cabcdc5359c41
3
+ size 12090888591
checkpoint-100000/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step100000
checkpoint-100000/model-00001-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc76f9013c690d3b17796fd6ff9c15cb0ddd915a0102960650439a6f0de0dc02
3
+ size 4991091456
checkpoint-100000/model-00002-of-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb27a673157bb386d49d373508b3bfa92837426fb4dfffde92ea35f34e16492d
3
+ size 1582283096
checkpoint-100000/model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100000/processor_config.json ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "Gr00tN1d6Processor",
3
+ "processor_kwargs": {
4
+ "modality_configs": {
5
+ "behavior_r1_pro": {
6
+ "video": {
7
+ "delta_indices": [
8
+ 0
9
+ ],
10
+ "modality_keys": [
11
+ "observation.images.rgb.head_256_256",
12
+ "observation.images.rgb.left_wrist_256_256",
13
+ "observation.images.rgb.right_wrist_256_256"
14
+ ],
15
+ "sin_cos_embedding_keys": null,
16
+ "mean_std_embedding_keys": null,
17
+ "action_configs": null
18
+ },
19
+ "state": {
20
+ "delta_indices": [
21
+ 0
22
+ ],
23
+ "modality_keys": [
24
+ "robot_pos",
25
+ "robot_ori_cos",
26
+ "robot_ori_sin",
27
+ "robot_2d_ori",
28
+ "robot_2d_ori_cos",
29
+ "robot_2d_ori_sin",
30
+ "robot_lin_vel",
31
+ "robot_ang_vel",
32
+ "arm_left_qpos",
33
+ "arm_left_qpos_sin",
34
+ "arm_left_qpos_cos",
35
+ "eef_left_pos",
36
+ "eef_left_quat",
37
+ "gripper_left_qpos",
38
+ "arm_right_qpos",
39
+ "arm_right_qpos_sin",
40
+ "arm_right_qpos_cos",
41
+ "eef_right_pos",
42
+ "eef_right_quat",
43
+ "gripper_right_qpos",
44
+ "trunk_qpos"
45
+ ],
46
+ "sin_cos_embedding_keys": null,
47
+ "mean_std_embedding_keys": null,
48
+ "action_configs": null
49
+ },
50
+ "action": {
51
+ "delta_indices": [
52
+ 0,
53
+ 1,
54
+ 2,
55
+ 3,
56
+ 4,
57
+ 5,
58
+ 6,
59
+ 7,
60
+ 8,
61
+ 9,
62
+ 10,
63
+ 11,
64
+ 12,
65
+ 13,
66
+ 14,
67
+ 15,
68
+ 16,
69
+ 17,
70
+ 18,
71
+ 19,
72
+ 20,
73
+ 21,
74
+ 22,
75
+ 23,
76
+ 24,
77
+ 25,
78
+ 26,
79
+ 27,
80
+ 28,
81
+ 29,
82
+ 30,
83
+ 31
84
+ ],
85
+ "modality_keys": [
86
+ "base",
87
+ "torso",
88
+ "left_arm",
89
+ "left_gripper",
90
+ "right_arm",
91
+ "right_gripper"
92
+ ],
93
+ "sin_cos_embedding_keys": null,
94
+ "mean_std_embedding_keys": null,
95
+ "action_configs": [
96
+ {
97
+ "rep": "ABSOLUTE",
98
+ "type": "NON_EEF",
99
+ "format": "DEFAULT",
100
+ "state_key": null
101
+ },
102
+ {
103
+ "rep": "RELATIVE",
104
+ "type": "NON_EEF",
105
+ "format": "DEFAULT",
106
+ "state_key": "trunk_qpos"
107
+ },
108
+ {
109
+ "rep": "RELATIVE",
110
+ "type": "NON_EEF",
111
+ "format": "DEFAULT",
112
+ "state_key": "arm_left_qpos"
113
+ },
114
+ {
115
+ "rep": "ABSOLUTE",
116
+ "type": "NON_EEF",
117
+ "format": "DEFAULT",
118
+ "state_key": null
119
+ },
120
+ {
121
+ "rep": "RELATIVE",
122
+ "type": "NON_EEF",
123
+ "format": "DEFAULT",
124
+ "state_key": "arm_right_qpos"
125
+ },
126
+ {
127
+ "rep": "ABSOLUTE",
128
+ "type": "NON_EEF",
129
+ "format": "DEFAULT",
130
+ "state_key": null
131
+ }
132
+ ]
133
+ },
134
+ "language": {
135
+ "delta_indices": [
136
+ 0
137
+ ],
138
+ "modality_keys": [
139
+ "annotation.human.coarse_action"
140
+ ],
141
+ "sin_cos_embedding_keys": null,
142
+ "mean_std_embedding_keys": null,
143
+ "action_configs": null
144
+ }
145
+ },
146
+ "gr1": {
147
+ "video": {
148
+ "delta_indices": [
149
+ 0
150
+ ],
151
+ "modality_keys": [
152
+ "ego_view_bg_crop_pad_res256_freq20"
153
+ ],
154
+ "sin_cos_embedding_keys": null,
155
+ "mean_std_embedding_keys": null,
156
+ "action_configs": null
157
+ },
158
+ "state": {
159
+ "delta_indices": [
160
+ 0
161
+ ],
162
+ "modality_keys": [
163
+ "left_arm",
164
+ "right_arm",
165
+ "left_hand",
166
+ "right_hand",
167
+ "waist"
168
+ ],
169
+ "sin_cos_embedding_keys": [
170
+ "left_arm",
171
+ "right_arm",
172
+ "left_hand",
173
+ "right_hand",
174
+ "waist"
175
+ ],
176
+ "mean_std_embedding_keys": null,
177
+ "action_configs": null
178
+ },
179
+ "action": {
180
+ "delta_indices": [
181
+ 0,
182
+ 1,
183
+ 2,
184
+ 3,
185
+ 4,
186
+ 5,
187
+ 6,
188
+ 7,
189
+ 8,
190
+ 9,
191
+ 10,
192
+ 11,
193
+ 12,
194
+ 13,
195
+ 14,
196
+ 15
197
+ ],
198
+ "modality_keys": [
199
+ "left_arm",
200
+ "right_arm",
201
+ "left_hand",
202
+ "right_hand",
203
+ "waist"
204
+ ],
205
+ "sin_cos_embedding_keys": null,
206
+ "mean_std_embedding_keys": null,
207
+ "action_configs": [
208
+ {
209
+ "rep": "RELATIVE",
210
+ "type": "NON_EEF",
211
+ "format": "DEFAULT",
212
+ "state_key": null
213
+ },
214
+ {
215
+ "rep": "RELATIVE",
216
+ "type": "NON_EEF",
217
+ "format": "DEFAULT",
218
+ "state_key": null
219
+ },
220
+ {
221
+ "rep": "RELATIVE",
222
+ "type": "NON_EEF",
223
+ "format": "DEFAULT",
224
+ "state_key": null
225
+ },
226
+ {
227
+ "rep": "RELATIVE",
228
+ "type": "NON_EEF",
229
+ "format": "DEFAULT",
230
+ "state_key": null
231
+ },
232
+ {
233
+ "rep": "ABSOLUTE",
234
+ "type": "NON_EEF",
235
+ "format": "DEFAULT",
236
+ "state_key": null
237
+ }
238
+ ]
239
+ },
240
+ "language": {
241
+ "delta_indices": [
242
+ 0
243
+ ],
244
+ "modality_keys": [
245
+ "task"
246
+ ],
247
+ "sin_cos_embedding_keys": null,
248
+ "mean_std_embedding_keys": null,
249
+ "action_configs": null
250
+ }
251
+ },
252
+ "robocasa_panda_omron": {
253
+ "video": {
254
+ "delta_indices": [
255
+ 0
256
+ ],
257
+ "modality_keys": [
258
+ "res256_image_side_0",
259
+ "res256_image_side_1",
260
+ "res256_image_wrist_0"
261
+ ],
262
+ "sin_cos_embedding_keys": null,
263
+ "mean_std_embedding_keys": null,
264
+ "action_configs": null
265
+ },
266
+ "state": {
267
+ "delta_indices": [
268
+ 0
269
+ ],
270
+ "modality_keys": [
271
+ "end_effector_position_relative",
272
+ "end_effector_rotation_relative",
273
+ "gripper_qpos",
274
+ "base_position",
275
+ "base_rotation"
276
+ ],
277
+ "sin_cos_embedding_keys": null,
278
+ "mean_std_embedding_keys": null,
279
+ "action_configs": null
280
+ },
281
+ "action": {
282
+ "delta_indices": [
283
+ 0,
284
+ 1,
285
+ 2,
286
+ 3,
287
+ 4,
288
+ 5,
289
+ 6,
290
+ 7,
291
+ 8,
292
+ 9,
293
+ 10,
294
+ 11,
295
+ 12,
296
+ 13,
297
+ 14,
298
+ 15
299
+ ],
300
+ "modality_keys": [
301
+ "end_effector_position",
302
+ "end_effector_rotation",
303
+ "gripper_close",
304
+ "base_motion",
305
+ "control_mode"
306
+ ],
307
+ "sin_cos_embedding_keys": null,
308
+ "mean_std_embedding_keys": null,
309
+ "action_configs": [
310
+ {
311
+ "rep": "ABSOLUTE",
312
+ "type": "NON_EEF",
313
+ "format": "DEFAULT",
314
+ "state_key": null
315
+ },
316
+ {
317
+ "rep": "ABSOLUTE",
318
+ "type": "NON_EEF",
319
+ "format": "DEFAULT",
320
+ "state_key": null
321
+ },
322
+ {
323
+ "rep": "ABSOLUTE",
324
+ "type": "NON_EEF",
325
+ "format": "DEFAULT",
326
+ "state_key": null
327
+ },
328
+ {
329
+ "rep": "ABSOLUTE",
330
+ "type": "NON_EEF",
331
+ "format": "DEFAULT",
332
+ "state_key": null
333
+ },
334
+ {
335
+ "rep": "ABSOLUTE",
336
+ "type": "NON_EEF",
337
+ "format": "DEFAULT",
338
+ "state_key": null
339
+ }
340
+ ]
341
+ },
342
+ "language": {
343
+ "delta_indices": [
344
+ 0
345
+ ],
346
+ "modality_keys": [
347
+ "annotation.human.action.task_description"
348
+ ],
349
+ "sin_cos_embedding_keys": null,
350
+ "mean_std_embedding_keys": null,
351
+ "action_configs": null
352
+ }
353
+ },
354
+ "new_embodiment": {
355
+ "video": {
356
+ "delta_indices": [
357
+ 0
358
+ ],
359
+ "modality_keys": [
360
+ "front",
361
+ "wrist"
362
+ ],
363
+ "sin_cos_embedding_keys": null,
364
+ "mean_std_embedding_keys": null,
365
+ "action_configs": null
366
+ },
367
+ "state": {
368
+ "delta_indices": [
369
+ 0
370
+ ],
371
+ "modality_keys": [
372
+ "single_arm",
373
+ "gripper"
374
+ ],
375
+ "sin_cos_embedding_keys": null,
376
+ "mean_std_embedding_keys": null,
377
+ "action_configs": null
378
+ },
379
+ "action": {
380
+ "delta_indices": [
381
+ 0,
382
+ 1,
383
+ 2,
384
+ 3,
385
+ 4,
386
+ 5,
387
+ 6,
388
+ 7,
389
+ 8,
390
+ 9,
391
+ 10,
392
+ 11,
393
+ 12,
394
+ 13,
395
+ 14,
396
+ 15
397
+ ],
398
+ "modality_keys": [
399
+ "single_arm",
400
+ "gripper"
401
+ ],
402
+ "sin_cos_embedding_keys": null,
403
+ "mean_std_embedding_keys": null,
404
+ "action_configs": [
405
+ {
406
+ "rep": "RELATIVE",
407
+ "type": "NON_EEF",
408
+ "format": "DEFAULT",
409
+ "state_key": null
410
+ },
411
+ {
412
+ "rep": "ABSOLUTE",
413
+ "type": "NON_EEF",
414
+ "format": "DEFAULT",
415
+ "state_key": null
416
+ }
417
+ ]
418
+ },
419
+ "language": {
420
+ "delta_indices": [
421
+ 0
422
+ ],
423
+ "modality_keys": [
424
+ "annotation.human.task_description"
425
+ ],
426
+ "sin_cos_embedding_keys": null,
427
+ "mean_std_embedding_keys": null,
428
+ "action_configs": null
429
+ }
430
+ }
431
+ },
432
+ "image_crop_size": null,
433
+ "image_target_size": null,
434
+ "use_albumentations": true,
435
+ "random_rotation_angle": null,
436
+ "color_jitter_params": {
437
+ "brightness": 0.3,
438
+ "contrast": 0.4,
439
+ "saturation": 0.5,
440
+ "hue": 0.08
441
+ },
442
+ "shortest_image_edge": 256,
443
+ "crop_fraction": 0.95,
444
+ "model_name": "nvidia/Eagle-Block2A-2B-v2",
445
+ "model_type": "eagle",
446
+ "formalize_language": true,
447
+ "max_state_dim": 128,
448
+ "max_action_dim": 128,
449
+ "max_action_horizon": 50,
450
+ "use_percentiles": false,
451
+ "clip_outliers": true,
452
+ "apply_sincos_state_encoding": true,
453
+ "use_relative_action": true
454
+ }
455
+ }
checkpoint-100000/rng_state.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17a7b3b3751f6dac3c2fe1fe557e166db423985984f9ec326f8d782d973ca0d0
3
+ size 14645
checkpoint-100000/scheduler.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0adcd884f504218477ba4e8d6c172d1621334843f166d925140146f37d9592b
3
+ size 1465
checkpoint-100000/statistics.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100000/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
checkpoint-100000/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0e0498788715b6fb2623751b1358fb5ff0f049893876a11e4c5e830e4e51f4f
3
+ size 7633
checkpoint-100000/wandb_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"project": "finetune-gr00t-n1d6", "run_id": "ur5e_finetune"}
checkpoint-100000/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)