hmkang commited on
Commit
a89808d
·
verified ·
1 Parent(s): 641edb2

avg_L3/checkpoint-40000

Browse files
avg_L3/checkpoint-40000/config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "",
3
+ "action_dit_size": "DiT-B",
4
+ "action_future_slots": null,
5
+ "action_head_model_type": "dit",
6
+ "action_horizon": 16,
7
+ "action_loss_weight": 1.0,
8
+ "action_text_kv": false,
9
+ "add_cross_attention": false,
10
+ "add_pos_embed": true,
11
+ "apply_sincos_state_encoding": false,
12
+ "architectures": [
13
+ "WAMDiT4DiT"
14
+ ],
15
+ "attn_dropout": 0.2,
16
+ "backbone_embedding_dim": 3072,
17
+ "backbone_trainable_params_fp32": true,
18
+ "backbone_type": "wan22_diffusers",
19
+ "bad_words_ids": null,
20
+ "begin_suppress_tokens": null,
21
+ "bos_token_id": null,
22
+ "chunk_size_feed_forward": 0,
23
+ "color_jitter_params": null,
24
+ "conditional_frame_timestep": 0.0001,
25
+ "cosmos_model_path": "nvidia/Cosmos-Predict2.5-2B",
26
+ "cosmos_model_revision": "diffusers/base/pre-trained",
27
+ "crop_fraction": 0.95,
28
+ "cross_attention_hidden_size": null,
29
+ "decoder_start_token_id": null,
30
+ "diffusion_model_cfg": {
31
+ "attention_head_dim": 64,
32
+ "dropout": 0.2,
33
+ "final_dropout": true,
34
+ "interleave_self_attention": true,
35
+ "norm_type": "ada_norm",
36
+ "num_attention_heads": 12,
37
+ "num_layers": 16,
38
+ "output_dim": 2560,
39
+ "positional_embeddings": null
40
+ },
41
+ "diversity_penalty": 0.0,
42
+ "do_sample": false,
43
+ "dtype": "bfloat16",
44
+ "early_stopping": false,
45
+ "encoder_no_repeat_ngram_size": 0,
46
+ "eos_token_id": null,
47
+ "exponential_decay_length_penalty": null,
48
+ "fadistill_target_tau": 1.0,
49
+ "fadistill_teacher_nstep": 4,
50
+ "fadistill_teacher_traj": true,
51
+ "feature_extraction_aggregate_all": false,
52
+ "feature_extraction_aggregate_layer_window": 0,
53
+ "feature_extraction_layer": 18,
54
+ "finetuning_task": null,
55
+ "fm_high_sigma_min": 0.98,
56
+ "fm_high_sigma_ratio": null,
57
+ "fm_loss_weight": 1.0,
58
+ "fm_time_distribution": "uniform",
59
+ "forced_bos_token_id": null,
60
+ "forced_eos_token_id": null,
61
+ "formalize_language": true,
62
+ "frame_downsample_factor": 2,
63
+ "freeze_modules_pattern": "text_encoder,vae",
64
+ "freeze_step_weight_predictor": false,
65
+ "freeze_whole_backbone": false,
66
+ "future_loss_type": "flow_matching",
67
+ "future_num_inference_steps": 1,
68
+ "hidden_size": 2560,
69
+ "history_num_clean_frames": 1,
70
+ "history_obs_noise_timestep": 0.0,
71
+ "id2label": {
72
+ "0": "LABEL_0",
73
+ "1": "LABEL_1"
74
+ },
75
+ "image_crop_size": null,
76
+ "image_resize_backend": "cv2_linear",
77
+ "image_target_size": null,
78
+ "input_embedding_dim": 768,
79
+ "is_decoder": false,
80
+ "is_encoder_decoder": false,
81
+ "label2id": {
82
+ "LABEL_0": 0,
83
+ "LABEL_1": 1
84
+ },
85
+ "length_penalty": 1.0,
86
+ "load_bf16": true,
87
+ "max_action_dim": 32,
88
+ "max_length": 20,
89
+ "max_num_embodiments": 36,
90
+ "max_seq_len": 1024,
91
+ "max_state_dim": 64,
92
+ "meta_queries_mode": "meta_only",
93
+ "min_length": 0,
94
+ "model_dtype": "bfloat16",
95
+ "model_type": "WAM_DIT4DIT",
96
+ "multiview_layout": "tmosaic",
97
+ "n_meta_queries": 8,
98
+ "n_tune_layers_below_feature_extraction": 0,
99
+ "new_embodiment_train_ratio": 0,
100
+ "no_repeat_ngram_size": 0,
101
+ "noise_beta_alpha": 1.5,
102
+ "noise_beta_beta": 1.0,
103
+ "noise_s": 0.999,
104
+ "nstep_agg": false,
105
+ "nstep_agg_layers": 4,
106
+ "nstep_base_residual": false,
107
+ "nstep_base_residual_gate": "layerscale",
108
+ "nstep_certainty_arch": "mlp",
109
+ "nstep_certainty_ckpt": "",
110
+ "nstep_certainty_decalib": false,
111
+ "nstep_certainty_drop_cond": false,
112
+ "nstep_certainty_fusion": false,
113
+ "nstep_certainty_hidden": 1024,
114
+ "nstep_certainty_layers": 2,
115
+ "nstep_certainty_step_bias": false,
116
+ "nstep_certainty_tau": 1.0,
117
+ "nstep_compress_k": 64,
118
+ "nstep_compress_n_frame": 3,
119
+ "nstep_compress_query": false,
120
+ "nstep_latent_cond": false,
121
+ "nstep_n": 2,
122
+ "nstep_noise_ensemble": false,
123
+ "nstep_per_step_gated": false,
124
+ "nstep_query_len": 588,
125
+ "nstep_readout_exclude_step0": false,
126
+ "nstep_residual_warmup": false,
127
+ "nstep_residual_warmup_full": 20000,
128
+ "nstep_residual_warmup_start": 10000,
129
+ "nstep_step_dropout": false,
130
+ "nstep_step_embed": true,
131
+ "nstep_train_integration": false,
132
+ "num_beam_groups": 1,
133
+ "num_beams": 1,
134
+ "num_frames_in": 25,
135
+ "num_frames_out": 41,
136
+ "num_inference_timesteps": 4,
137
+ "num_return_sequences": 1,
138
+ "num_timestep_buckets": 1000,
139
+ "output_attentions": false,
140
+ "output_hidden_states": false,
141
+ "output_scores": false,
142
+ "pad_token_id": null,
143
+ "prefix": null,
144
+ "problem_type": null,
145
+ "pruned_heads": {},
146
+ "random_rotation_angle": null,
147
+ "remove_invalid_values": false,
148
+ "repeated_diffusion_steps": 4,
149
+ "repetition_penalty": 1.0,
150
+ "reproject_vision": false,
151
+ "return_dict": true,
152
+ "return_dict_in_generate": false,
153
+ "selfflow_ema_decay": 0.9999,
154
+ "selfflow_mask_ratio": 0.1,
155
+ "selfflow_rep": true,
156
+ "selfflow_rep_layer": -1,
157
+ "selfflow_rep_layer_student": -1,
158
+ "selfflow_rep_layer_teacher": -1,
159
+ "selfflow_rep_weight": 0.8,
160
+ "selfflow_teacher_noise": 0.0,
161
+ "sep_token_id": null,
162
+ "shortest_image_edge": null,
163
+ "state_additive_noise_scale": 0.0,
164
+ "state_dropout_prob": 0.0,
165
+ "step_weight_exclude_current_tokens": false,
166
+ "step_weight_predictor_ckpt": "",
167
+ "step_weight_predictor_heads": 16,
168
+ "step_weight_predictor_layers": 4,
169
+ "step_weight_sigmas": "0.995,0.9631,0.594,0.0099",
170
+ "step_weight_target_tau": 0.7,
171
+ "suppress_tokens": null,
172
+ "task_specific_params": null,
173
+ "temperature": 1.0,
174
+ "tf_legacy_loss": false,
175
+ "tie_encoder_decoder": false,
176
+ "tie_word_embeddings": true,
177
+ "tokenizer_class": null,
178
+ "top_k": 50,
179
+ "top_p": 1.0,
180
+ "torchscript": false,
181
+ "training_mode": "joint",
182
+ "transformers_version": "4.57.0",
183
+ "truncate_above_feature_extraction": false,
184
+ "tune_crossattn_proj": false,
185
+ "tune_diffusion_model": true,
186
+ "tune_layers_above_feature_extraction": true,
187
+ "tune_llm": false,
188
+ "tune_patch_embed": false,
189
+ "tune_projector": true,
190
+ "tune_time_embed": false,
191
+ "tune_top_llm_layers": 4,
192
+ "tune_vgln": true,
193
+ "tune_visual": false,
194
+ "typical_p": 1.0,
195
+ "use_albumentations_transforms": true,
196
+ "use_bfloat16": false,
197
+ "use_meta_queries": false,
198
+ "use_meta_queries_in_fm": false,
199
+ "use_noise_frames_in_extraction": true,
200
+ "use_percentiles": false,
201
+ "use_relative_action": true,
202
+ "use_step_weight_fusion": false,
203
+ "use_vgln": false,
204
+ "use_vlm_meta": false,
205
+ "video_context_exceeds_action_horizon": false,
206
+ "video_resolution": 256,
207
+ "video_train_crop": false,
208
+ "vl_adapter_num_layers": 0,
209
+ "wan_block_causal": false,
210
+ "wan_context_pool": "avg",
211
+ "wan_context_pool_layer": 3,
212
+ "wan_context_pool_n_cond_lat": 4,
213
+ "wan_context_pool_xattn_ffn_dim": 0,
214
+ "wan_context_pool_xattn_heads": 0,
215
+ "wan_diffusers_model_path": "Wan-AI/Wan2.2-TI2V-5B-Diffusers",
216
+ "wan_fadistill_action_from_teacher": false,
217
+ "wan_fadistill_align_weight": 0.01,
218
+ "wan_fadistill_single_step_index": -1,
219
+ "wan_fadistill_teacher_shift": 5.0,
220
+ "wan_fadistill_teacher_stepper": "euler",
221
+ "wan_feature_extraction_layer": 18,
222
+ "wan_fm_train_shift": 5.0,
223
+ "wan_learnable_token": false,
224
+ "wan_learnable_token_count": 64,
225
+ "wan_learnable_token_layers": 2,
226
+ "wan_learnable_token_queries": 192,
227
+ "wan_model_path": "Wan-AI/Wan2.2-TI2V-5B",
228
+ "wan_text_pad_zero": true,
229
+ "wan_tokenizer_model_id": "Wan-AI/Wan2.1-T2V-1.3B",
230
+ "wan_v2v_fm_mix": false,
231
+ "wan_v2v_student": true,
232
+ "wan_v2v_teacher": true
233
+ }
avg_L3/checkpoint-40000/embodiment_id.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "new_embodiment": 0,
3
+ "fractal20220817_data": 1,
4
+ "kuka": 2,
5
+ "bridge_orig": 3,
6
+ "taco_play": 4,
7
+ "jaco_play": 5,
8
+ "berkeley_cable_routing": 6,
9
+ "roboturk": 7,
10
+ "viola": 8,
11
+ "berkeley_autolab_ur5": 9,
12
+ "toto": 10,
13
+ "language_table": 11,
14
+ "stanford_hydra_dataset_converted_externally_to_rlds": 12,
15
+ "austin_buds_dataset_converted_externally_to_rlds": 13,
16
+ "nyu_franka_play_dataset_converted_externally_to_rlds": 14,
17
+ "furniture_bench_dataset_converted_externally_to_rlds": 15,
18
+ "ucsd_kitchen_dataset_converted_externally_to_rlds": 16,
19
+ "austin_sailor_dataset_converted_externally_to_rlds": 17,
20
+ "austin_sirius_dataset_converted_externally_to_rlds": 18,
21
+ "dlr_edan_shared_control_converted_externally_to_rlds": 19,
22
+ "iamlab_cmu_pickup_insert_converted_externally_to_rlds": 20,
23
+ "utaustin_mutex": 21,
24
+ "berkeley_fanuc_manipulation": 22,
25
+ "cmu_stretch": 23,
26
+ "bc_z": 24,
27
+ "fmb_dataset": 25,
28
+ "dobbe": 26,
29
+ "droid": 27,
30
+ "agibot_dexhand": 28,
31
+ "agibot_gripper": 29,
32
+ "galaxea": 30,
33
+ "humanoid_everyday_g1": 31,
34
+ "humanoid_everyday_h1": 32,
35
+ "action_net": 33,
36
+ "neural_gr1": 34,
37
+ "simulation_gr1": 35,
38
+ "libero_panda": 2
39
+ }
avg_L3/checkpoint-40000/experiment_cfg/conf.yaml ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ load_config_path: null
2
+ model:
3
+ model_type: WAM_DIT4DIT
4
+ model_dtype: bfloat16
5
+ backbone_type: wan22_diffusers
6
+ wan_model_path: Wan-AI/Wan2.2-TI2V-5B
7
+ wan_diffusers_model_path: Wan-AI/Wan2.2-TI2V-5B-Diffusers
8
+ wan_tokenizer_model_id: Wan-AI/Wan2.1-T2V-1.3B
9
+ wan_feature_extraction_layer: 18
10
+ cosmos_model_path: nvidia/Cosmos-Predict2.5-2B
11
+ cosmos_model_revision: diffusers/base/pre-trained
12
+ backbone_embedding_dim: 2048
13
+ num_frames_in: 25
14
+ num_frames_out: 41
15
+ frame_downsample_factor: 2
16
+ video_resolution: 256
17
+ feature_extraction_layer: 18
18
+ feature_extraction_aggregate_all: false
19
+ feature_extraction_aggregate_layer_window: 0
20
+ truncate_above_feature_extraction: false
21
+ vl_adapter_num_layers: 0
22
+ tune_layers_above_feature_extraction: true
23
+ n_tune_layers_below_feature_extraction: 0
24
+ tune_patch_embed: false
25
+ tune_time_embed: false
26
+ tune_crossattn_proj: false
27
+ freeze_modules_pattern: text_encoder,vae
28
+ freeze_whole_backbone: false
29
+ fm_loss_weight: 1.0
30
+ action_loss_weight: 1.0
31
+ conditional_frame_timestep: 0.0001
32
+ history_obs_noise_timestep: 0.0
33
+ history_num_clean_frames: 1
34
+ selfflow_rep: true
35
+ selfflow_rep_layer: -1
36
+ selfflow_rep_layer_student: -1
37
+ selfflow_rep_layer_teacher: -1
38
+ selfflow_mask_ratio: 0.1
39
+ selfflow_ema_decay: 0.9999
40
+ selfflow_rep_weight: 0.8
41
+ selfflow_teacher_noise: 0.0
42
+ fadistill_teacher_traj: true
43
+ fadistill_target_tau: 1.0
44
+ fadistill_teacher_nstep: 4
45
+ wan_fadistill_teacher_shift: 5.0
46
+ wan_fadistill_single_step_index: -1
47
+ wan_fadistill_align_weight: 0.01
48
+ wan_fadistill_teacher_stepper: euler
49
+ wan_fadistill_action_from_teacher: false
50
+ wan_v2v_teacher: true
51
+ wan_v2v_student: true
52
+ wan_v2v_fm_mix: false
53
+ wan_block_causal: false
54
+ wan_learnable_token: false
55
+ wan_learnable_token_count: 64
56
+ wan_learnable_token_queries: 192
57
+ wan_learnable_token_layers: 2
58
+ wan_context_pool: avg
59
+ wan_context_pool_layer: 3
60
+ wan_context_pool_n_cond_lat: 4
61
+ wan_context_pool_xattn_heads: 0
62
+ wan_context_pool_xattn_ffn_dim: 0
63
+ wan_fm_train_shift: 5.0
64
+ wan_text_pad_zero: true
65
+ nstep_agg: false
66
+ nstep_n: 2
67
+ nstep_query_len: 588
68
+ nstep_step_embed: true
69
+ nstep_agg_layers: 4
70
+ nstep_train_integration: false
71
+ nstep_noise_ensemble: false
72
+ nstep_base_residual: false
73
+ nstep_base_residual_gate: layerscale
74
+ nstep_compress_query: false
75
+ nstep_compress_k: 64
76
+ nstep_compress_n_frame: 3
77
+ nstep_readout_exclude_step0: false
78
+ nstep_per_step_gated: false
79
+ nstep_step_dropout: false
80
+ nstep_residual_warmup: false
81
+ nstep_residual_warmup_start: 10000
82
+ nstep_residual_warmup_full: 20000
83
+ nstep_certainty_fusion: false
84
+ nstep_certainty_ckpt: ''
85
+ nstep_certainty_tau: 1.0
86
+ nstep_certainty_drop_cond: false
87
+ nstep_certainty_arch: mlp
88
+ nstep_certainty_hidden: 1024
89
+ nstep_certainty_layers: 2
90
+ nstep_certainty_decalib: false
91
+ nstep_certainty_step_bias: false
92
+ nstep_latent_cond: false
93
+ use_step_weight_fusion: false
94
+ step_weight_target_tau: 0.7
95
+ step_weight_sigmas: 0.995,0.9631,0.594,0.0099
96
+ step_weight_predictor_layers: 4
97
+ step_weight_predictor_heads: 16
98
+ step_weight_predictor_ckpt: ''
99
+ freeze_step_weight_predictor: false
100
+ step_weight_exclude_current_tokens: false
101
+ multiview_layout: tmosaic
102
+ fm_time_distribution: uniform
103
+ fm_high_sigma_ratio: null
104
+ fm_high_sigma_min: 0.98
105
+ future_loss_type: flow_matching
106
+ future_num_inference_steps: 1
107
+ use_noise_frames_in_extraction: true
108
+ use_meta_queries: false
109
+ n_meta_queries: 8
110
+ meta_queries_mode: meta_only
111
+ use_meta_queries_in_fm: false
112
+ use_vlm_meta: false
113
+ use_vgln: false
114
+ tune_vgln: true
115
+ action_text_kv: false
116
+ state_dropout_prob: 0.0
117
+ state_additive_noise_scale: 0.0
118
+ training_mode: joint
119
+ action_head_model_type: dit
120
+ max_state_dim: 64
121
+ apply_sincos_state_encoding: false
122
+ use_percentiles: false
123
+ video_train_crop: false
124
+ image_resize_backend: cv2_linear
125
+ max_action_dim: 32
126
+ action_horizon: 16
127
+ video_context_exceeds_action_horizon: false
128
+ action_future_slots: null
129
+ hidden_size: 2560
130
+ input_embedding_dim: 768
131
+ repeated_diffusion_steps: 4
132
+ add_pos_embed: true
133
+ max_seq_len: 1024
134
+ attn_dropout: 0.2
135
+ action_dit_size: DiT-B
136
+ diffusion_model_cfg:
137
+ num_attention_heads: 12
138
+ attention_head_dim: 64
139
+ num_layers: 16
140
+ output_dim: 2560
141
+ dropout: 0.2
142
+ final_dropout: true
143
+ interleave_self_attention: true
144
+ norm_type: ada_norm
145
+ positional_embeddings: null
146
+ num_inference_timesteps: 4
147
+ noise_beta_alpha: 1.5
148
+ noise_beta_beta: 1.0
149
+ noise_s: 0.999
150
+ num_timestep_buckets: 1000
151
+ tune_projector: true
152
+ tune_diffusion_model: true
153
+ formalize_language: true
154
+ use_albumentations_transforms: true
155
+ crop_fraction: 0.95
156
+ random_rotation_angle: null
157
+ color_jitter_params: null
158
+ image_crop_size: null
159
+ image_target_size: null
160
+ shortest_image_edge: null
161
+ max_num_embodiments: 36
162
+ new_embodiment_train_ratio: 0.0
163
+ data:
164
+ datasets:
165
+ - dataset_paths:
166
+ - /data/shared_dataset/robocasa_mg_gr00t_300
167
+ embodiment_tag: new_embodiment
168
+ mix_ratio: 1.0
169
+ dataset_type: physical_embodiment
170
+ val_dataset_path: null
171
+ modality_configs:
172
+ new_embodiment:
173
+ video:
174
+ delta_indices:
175
+ - -24
176
+ - -22
177
+ - -20
178
+ - -18
179
+ - -16
180
+ - -14
181
+ - -12
182
+ - -10
183
+ - -8
184
+ - -6
185
+ - -4
186
+ - -2
187
+ - 0
188
+ - 2
189
+ - 4
190
+ - 6
191
+ - 8
192
+ - 10
193
+ - 12
194
+ - 14
195
+ - 16
196
+ modality_keys:
197
+ - left_view
198
+ - right_view
199
+ - wrist_view
200
+ sin_cos_embedding_keys: null
201
+ mean_std_embedding_keys: null
202
+ action_configs: null
203
+ state:
204
+ delta_indices:
205
+ - 0
206
+ modality_keys:
207
+ - end_effector_position_relative
208
+ - end_effector_rotation_relative
209
+ - gripper_qpos
210
+ - base_position
211
+ - base_rotation
212
+ sin_cos_embedding_keys: null
213
+ mean_std_embedding_keys: null
214
+ action_configs: null
215
+ action:
216
+ delta_indices:
217
+ - 0
218
+ - 1
219
+ - 2
220
+ - 3
221
+ - 4
222
+ - 5
223
+ - 6
224
+ - 7
225
+ - 8
226
+ - 9
227
+ - 10
228
+ - 11
229
+ - 12
230
+ - 13
231
+ - 14
232
+ - 15
233
+ modality_keys:
234
+ - end_effector_position
235
+ - end_effector_rotation
236
+ - gripper_close
237
+ - base_motion
238
+ - control_mode
239
+ sin_cos_embedding_keys: null
240
+ mean_std_embedding_keys: null
241
+ action_configs:
242
+ - rep: DELTA
243
+ type: EEF
244
+ format: DEFAULT
245
+ state_key: null
246
+ - rep: DELTA
247
+ type: EEF
248
+ format: DEFAULT
249
+ state_key: null
250
+ - rep: ABSOLUTE
251
+ type: NON_EEF
252
+ format: DEFAULT
253
+ state_key: null
254
+ - rep: DELTA
255
+ type: NON_EEF
256
+ format: DEFAULT
257
+ state_key: null
258
+ - rep: ABSOLUTE
259
+ type: NON_EEF
260
+ format: DEFAULT
261
+ state_key: null
262
+ language:
263
+ delta_indices:
264
+ - 0
265
+ modality_keys:
266
+ - annotation.human.action.task_description
267
+ sin_cos_embedding_keys: null
268
+ mean_std_embedding_keys: null
269
+ action_configs: null
270
+ dataset_mode: sharded
271
+ download_cache: false
272
+ shard_size: 512
273
+ episode_sampling_rate: 0.1
274
+ num_shards_per_epoch: 100000
275
+ override_pretraining_statistics: false
276
+ mode: single_turn
277
+ random_chop: 0.0
278
+ mock_dataset_mode: false
279
+ shuffle: true
280
+ seed: 42
281
+ multiprocessing_context: fork
282
+ allow_padding: true
283
+ subsample_ratio: 1.0
284
+ image_crop_size:
285
+ - 244
286
+ - 244
287
+ image_target_size:
288
+ - 224
289
+ - 224
290
+ video_backend: ffmpeg
291
+ training:
292
+ output_dir: /data/rlwrld-unified-checkpoints/hyeonmo/checkpoints/ctxpool_bmethod/wam_dit4dit_robocasa_kitchen_ditjoint_wan22_fadistillV2V_shift5_g001_vstu_sL3_future_tf025_sl3_latin4_ctxpoolavgL3_L18_res256_tmosaic_pd4_ga2_gb16_100k_local_jnojid
293
+ experiment_name: rc_bmethod_ctxpool_avg_L3_4latin_pd4ga2_4gpu
294
+ max_steps: 100000
295
+ global_batch_size: 16
296
+ batch_size: null
297
+ gradient_accumulation_steps: 2
298
+ learning_rate: 0.0001
299
+ lr_scheduler_type: cosine_with_min_lr
300
+ min_lr: 5.0e-07
301
+ weight_decay: 0.0
302
+ warmup_ratio: 0.0
303
+ warmup_steps: 5000
304
+ max_grad_norm: 1.0
305
+ new_param_warmup_steps: 0
306
+ reset_stage2_lr_scheduler: false
307
+ adam_beta1: 0.9
308
+ adam_beta2: 0.95
309
+ adam_epsilon: 1.0e-08
310
+ lr_per_module_enabled: false
311
+ lr_base: 3.0e-05
312
+ lr_backbone: 1.0e-05
313
+ lr_action_head: 0.0001
314
+ optim: adamw_torch
315
+ start_from_checkpoint: null
316
+ tf32: true
317
+ fp16: false
318
+ bf16: true
319
+ eval_bf16: true
320
+ logging_steps: 10
321
+ save_steps: 10000
322
+ save_total_limit: 5
323
+ save_vl_model: false
324
+ upload_checkpoints: false
325
+ upload_every: 1000
326
+ upload_last_n_checkpoints: 5
327
+ max_concurrent_uploads: 2
328
+ eval_strategy: 'no'
329
+ eval_steps: 500
330
+ eval_set_split_ratio: 0.1
331
+ eval_num_shards_per_epoch: 8
332
+ eval_batch_size: 2
333
+ save_best_eval_metric_name: ''
334
+ save_best_eval_metric_greater_is_better: true
335
+ deepspeed_stage: 2
336
+ gradient_checkpointing: false
337
+ resume_from_checkpoint: false
338
+ transformers_trust_remote_code: true
339
+ transformers_local_files_only: false
340
+ transformers_cache_dir: null
341
+ transformers_access_token: null
342
+ use_ddp: false
343
+ ddp_bucket_cap_mb: 100
344
+ num_gpus: 4
345
+ dataloader_num_workers: 5
346
+ remove_unused_columns: false
347
+ use_wandb: true
348
+ wandb_project: wam-dit4dit-robocasa-ctxpool-bmethod
349
+ enable_profiling: false
350
+ max_retries: 3
351
+ assert_loss_less_than: null
352
+ add_rl_callback: false
353
+ enable_open_loop_eval: false
354
+ open_loop_eval_traj_ids:
355
+ - 0
356
+ open_loop_eval_steps_per_traj: 100
357
+ open_loop_eval_plot_indices: null
358
+ max_steps: 100000
359
+ save_steps: 10000
avg_L3/checkpoint-40000/experiment_cfg/config.yaml ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !!python/object:gr00t.configs.base_config.Config
2
+ data: !!python/object:gr00t.configs.data.data_config.DataConfig
3
+ allow_padding: true
4
+ dataset_mode: sharded
5
+ datasets:
6
+ - !!python/object:gr00t.configs.data.data_config.SingleDatasetConfig
7
+ dataset_paths:
8
+ - /data/shared_dataset/robocasa_mg_gr00t_300
9
+ dataset_type: physical_embodiment
10
+ embodiment_tag: new_embodiment
11
+ mix_ratio: 1.0
12
+ val_dataset_path: null
13
+ download_cache: false
14
+ episode_sampling_rate: 0.1
15
+ image_crop_size:
16
+ - 244
17
+ - 244
18
+ image_target_size:
19
+ - 224
20
+ - 224
21
+ mock_dataset_mode: false
22
+ modality_configs:
23
+ new_embodiment:
24
+ action: !!python/object:gr00t.data.types.ModalityConfig
25
+ action_configs:
26
+ - !!python/object:gr00t.data.types.ActionConfig
27
+ format: &id001 !!python/object/apply:gr00t.data.types.ActionFormat
28
+ - default
29
+ rep: &id002 !!python/object/apply:gr00t.data.types.ActionRepresentation
30
+ - delta
31
+ state_key: null
32
+ type: &id003 !!python/object/apply:gr00t.data.types.ActionType
33
+ - eef
34
+ - !!python/object:gr00t.data.types.ActionConfig
35
+ format: *id001
36
+ rep: *id002
37
+ state_key: null
38
+ type: *id003
39
+ - !!python/object:gr00t.data.types.ActionConfig
40
+ format: *id001
41
+ rep: &id005 !!python/object/apply:gr00t.data.types.ActionRepresentation
42
+ - absolute
43
+ state_key: null
44
+ type: &id004 !!python/object/apply:gr00t.data.types.ActionType
45
+ - non_eef
46
+ - !!python/object:gr00t.data.types.ActionConfig
47
+ format: *id001
48
+ rep: *id002
49
+ state_key: null
50
+ type: *id004
51
+ - !!python/object:gr00t.data.types.ActionConfig
52
+ format: *id001
53
+ rep: *id005
54
+ state_key: null
55
+ type: *id004
56
+ delta_indices:
57
+ - 0
58
+ - 1
59
+ - 2
60
+ - 3
61
+ - 4
62
+ - 5
63
+ - 6
64
+ - 7
65
+ - 8
66
+ - 9
67
+ - 10
68
+ - 11
69
+ - 12
70
+ - 13
71
+ - 14
72
+ - 15
73
+ mean_std_embedding_keys: null
74
+ modality_keys:
75
+ - end_effector_position
76
+ - end_effector_rotation
77
+ - gripper_close
78
+ - base_motion
79
+ - control_mode
80
+ sin_cos_embedding_keys: null
81
+ language: !!python/object:gr00t.data.types.ModalityConfig
82
+ action_configs: null
83
+ delta_indices:
84
+ - 0
85
+ mean_std_embedding_keys: null
86
+ modality_keys:
87
+ - annotation.human.action.task_description
88
+ sin_cos_embedding_keys: null
89
+ state: !!python/object:gr00t.data.types.ModalityConfig
90
+ action_configs: null
91
+ delta_indices:
92
+ - 0
93
+ mean_std_embedding_keys: null
94
+ modality_keys:
95
+ - end_effector_position_relative
96
+ - end_effector_rotation_relative
97
+ - gripper_qpos
98
+ - base_position
99
+ - base_rotation
100
+ sin_cos_embedding_keys: null
101
+ video: !!python/object:gr00t.data.types.ModalityConfig
102
+ action_configs: null
103
+ delta_indices:
104
+ - -24
105
+ - -22
106
+ - -20
107
+ - -18
108
+ - -16
109
+ - -14
110
+ - -12
111
+ - -10
112
+ - -8
113
+ - -6
114
+ - -4
115
+ - -2
116
+ - 0
117
+ - 2
118
+ - 4
119
+ - 6
120
+ - 8
121
+ - 10
122
+ - 12
123
+ - 14
124
+ - 16
125
+ mean_std_embedding_keys: null
126
+ modality_keys:
127
+ - left_view
128
+ - right_view
129
+ - wrist_view
130
+ sin_cos_embedding_keys: null
131
+ mode: single_turn
132
+ multiprocessing_context: fork
133
+ num_shards_per_epoch: 100000
134
+ override_pretraining_statistics: false
135
+ random_chop: 0.0
136
+ seed: 42
137
+ shard_size: 512
138
+ shuffle: true
139
+ subsample_ratio: 1.0
140
+ video_backend: ffmpeg
141
+ load_config_path: null
142
+ model: !!python/object:gr00t.configs.model.wam_dit4dit.WAMDiT4DiTConfig
143
+ _attn_implementation_internal: null
144
+ _commit_hash: null
145
+ _name_or_path: ''
146
+ _output_attentions: false
147
+ _wam_sparse_checkpoint_config: false
148
+ action_dit_size: DiT-B
149
+ action_head_model_type: dit
150
+ action_text_kv: false
151
+ add_cross_attention: false
152
+ apply_sincos_state_encoding: false
153
+ architectures: null
154
+ backbone_trainable_params_fp32: true
155
+ backbone_type: wan22_diffusers
156
+ bad_words_ids: null
157
+ begin_suppress_tokens: null
158
+ bos_token_id: null
159
+ chunk_size_feed_forward: 0
160
+ color_jitter_params: null
161
+ conditional_frame_timestep: 0.0001
162
+ cross_attention_hidden_size: null
163
+ decoder_start_token_id: null
164
+ diffusion_model_cfg:
165
+ attention_head_dim: 64
166
+ dropout: 0.2
167
+ final_dropout: true
168
+ interleave_self_attention: true
169
+ norm_type: ada_norm
170
+ num_attention_heads: 12
171
+ num_layers: 16
172
+ output_dim: 2560
173
+ positional_embeddings: null
174
+ diversity_penalty: 0.0
175
+ do_sample: false
176
+ dtype: null
177
+ early_stopping: false
178
+ encoder_no_repeat_ngram_size: 0
179
+ eos_token_id: null
180
+ exponential_decay_length_penalty: null
181
+ fadistill_target_tau: 1.0
182
+ fadistill_teacher_nstep: 4
183
+ fadistill_teacher_traj: true
184
+ feature_extraction_aggregate_all: false
185
+ feature_extraction_aggregate_layer_window: 0
186
+ feature_extraction_layer: 18
187
+ finetuning_task: null
188
+ forced_bos_token_id: null
189
+ forced_eos_token_id: null
190
+ frame_downsample_factor: 2
191
+ freeze_modules_pattern: text_encoder,vae
192
+ freeze_step_weight_predictor: false
193
+ freeze_whole_backbone: false
194
+ history_num_clean_frames: 1
195
+ history_obs_noise_timestep: 0.0
196
+ id2label:
197
+ 0: LABEL_0
198
+ 1: LABEL_1
199
+ image_resize_backend: cv2_linear
200
+ input_embedding_dim: 768
201
+ is_decoder: false
202
+ is_encoder_decoder: false
203
+ label2id:
204
+ LABEL_0: 0
205
+ LABEL_1: 1
206
+ length_penalty: 1.0
207
+ load_bf16: true
208
+ max_length: 20
209
+ min_length: 0
210
+ model_type: WAM_DIT4DIT
211
+ multiview_layout: tmosaic
212
+ new_embodiment_train_ratio: 0
213
+ no_repeat_ngram_size: 0
214
+ nstep_agg: false
215
+ nstep_agg_layers: 4
216
+ nstep_base_residual: false
217
+ nstep_base_residual_gate: layerscale
218
+ nstep_certainty_arch: mlp
219
+ nstep_certainty_ckpt: ''
220
+ nstep_certainty_decalib: false
221
+ nstep_certainty_drop_cond: false
222
+ nstep_certainty_fusion: false
223
+ nstep_certainty_hidden: 1024
224
+ nstep_certainty_layers: 2
225
+ nstep_certainty_step_bias: false
226
+ nstep_certainty_tau: 1.0
227
+ nstep_compress_k: 64
228
+ nstep_compress_n_frame: 3
229
+ nstep_compress_query: false
230
+ nstep_latent_cond: false
231
+ nstep_n: 2
232
+ nstep_noise_ensemble: false
233
+ nstep_per_step_gated: false
234
+ nstep_query_len: 588
235
+ nstep_readout_exclude_step0: false
236
+ nstep_residual_warmup: false
237
+ nstep_residual_warmup_full: 20000
238
+ nstep_residual_warmup_start: 10000
239
+ nstep_step_dropout: false
240
+ nstep_step_embed: true
241
+ nstep_train_integration: false
242
+ num_beam_groups: 1
243
+ num_beams: 1
244
+ num_frames_in: 25
245
+ num_frames_out: 41
246
+ num_return_sequences: 1
247
+ output_hidden_states: false
248
+ output_scores: false
249
+ pad_token_id: null
250
+ prefix: null
251
+ problem_type: null
252
+ pruned_heads: {}
253
+ random_rotation_angle: null
254
+ remove_invalid_values: false
255
+ repeated_diffusion_steps: 4
256
+ repetition_penalty: 1.0
257
+ reproject_vision: false
258
+ return_dict: true
259
+ return_dict_in_generate: false
260
+ selfflow_ema_decay: 0.9999
261
+ selfflow_mask_ratio: 0.1
262
+ selfflow_rep: true
263
+ selfflow_rep_layer: -1
264
+ selfflow_rep_layer_student: -1
265
+ selfflow_rep_layer_teacher: -1
266
+ selfflow_rep_weight: 0.8
267
+ selfflow_teacher_noise: 0.0
268
+ sep_token_id: null
269
+ state_dropout_prob: 0.0
270
+ step_weight_exclude_current_tokens: false
271
+ step_weight_predictor_ckpt: ''
272
+ step_weight_predictor_heads: 16
273
+ step_weight_predictor_layers: 4
274
+ step_weight_sigmas: 0.995,0.9631,0.594,0.0099
275
+ step_weight_target_tau: 0.7
276
+ suppress_tokens: null
277
+ task_specific_params: null
278
+ temperature: 1.0
279
+ tf_legacy_loss: false
280
+ tie_encoder_decoder: false
281
+ tie_word_embeddings: true
282
+ tokenizer_class: null
283
+ top_k: 50
284
+ top_p: 1.0
285
+ torchscript: false
286
+ training_mode: joint
287
+ transformers_version: null
288
+ truncate_above_feature_extraction: false
289
+ tune_crossattn_proj: false
290
+ tune_diffusion_model: true
291
+ tune_layers_above_feature_extraction: true
292
+ tune_llm: false
293
+ tune_patch_embed: false
294
+ tune_projector: true
295
+ tune_time_embed: false
296
+ tune_top_llm_layers: 4
297
+ tune_vgln: true
298
+ tune_visual: false
299
+ typical_p: 1.0
300
+ use_bfloat16: false
301
+ use_meta_queries: false
302
+ use_meta_queries_in_fm: false
303
+ use_noise_frames_in_extraction: true
304
+ use_relative_action: true
305
+ use_step_weight_fusion: false
306
+ use_vgln: false
307
+ use_vlm_meta: false
308
+ video_resolution: 256
309
+ video_train_crop: false
310
+ vl_adapter_num_layers: 0
311
+ wan_context_pool: avg
312
+ wan_context_pool_layer: 3
313
+ wan_context_pool_n_cond_lat: 4
314
+ wan_context_pool_xattn_ffn_dim: 0
315
+ wan_context_pool_xattn_heads: 0
316
+ wan_fadistill_action_from_teacher: false
317
+ wan_fadistill_align_weight: 0.01
318
+ wan_fadistill_single_step_index: -1
319
+ wan_fadistill_teacher_shift: 5.0
320
+ wan_fadistill_teacher_stepper: euler
321
+ wan_feature_extraction_layer: 18
322
+ wan_fm_train_shift: 5.0
323
+ wan_learnable_token_count: 64
324
+ wan_learnable_token_layers: 2
325
+ wan_learnable_token_queries: 192
326
+ wan_model_path: Wan-AI/Wan2.2-TI2V-5B
327
+ wan_text_pad_zero: true
328
+ wan_v2v_student: true
329
+ wan_v2v_teacher: true
330
+ training: !!python/object:gr00t.configs.training.training_config.TrainingConfig
331
+ adam_beta1: 0.9
332
+ adam_beta2: 0.95
333
+ adam_epsilon: 1.0e-08
334
+ add_rl_callback: false
335
+ assert_loss_less_than: null
336
+ batch_size: null
337
+ bf16: true
338
+ dataloader_num_workers: 5
339
+ ddp_bucket_cap_mb: 100
340
+ deepspeed_stage: 2
341
+ enable_open_loop_eval: false
342
+ enable_profiling: false
343
+ eval_batch_size: 2
344
+ eval_bf16: true
345
+ eval_num_shards_per_epoch: 8
346
+ eval_set_split_ratio: 0.1
347
+ eval_steps: 500
348
+ eval_strategy: 'no'
349
+ experiment_name: rc_bmethod_ctxpool_avg_L3_4latin_pd4ga2_4gpu
350
+ fp16: false
351
+ global_batch_size: 16
352
+ gradient_accumulation_steps: 2
353
+ gradient_checkpointing: false
354
+ learning_rate: 0.0001
355
+ logging_steps: 10
356
+ lr_action_head: 0.0001
357
+ lr_backbone: 1.0e-05
358
+ lr_base: 3.0e-05
359
+ lr_per_module_enabled: false
360
+ lr_scheduler_type: cosine_with_min_lr
361
+ max_concurrent_uploads: 2
362
+ max_grad_norm: 1.0
363
+ max_retries: 3
364
+ max_steps: 100000
365
+ min_lr: 5.0e-07
366
+ new_param_warmup_steps: 0
367
+ num_gpus: 4
368
+ open_loop_eval_plot_indices: null
369
+ open_loop_eval_steps_per_traj: 100
370
+ open_loop_eval_traj_ids:
371
+ - 0
372
+ optim: adamw_torch
373
+ output_dir: /data/rlwrld-unified-checkpoints/hyeonmo/checkpoints/ctxpool_bmethod/wam_dit4dit_robocasa_kitchen_ditjoint_wan22_fadistillV2V_shift5_g001_vstu_sL3_future_tf025_sl3_latin4_ctxpoolavgL3_L18_res256_tmosaic_pd4_ga2_gb16_100k_local_jnojid
374
+ remove_unused_columns: false
375
+ reset_stage2_lr_scheduler: false
376
+ resume_from_checkpoint: false
377
+ save_best_eval_metric_greater_is_better: true
378
+ save_best_eval_metric_name: ''
379
+ save_steps: 10000
380
+ save_total_limit: 5
381
+ save_vl_model: false
382
+ start_from_checkpoint: null
383
+ tf32: true
384
+ transformers_access_token: null
385
+ transformers_cache_dir: null
386
+ transformers_local_files_only: false
387
+ transformers_trust_remote_code: true
388
+ upload_checkpoints: false
389
+ upload_every: 1000
390
+ upload_last_n_checkpoints: 5
391
+ use_ddp: false
392
+ use_wandb: true
393
+ wandb_project: wam-dit4dit-robocasa-ctxpool-bmethod
394
+ warmup_ratio: 0.0
395
+ warmup_steps: 5000
396
+ weight_decay: 0.0
avg_L3/checkpoint-40000/experiment_cfg/dataset_statistics.json ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "new_embodiment": {
3
+ "state": {
4
+ "end_effector_position_relative": {
5
+ "min": [
6
+ -0.46594083309173584,
7
+ -0.8278615474700928,
8
+ 0.011948669329285622
9
+ ],
10
+ "max": [
11
+ 0.8734620809555054,
12
+ 0.8441421985626221,
13
+ 1.1348456144332886
14
+ ],
15
+ "mean": [
16
+ 0.266306072473526,
17
+ -0.04002884030342102,
18
+ 0.5537278652191162
19
+ ],
20
+ "std": [
21
+ 0.19139817357063293,
22
+ 0.2582354247570038,
23
+ 0.2461009919643402
24
+ ],
25
+ "q01": [
26
+ -0.251964715719223,
27
+ -0.6177875232696534,
28
+ 0.07541620314121246
29
+ ],
30
+ "q99": [
31
+ 0.736240336894989,
32
+ 0.6068667078018188,
33
+ 0.9772176861763
34
+ ]
35
+ },
36
+ "end_effector_rotation_relative": {
37
+ "min": [
38
+ -0.9999996423721313,
39
+ -0.9910850524902344,
40
+ -0.9571061134338379,
41
+ 6.351022108219695e-08
42
+ ],
43
+ "max": [
44
+ 0.9999980926513672,
45
+ 0.990567147731781,
46
+ 0.964046835899353,
47
+ 0.9740113019943237
48
+ ],
49
+ "mean": [
50
+ -0.14963096380233765,
51
+ 0.1248803362250328,
52
+ 0.0027880165725946426,
53
+ 0.2082664668560028
54
+ ],
55
+ "std": [
56
+ 0.7683019042015076,
57
+ 0.36296239495277405,
58
+ 0.37635329365730286,
59
+ 0.2322801947593689
60
+ ],
61
+ "q01": [
62
+ -0.9973158955574035,
63
+ -0.6837371301651001,
64
+ -0.7814695286750794,
65
+ 0.0013687612861394884
66
+ ],
67
+ "q99": [
68
+ 0.9957762026786804,
69
+ 0.8491807365417481,
70
+ 0.7687161755561829,
71
+ 0.802422981262207
72
+ ]
73
+ },
74
+ "gripper_qpos": {
75
+ "min": [
76
+ -0.027591193094849586,
77
+ -0.05319468677043915
78
+ ],
79
+ "max": [
80
+ 0.07896614819765091,
81
+ 0.10181591659784317
82
+ ],
83
+ "mean": [
84
+ 0.030854083597660065,
85
+ -0.03072655387222767
86
+ ],
87
+ "std": [
88
+ 0.013360796496272087,
89
+ 0.013391095213592052
90
+ ],
91
+ "q01": [
92
+ -4.0135159069905056e-05,
93
+ -0.04032127052545548
94
+ ],
95
+ "q99": [
96
+ 0.04066328033804893,
97
+ -0.00040660659200511887
98
+ ]
99
+ },
100
+ "base_position": {
101
+ "min": [
102
+ 0.31250813603401184,
103
+ -5.100343704223633,
104
+ 0.6963803172111511
105
+ ],
106
+ "max": [
107
+ 5.601607322692871,
108
+ -0.4872598946094513,
109
+ 0.7495372295379639
110
+ ],
111
+ "mean": [
112
+ 2.5315651893615723,
113
+ -1.5020122528076172,
114
+ 0.7073471546173096
115
+ ],
116
+ "std": [
117
+ 1.4670116901397705,
118
+ 0.8559004664421082,
119
+ 0.006971539929508914
120
+ ],
121
+ "q01": [
122
+ 0.5000457167625427,
123
+ -4.100119590759277,
124
+ 0.6999446749687195
125
+ ],
126
+ "q99": [
127
+ 5.5999836921691895,
128
+ -0.778001925945282,
129
+ 0.7071865797042847
130
+ ]
131
+ },
132
+ "base_rotation": {
133
+ "min": [
134
+ 0.0,
135
+ 0.0,
136
+ -1.0,
137
+ 0.0
138
+ ],
139
+ "max": [
140
+ 0.0,
141
+ 0.0,
142
+ 1.0,
143
+ 1.0
144
+ ],
145
+ "mean": [
146
+ 0.0,
147
+ 0.0,
148
+ 0.2765239179134369,
149
+ 0.6414101719856262
150
+ ],
151
+ "std": [
152
+ 0.0,
153
+ 0.0,
154
+ 0.6192871332168579,
155
+ 0.35383468866348267
156
+ ],
157
+ "q01": [
158
+ 0.0,
159
+ 0.0,
160
+ -1.0,
161
+ 5.569559434661642e-06
162
+ ],
163
+ "q99": [
164
+ 0.0,
165
+ 0.0,
166
+ 1.0,
167
+ 1.0
168
+ ]
169
+ }
170
+ },
171
+ "action": {
172
+ "end_effector_position": {
173
+ "min": [
174
+ -1.0,
175
+ -1.0,
176
+ -1.0
177
+ ],
178
+ "max": [
179
+ 1.0,
180
+ 1.0,
181
+ 1.0
182
+ ],
183
+ "mean": [
184
+ 0.029150759801268578,
185
+ 0.007607606239616871,
186
+ -0.037477411329746246
187
+ ],
188
+ "std": [
189
+ 0.4175023138523102,
190
+ 0.41343387961387634,
191
+ 0.36864909529685974
192
+ ],
193
+ "q01": [
194
+ -1.0,
195
+ -1.0,
196
+ -1.0
197
+ ],
198
+ "q99": [
199
+ 1.0,
200
+ 1.0,
201
+ 1.0
202
+ ]
203
+ },
204
+ "end_effector_rotation": {
205
+ "min": [
206
+ -1.0,
207
+ -1.0,
208
+ -1.0
209
+ ],
210
+ "max": [
211
+ 1.0,
212
+ 1.0,
213
+ 1.0
214
+ ],
215
+ "mean": [
216
+ 0.007235987111926079,
217
+ -0.023321982473134995,
218
+ -0.0024119403678923845
219
+ ],
220
+ "std": [
221
+ 0.147710919380188,
222
+ 0.15399158000946045,
223
+ 0.13929523527622223
224
+ ],
225
+ "q01": [
226
+ -0.42321433901786804,
227
+ -0.5219977021217346,
228
+ -0.4101182746887207
229
+ ],
230
+ "q99": [
231
+ 0.47503985762596074,
232
+ 0.38744416117668146,
233
+ 0.4242807936668394
234
+ ]
235
+ },
236
+ "gripper_close": {
237
+ "min": [
238
+ 0.0
239
+ ],
240
+ "max": [
241
+ 1.0
242
+ ],
243
+ "mean": [
244
+ 0.34521719813346863
245
+ ],
246
+ "std": [
247
+ 0.47949448227882385
248
+ ],
249
+ "q01": [
250
+ 0.0
251
+ ],
252
+ "q99": [
253
+ 1.0
254
+ ]
255
+ },
256
+ "base_motion": {
257
+ "min": [
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 0.0
262
+ ],
263
+ "max": [
264
+ 0.0,
265
+ 0.0,
266
+ 0.0,
267
+ 0.0
268
+ ],
269
+ "mean": [
270
+ 0.0,
271
+ 0.0,
272
+ 0.0,
273
+ 0.0
274
+ ],
275
+ "std": [
276
+ 0.0,
277
+ 0.0,
278
+ 0.0,
279
+ 0.0
280
+ ],
281
+ "q01": [
282
+ 0.0,
283
+ 0.0,
284
+ 0.0,
285
+ 0.0
286
+ ],
287
+ "q99": [
288
+ 0.0,
289
+ 0.0,
290
+ 0.0,
291
+ 0.0
292
+ ]
293
+ },
294
+ "control_mode": {
295
+ "min": [
296
+ 0.0
297
+ ],
298
+ "max": [
299
+ 0.0
300
+ ],
301
+ "mean": [
302
+ 0.0
303
+ ],
304
+ "std": [
305
+ 0.0
306
+ ],
307
+ "q01": [
308
+ 0.0
309
+ ],
310
+ "q99": [
311
+ 0.0
312
+ ]
313
+ }
314
+ },
315
+ "relative_action": {}
316
+ }
317
+ }
avg_L3/checkpoint-40000/experiment_cfg/final_model_config.json ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "WAM_DIT4DIT",
3
+ "model_dtype": "bfloat16",
4
+ "backbone_type": "wan22_diffusers",
5
+ "wan_model_path": "Wan-AI/Wan2.2-TI2V-5B",
6
+ "wan_diffusers_model_path": "Wan-AI/Wan2.2-TI2V-5B-Diffusers",
7
+ "wan_tokenizer_model_id": "Wan-AI/Wan2.1-T2V-1.3B",
8
+ "wan_feature_extraction_layer": 18,
9
+ "cosmos_model_path": "nvidia/Cosmos-Predict2.5-2B",
10
+ "cosmos_model_revision": "diffusers/base/pre-trained",
11
+ "backbone_embedding_dim": 3072,
12
+ "num_frames_in": 25,
13
+ "num_frames_out": 41,
14
+ "frame_downsample_factor": 2,
15
+ "video_resolution": 256,
16
+ "feature_extraction_layer": 18,
17
+ "feature_extraction_aggregate_all": false,
18
+ "feature_extraction_aggregate_layer_window": 0,
19
+ "truncate_above_feature_extraction": false,
20
+ "vl_adapter_num_layers": 0,
21
+ "tune_layers_above_feature_extraction": true,
22
+ "n_tune_layers_below_feature_extraction": 0,
23
+ "tune_patch_embed": false,
24
+ "tune_time_embed": false,
25
+ "tune_crossattn_proj": false,
26
+ "freeze_modules_pattern": "text_encoder,vae",
27
+ "freeze_whole_backbone": false,
28
+ "fm_loss_weight": 1.0,
29
+ "action_loss_weight": 1.0,
30
+ "conditional_frame_timestep": 0.0001,
31
+ "history_obs_noise_timestep": 0.0,
32
+ "history_num_clean_frames": 1,
33
+ "selfflow_rep": true,
34
+ "selfflow_rep_layer": -1,
35
+ "selfflow_rep_layer_student": -1,
36
+ "selfflow_rep_layer_teacher": -1,
37
+ "selfflow_mask_ratio": 0.1,
38
+ "selfflow_ema_decay": 0.9999,
39
+ "selfflow_rep_weight": 0.8,
40
+ "selfflow_teacher_noise": 0.0,
41
+ "fadistill_teacher_traj": true,
42
+ "fadistill_target_tau": 1.0,
43
+ "fadistill_teacher_nstep": 4,
44
+ "wan_fadistill_teacher_shift": 5.0,
45
+ "wan_fadistill_single_step_index": -1,
46
+ "wan_fadistill_align_weight": 0.01,
47
+ "wan_fadistill_teacher_stepper": "euler",
48
+ "wan_fadistill_action_from_teacher": false,
49
+ "wan_v2v_teacher": true,
50
+ "wan_v2v_student": true,
51
+ "wan_v2v_fm_mix": false,
52
+ "wan_block_causal": false,
53
+ "wan_learnable_token": false,
54
+ "wan_learnable_token_count": 64,
55
+ "wan_learnable_token_queries": 192,
56
+ "wan_learnable_token_layers": 2,
57
+ "wan_context_pool": "avg",
58
+ "wan_context_pool_layer": 3,
59
+ "wan_context_pool_n_cond_lat": 4,
60
+ "wan_context_pool_xattn_heads": 0,
61
+ "wan_context_pool_xattn_ffn_dim": 0,
62
+ "wan_fm_train_shift": 5.0,
63
+ "wan_text_pad_zero": true,
64
+ "nstep_agg": false,
65
+ "nstep_n": 2,
66
+ "nstep_query_len": 588,
67
+ "nstep_step_embed": true,
68
+ "nstep_agg_layers": 4,
69
+ "nstep_train_integration": false,
70
+ "nstep_noise_ensemble": false,
71
+ "nstep_base_residual": false,
72
+ "nstep_base_residual_gate": "layerscale",
73
+ "nstep_compress_query": false,
74
+ "nstep_compress_k": 64,
75
+ "nstep_compress_n_frame": 3,
76
+ "nstep_readout_exclude_step0": false,
77
+ "nstep_per_step_gated": false,
78
+ "nstep_step_dropout": false,
79
+ "nstep_residual_warmup": false,
80
+ "nstep_residual_warmup_start": 10000,
81
+ "nstep_residual_warmup_full": 20000,
82
+ "nstep_certainty_fusion": false,
83
+ "nstep_certainty_ckpt": "",
84
+ "nstep_certainty_tau": 1.0,
85
+ "nstep_certainty_drop_cond": false,
86
+ "nstep_certainty_arch": "mlp",
87
+ "nstep_certainty_hidden": 1024,
88
+ "nstep_certainty_layers": 2,
89
+ "nstep_certainty_decalib": false,
90
+ "nstep_certainty_step_bias": false,
91
+ "nstep_latent_cond": false,
92
+ "use_step_weight_fusion": false,
93
+ "step_weight_target_tau": 0.7,
94
+ "step_weight_sigmas": "0.995,0.9631,0.594,0.0099",
95
+ "step_weight_predictor_layers": 4,
96
+ "step_weight_predictor_heads": 16,
97
+ "step_weight_predictor_ckpt": "",
98
+ "freeze_step_weight_predictor": false,
99
+ "step_weight_exclude_current_tokens": false,
100
+ "multiview_layout": "tmosaic",
101
+ "fm_time_distribution": "uniform",
102
+ "fm_high_sigma_ratio": null,
103
+ "fm_high_sigma_min": 0.98,
104
+ "future_loss_type": "flow_matching",
105
+ "future_num_inference_steps": 1,
106
+ "use_noise_frames_in_extraction": true,
107
+ "use_meta_queries": false,
108
+ "n_meta_queries": 8,
109
+ "meta_queries_mode": "meta_only",
110
+ "use_meta_queries_in_fm": false,
111
+ "use_vlm_meta": false,
112
+ "use_vgln": false,
113
+ "tune_vgln": true,
114
+ "action_text_kv": false,
115
+ "state_dropout_prob": 0.0,
116
+ "state_additive_noise_scale": 0.0,
117
+ "training_mode": "joint",
118
+ "action_head_model_type": "dit",
119
+ "max_state_dim": 64,
120
+ "apply_sincos_state_encoding": false,
121
+ "use_percentiles": false,
122
+ "video_train_crop": false,
123
+ "image_resize_backend": "cv2_linear",
124
+ "max_action_dim": 32,
125
+ "action_horizon": 16,
126
+ "video_context_exceeds_action_horizon": false,
127
+ "action_future_slots": null,
128
+ "hidden_size": 2560,
129
+ "input_embedding_dim": 768,
130
+ "repeated_diffusion_steps": 4,
131
+ "add_pos_embed": true,
132
+ "max_seq_len": 1024,
133
+ "attn_dropout": 0.2,
134
+ "action_dit_size": "DiT-B",
135
+ "diffusion_model_cfg": {
136
+ "num_attention_heads": 12,
137
+ "attention_head_dim": 64,
138
+ "num_layers": 16,
139
+ "output_dim": 2560,
140
+ "dropout": 0.2,
141
+ "final_dropout": true,
142
+ "interleave_self_attention": true,
143
+ "norm_type": "ada_norm",
144
+ "positional_embeddings": null
145
+ },
146
+ "num_inference_timesteps": 4,
147
+ "noise_beta_alpha": 1.5,
148
+ "noise_beta_beta": 1.0,
149
+ "noise_s": 0.999,
150
+ "num_timestep_buckets": 1000,
151
+ "tune_projector": true,
152
+ "tune_diffusion_model": true,
153
+ "max_num_embodiments": 36,
154
+ "new_embodiment_train_ratio": 0
155
+ }
avg_L3/checkpoint-40000/model-00001-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c1f889831c4e697ba28ed4dabf7e452c422391ece9284b6b66e00dd1fddd3e7
3
+ size 4912561816
avg_L3/checkpoint-40000/model-00002-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f4492b08bd696f51302e510d37968ebaeff4d42cfcb7749951bfa68af8b9b84
3
+ size 4997866232
avg_L3/checkpoint-40000/model-00003-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03395a0f315201aa2563a43fb25d294cbf621b1cf522922a0054d96341da32b4
3
+ size 4953653648
avg_L3/checkpoint-40000/model-00004-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7453a1cac7b1e8f39d80d29466ef2b1eac0bfe1c08f0e4b713bfc5d3eca0a936
3
+ size 4985255480
avg_L3/checkpoint-40000/model-00005-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aadd56338297f0f220d0dcaafb6514680ef663a5ccedfed57c66d0b68021b44b
3
+ size 4834206416
avg_L3/checkpoint-40000/model-00006-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:504d3d882d2cae78237ad3370baf25088cf062ee869f516533c6e0451002bb1d
3
+ size 4985255656
avg_L3/checkpoint-40000/model-00007-of-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f28aaadd21b827c10962a27f875f0ebf175cf37f7e9f04e7332ff20c6ee0b937
3
+ size 2867243424
avg_L3/checkpoint-40000/model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
avg_L3/checkpoint-40000/processor_config.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "processor_class": "WAMDiT4DiTProcessor",
3
+ "downsampled_num_frames_in": 13,
4
+ "downsampled_num_frames_out": 21,
5
+ "frame_downsample_factor": 2,
6
+ "max_state_dim": 64,
7
+ "max_action_dim": 32,
8
+ "max_action_horizon": 16,
9
+ "formalize_language": true,
10
+ "new_embodiment_train_ratio": 0,
11
+ "use_percentiles": false,
12
+ "clip_outliers": true,
13
+ "apply_sincos_state_encoding": false,
14
+ "video_train_crop": false,
15
+ "image_resize_backend": "cv2_linear",
16
+ "multiview_layout": "tmosaic",
17
+ "video_resolution": 256,
18
+ "use_relative_action": false,
19
+ "embodiment_id_mapping": {
20
+ "new_embodiment": 0,
21
+ "fractal20220817_data": 1,
22
+ "kuka": 2,
23
+ "bridge_orig": 3,
24
+ "taco_play": 4,
25
+ "jaco_play": 5,
26
+ "berkeley_cable_routing": 6,
27
+ "roboturk": 7,
28
+ "viola": 8,
29
+ "berkeley_autolab_ur5": 9,
30
+ "toto": 10,
31
+ "language_table": 11,
32
+ "stanford_hydra_dataset_converted_externally_to_rlds": 12,
33
+ "austin_buds_dataset_converted_externally_to_rlds": 13,
34
+ "nyu_franka_play_dataset_converted_externally_to_rlds": 14,
35
+ "furniture_bench_dataset_converted_externally_to_rlds": 15,
36
+ "ucsd_kitchen_dataset_converted_externally_to_rlds": 16,
37
+ "austin_sailor_dataset_converted_externally_to_rlds": 17,
38
+ "austin_sirius_dataset_converted_externally_to_rlds": 18,
39
+ "dlr_edan_shared_control_converted_externally_to_rlds": 19,
40
+ "iamlab_cmu_pickup_insert_converted_externally_to_rlds": 20,
41
+ "utaustin_mutex": 21,
42
+ "berkeley_fanuc_manipulation": 22,
43
+ "cmu_stretch": 23,
44
+ "bc_z": 24,
45
+ "fmb_dataset": 25,
46
+ "dobbe": 26,
47
+ "droid": 27,
48
+ "agibot_dexhand": 28,
49
+ "agibot_gripper": 29,
50
+ "galaxea": 30,
51
+ "humanoid_everyday_g1": 31,
52
+ "humanoid_everyday_h1": 32,
53
+ "action_net": 33,
54
+ "neural_gr1": 34,
55
+ "simulation_gr1": 35,
56
+ "libero_panda": 2
57
+ },
58
+ "use_vlm_meta": false,
59
+ "vlm_model_name": "huiwon/alinvlm_v1_3",
60
+ "vlm_backbone_model_type": "qwen3_vl",
61
+ "conversation_image_first": false,
62
+ "image_aug": true,
63
+ "image_aug_stronger": false,
64
+ "image_aug_moderate": true,
65
+ "image_aug_moderate_allview": true,
66
+ "text_dropout": 0.1
67
+ }
avg_L3/checkpoint-40000/statistics.json ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "new_embodiment": {
3
+ "state": {
4
+ "end_effector_position_relative": {
5
+ "min": [
6
+ -0.46594083309173584,
7
+ -0.8278615474700928,
8
+ 0.011948669329285622
9
+ ],
10
+ "max": [
11
+ 0.8734620809555054,
12
+ 0.8441421985626221,
13
+ 1.1348456144332886
14
+ ],
15
+ "mean": [
16
+ 0.266306072473526,
17
+ -0.04002884030342102,
18
+ 0.5537278652191162
19
+ ],
20
+ "std": [
21
+ 0.19139817357063293,
22
+ 0.2582354247570038,
23
+ 0.2461009919643402
24
+ ],
25
+ "q01": [
26
+ -0.251964715719223,
27
+ -0.6177875232696534,
28
+ 0.07541620314121246
29
+ ],
30
+ "q99": [
31
+ 0.736240336894989,
32
+ 0.6068667078018188,
33
+ 0.9772176861763
34
+ ]
35
+ },
36
+ "end_effector_rotation_relative": {
37
+ "min": [
38
+ -0.9999996423721313,
39
+ -0.9910850524902344,
40
+ -0.9571061134338379,
41
+ 6.351022108219695e-08
42
+ ],
43
+ "max": [
44
+ 0.9999980926513672,
45
+ 0.990567147731781,
46
+ 0.964046835899353,
47
+ 0.9740113019943237
48
+ ],
49
+ "mean": [
50
+ -0.14963096380233765,
51
+ 0.1248803362250328,
52
+ 0.0027880165725946426,
53
+ 0.2082664668560028
54
+ ],
55
+ "std": [
56
+ 0.7683019042015076,
57
+ 0.36296239495277405,
58
+ 0.37635329365730286,
59
+ 0.2322801947593689
60
+ ],
61
+ "q01": [
62
+ -0.9973158955574035,
63
+ -0.6837371301651001,
64
+ -0.7814695286750794,
65
+ 0.0013687612861394884
66
+ ],
67
+ "q99": [
68
+ 0.9957762026786804,
69
+ 0.8491807365417481,
70
+ 0.7687161755561829,
71
+ 0.802422981262207
72
+ ]
73
+ },
74
+ "gripper_qpos": {
75
+ "min": [
76
+ -0.027591193094849586,
77
+ -0.05319468677043915
78
+ ],
79
+ "max": [
80
+ 0.07896614819765091,
81
+ 0.10181591659784317
82
+ ],
83
+ "mean": [
84
+ 0.030854083597660065,
85
+ -0.03072655387222767
86
+ ],
87
+ "std": [
88
+ 0.013360796496272087,
89
+ 0.013391095213592052
90
+ ],
91
+ "q01": [
92
+ -4.0135159069905056e-05,
93
+ -0.04032127052545548
94
+ ],
95
+ "q99": [
96
+ 0.04066328033804893,
97
+ -0.00040660659200511887
98
+ ]
99
+ },
100
+ "base_position": {
101
+ "min": [
102
+ 0.31250813603401184,
103
+ -5.100343704223633,
104
+ 0.6963803172111511
105
+ ],
106
+ "max": [
107
+ 5.601607322692871,
108
+ -0.4872598946094513,
109
+ 0.7495372295379639
110
+ ],
111
+ "mean": [
112
+ 2.5315651893615723,
113
+ -1.5020122528076172,
114
+ 0.7073471546173096
115
+ ],
116
+ "std": [
117
+ 1.4670116901397705,
118
+ 0.8559004664421082,
119
+ 0.006971539929508914
120
+ ],
121
+ "q01": [
122
+ 0.5000457167625427,
123
+ -4.100119590759277,
124
+ 0.6999446749687195
125
+ ],
126
+ "q99": [
127
+ 5.5999836921691895,
128
+ -0.778001925945282,
129
+ 0.7071865797042847
130
+ ]
131
+ },
132
+ "base_rotation": {
133
+ "min": [
134
+ 0.0,
135
+ 0.0,
136
+ -1.0,
137
+ 0.0
138
+ ],
139
+ "max": [
140
+ 0.0,
141
+ 0.0,
142
+ 1.0,
143
+ 1.0
144
+ ],
145
+ "mean": [
146
+ 0.0,
147
+ 0.0,
148
+ 0.2765239179134369,
149
+ 0.6414101719856262
150
+ ],
151
+ "std": [
152
+ 0.0,
153
+ 0.0,
154
+ 0.6192871332168579,
155
+ 0.35383468866348267
156
+ ],
157
+ "q01": [
158
+ 0.0,
159
+ 0.0,
160
+ -1.0,
161
+ 5.569559434661642e-06
162
+ ],
163
+ "q99": [
164
+ 0.0,
165
+ 0.0,
166
+ 1.0,
167
+ 1.0
168
+ ]
169
+ }
170
+ },
171
+ "action": {
172
+ "end_effector_position": {
173
+ "min": [
174
+ -1.0,
175
+ -1.0,
176
+ -1.0
177
+ ],
178
+ "max": [
179
+ 1.0,
180
+ 1.0,
181
+ 1.0
182
+ ],
183
+ "mean": [
184
+ 0.029150759801268578,
185
+ 0.007607606239616871,
186
+ -0.037477411329746246
187
+ ],
188
+ "std": [
189
+ 0.4175023138523102,
190
+ 0.41343387961387634,
191
+ 0.36864909529685974
192
+ ],
193
+ "q01": [
194
+ -1.0,
195
+ -1.0,
196
+ -1.0
197
+ ],
198
+ "q99": [
199
+ 1.0,
200
+ 1.0,
201
+ 1.0
202
+ ]
203
+ },
204
+ "end_effector_rotation": {
205
+ "min": [
206
+ -1.0,
207
+ -1.0,
208
+ -1.0
209
+ ],
210
+ "max": [
211
+ 1.0,
212
+ 1.0,
213
+ 1.0
214
+ ],
215
+ "mean": [
216
+ 0.007235987111926079,
217
+ -0.023321982473134995,
218
+ -0.0024119403678923845
219
+ ],
220
+ "std": [
221
+ 0.147710919380188,
222
+ 0.15399158000946045,
223
+ 0.13929523527622223
224
+ ],
225
+ "q01": [
226
+ -0.42321433901786804,
227
+ -0.5219977021217346,
228
+ -0.4101182746887207
229
+ ],
230
+ "q99": [
231
+ 0.47503985762596074,
232
+ 0.38744416117668146,
233
+ 0.4242807936668394
234
+ ]
235
+ },
236
+ "gripper_close": {
237
+ "min": [
238
+ 0.0
239
+ ],
240
+ "max": [
241
+ 1.0
242
+ ],
243
+ "mean": [
244
+ 0.34521719813346863
245
+ ],
246
+ "std": [
247
+ 0.47949448227882385
248
+ ],
249
+ "q01": [
250
+ 0.0
251
+ ],
252
+ "q99": [
253
+ 1.0
254
+ ]
255
+ },
256
+ "base_motion": {
257
+ "min": [
258
+ 0.0,
259
+ 0.0,
260
+ 0.0,
261
+ 0.0
262
+ ],
263
+ "max": [
264
+ 0.0,
265
+ 0.0,
266
+ 0.0,
267
+ 0.0
268
+ ],
269
+ "mean": [
270
+ 0.0,
271
+ 0.0,
272
+ 0.0,
273
+ 0.0
274
+ ],
275
+ "std": [
276
+ 0.0,
277
+ 0.0,
278
+ 0.0,
279
+ 0.0
280
+ ],
281
+ "q01": [
282
+ 0.0,
283
+ 0.0,
284
+ 0.0,
285
+ 0.0
286
+ ],
287
+ "q99": [
288
+ 0.0,
289
+ 0.0,
290
+ 0.0,
291
+ 0.0
292
+ ]
293
+ },
294
+ "control_mode": {
295
+ "min": [
296
+ 0.0
297
+ ],
298
+ "max": [
299
+ 0.0
300
+ ],
301
+ "mean": [
302
+ 0.0
303
+ ],
304
+ "std": [
305
+ 0.0
306
+ ],
307
+ "q01": [
308
+ 0.0
309
+ ],
310
+ "q99": [
311
+ 0.0
312
+ ]
313
+ }
314
+ },
315
+ "relative_action": {}
316
+ }
317
+ }
avg_L3/checkpoint-40000/trainer_state.json ADDED
The diff for this file is too large to render. See raw diff
 
avg_L3/checkpoint-40000/wandb_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"project": "wam-dit4dit-robocasa-ctxpool-bmethod", "run_id": "rc_bmethod_ctxpool_avg_L3_4latin_pd4ga2_4gpu"}
avg_L3/checkpoint-40000/zero_to_fp32.py ADDED
@@ -0,0 +1,790 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, AUTOEP_LAYERS_KEY,
37
+ AUTOEP_LAYERS_KEY_LEGACY, AUTOEP_ZERO3_EXPERT_STATE_FORMAT_KEY,
38
+ AUTOEP_ZERO3_PARTITIONED_EXPERT_STATE_FORMAT)
39
+
40
+
41
+ @dataclass
42
+ class zero_model_state:
43
+ buffers: dict()
44
+ param_shapes: dict()
45
+ shared_params: list
46
+ ds_version: int
47
+ frozen_param_shapes: dict()
48
+ frozen_param_fragments: dict()
49
+
50
+
51
+ debug = 0
52
+
53
+ # load to cpu
54
+ device = torch.device('cpu')
55
+
56
+
57
+ def atoi(text):
58
+ return int(text) if text.isdigit() else text
59
+
60
+
61
+ def natural_keys(text):
62
+ '''
63
+ alist.sort(key=natural_keys) sorts in human order
64
+ http://nedbatchelder.com/blog/200712/human_sorting.html
65
+ (See Toothy's implementation in the comments)
66
+ '''
67
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
68
+
69
+
70
+ def get_model_state_file(checkpoint_dir, zero_stage):
71
+ if not os.path.isdir(checkpoint_dir):
72
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
73
+
74
+ # there should be only one file
75
+ if zero_stage <= 2:
76
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
77
+ elif zero_stage == 3:
78
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
79
+
80
+ if not os.path.exists(file):
81
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
82
+
83
+ return file
84
+
85
+
86
+ def get_checkpoint_files(checkpoint_dir, glob_pattern):
87
+ # XXX: need to test that this simple glob rule works for multi-node setup too
88
+ ckpt_files = sorted(glob.glob(os.path.join(checkpoint_dir, glob_pattern)), key=natural_keys)
89
+
90
+ if len(ckpt_files) == 0:
91
+ raise FileNotFoundError(f"can't find {glob_pattern} files in directory '{checkpoint_dir}'")
92
+
93
+ return ckpt_files
94
+
95
+
96
+ def get_optim_files(checkpoint_dir):
97
+ return get_checkpoint_files(checkpoint_dir, "*_optim_states.pt")
98
+
99
+
100
+ def get_model_state_files(checkpoint_dir):
101
+ return get_checkpoint_files(checkpoint_dir, "*_model_states.pt")
102
+
103
+
104
+ def _has_autoep_zero3_partitioned_metadata(state_dict):
105
+ autoep_layers = state_dict.get(AUTOEP_LAYERS_KEY)
106
+ if autoep_layers is None:
107
+ autoep_layers = state_dict.get(AUTOEP_LAYERS_KEY_LEGACY)
108
+ if not isinstance(autoep_layers, list):
109
+ return False
110
+ return any(
111
+ isinstance(entry, dict)
112
+ and entry.get(AUTOEP_ZERO3_EXPERT_STATE_FORMAT_KEY) == AUTOEP_ZERO3_PARTITIONED_EXPERT_STATE_FORMAT
113
+ for entry in autoep_layers)
114
+
115
+
116
+ def _raise_if_autoep_zero3_partitioned_state(state_dict):
117
+ if _has_autoep_zero3_partitioned_metadata(state_dict):
118
+ raise NotImplementedError("zero_to_fp32 does not support AutoEP ZeRO-3 partition-native checkpoints. "
119
+ "AutoEP expert parameters are partitioned over expert replica groups, so "
120
+ "global data-parallel consolidation would produce incomplete expert tensors. "
121
+ "Use ds_to_universal.py for expert-aware conversion.")
122
+
123
+
124
+ def _raise_if_autoep_zero3_partitioned_checkpoint(model_files):
125
+ for file in model_files:
126
+ state_dict = torch.load(file, map_location=device, weights_only=False)
127
+ _raise_if_autoep_zero3_partitioned_state(state_dict)
128
+
129
+
130
+ def parse_model_states(files):
131
+ zero_model_states = []
132
+ for file in files:
133
+ state_dict = torch.load(file, map_location=device, weights_only=False)
134
+ _raise_if_autoep_zero3_partitioned_state(state_dict)
135
+
136
+ if BUFFER_NAMES not in state_dict:
137
+ raise ValueError(f"{file} is not a model state checkpoint")
138
+ buffer_names = state_dict[BUFFER_NAMES]
139
+ if debug:
140
+ print("Found buffers:", buffer_names)
141
+
142
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
143
+ buffers = {k: v.float() for k, v in state_dict["module"].items() if k in buffer_names}
144
+ param_shapes = state_dict[PARAM_SHAPES]
145
+
146
+ # collect parameters that are included in param_shapes
147
+ param_names = []
148
+ for s in param_shapes:
149
+ for name in s.keys():
150
+ param_names.append(name)
151
+
152
+ # update with frozen parameters
153
+ frozen_param_shapes = state_dict.get(FROZEN_PARAM_SHAPES, None)
154
+ if frozen_param_shapes is not None:
155
+ if debug:
156
+ print(f"Found frozen_param_shapes: {frozen_param_shapes}")
157
+ param_names += list(frozen_param_shapes.keys())
158
+
159
+ # handle shared params
160
+ shared_params = [[k, v] for k, v in state_dict["shared_params"].items()]
161
+
162
+ ds_version = state_dict.get(DS_VERSION, None)
163
+
164
+ frozen_param_fragments = state_dict.get(FROZEN_PARAM_FRAGMENTS, None)
165
+
166
+ z_model_state = zero_model_state(buffers=buffers,
167
+ param_shapes=param_shapes,
168
+ shared_params=shared_params,
169
+ ds_version=ds_version,
170
+ frozen_param_shapes=frozen_param_shapes,
171
+ frozen_param_fragments=frozen_param_fragments)
172
+ zero_model_states.append(z_model_state)
173
+
174
+ return zero_model_states
175
+
176
+
177
+ def parse_optim_states(files, ds_checkpoint_dir):
178
+ total_files = len(files)
179
+ state_dicts = []
180
+ for f in tqdm(files, desc='Loading checkpoint shards'):
181
+ state_dict = torch.load(f, map_location=device, mmap=True, weights_only=False)
182
+ # immediately discard the potentially huge 2 optimizer states as we only care for fp32 master weights
183
+ # and also handle the case where it was already removed by another helper script
184
+ state_dict["optimizer_state_dict"].pop("optimizer_state_dict", None)
185
+ state_dicts.append(state_dict)
186
+
187
+ if ZERO_STAGE not in state_dicts[0][OPTIMIZER_STATE_DICT]:
188
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
189
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
190
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
191
+
192
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
193
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
194
+ # use the max of the partition_count to get the dp world_size.
195
+
196
+ if type(world_size) is list:
197
+ world_size = max(world_size)
198
+
199
+ if world_size != total_files:
200
+ raise ValueError(
201
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
202
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
203
+ )
204
+
205
+ # the groups are named differently in each stage
206
+ if zero_stage <= 2:
207
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
208
+ elif zero_stage == 3:
209
+ fp32_groups_key = FP32_FLAT_GROUPS
210
+ else:
211
+ raise ValueError(f"unknown zero stage {zero_stage}")
212
+
213
+ fp32_flat_groups = [state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key] for i in range(len(state_dicts))]
214
+ return zero_stage, world_size, fp32_flat_groups
215
+
216
+
217
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters):
218
+ """
219
+ Returns fp32 state_dict reconstructed from ds checkpoint
220
+
221
+ Args:
222
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
223
+
224
+ """
225
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
226
+
227
+ # parse_model_states rejects AutoEP ZeRO-3 partition-native checkpoints
228
+ # before the expensive optimizer-shard load below.
229
+ model_files = get_model_state_files(ds_checkpoint_dir)
230
+ zero_model_states = parse_model_states(model_files)
231
+ print(f'Parsing checkpoint created by deepspeed=={zero_model_states[0].ds_version}')
232
+
233
+ optim_files = get_optim_files(ds_checkpoint_dir)
234
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
235
+ print(f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
236
+
237
+ if zero_stage <= 2:
238
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
239
+ exclude_frozen_parameters)
240
+ elif zero_stage == 3:
241
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
242
+ exclude_frozen_parameters)
243
+
244
+
245
+ def _zero2_merge_frozen_params(state_dict, zero_model_states):
246
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
247
+ return
248
+
249
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
250
+ frozen_param_fragments = zero_model_states[0].frozen_param_fragments
251
+
252
+ if debug:
253
+ num_elem = sum(s.numel() for s in frozen_param_shapes.values())
254
+ print(f'rank 0: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
255
+
256
+ wanted_params = len(frozen_param_shapes)
257
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
258
+ avail_numel = sum([p.numel() for p in frozen_param_fragments.values()])
259
+ print(f'Frozen params: Have {avail_numel} numels to process.')
260
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
261
+
262
+ total_params = 0
263
+ total_numel = 0
264
+ for name, shape in frozen_param_shapes.items():
265
+ total_params += 1
266
+ unpartitioned_numel = shape.numel()
267
+ total_numel += unpartitioned_numel
268
+
269
+ state_dict[name] = frozen_param_fragments[name]
270
+
271
+ if debug:
272
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
273
+
274
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
275
+
276
+
277
+ def _has_callable(obj, fn):
278
+ attr = getattr(obj, fn, None)
279
+ return callable(attr)
280
+
281
+
282
+ def _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
283
+ param_shapes = zero_model_states[0].param_shapes
284
+
285
+ # Reconstruction protocol:
286
+ #
287
+ # XXX: document this
288
+
289
+ if debug:
290
+ for i in range(world_size):
291
+ for j in range(len(fp32_flat_groups[0])):
292
+ print(f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
293
+
294
+ # XXX: memory usage doubles here (zero2)
295
+ num_param_groups = len(fp32_flat_groups[0])
296
+ merged_single_partition_of_fp32_groups = []
297
+ for i in range(num_param_groups):
298
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
299
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
300
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
301
+ avail_numel = sum(
302
+ [full_single_fp32_vector.numel() for full_single_fp32_vector in merged_single_partition_of_fp32_groups])
303
+
304
+ if debug:
305
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
306
+ wanted_numel = sum([sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
307
+ # not asserting if there is a mismatch due to possible padding
308
+ print(f"Have {avail_numel} numels to process.")
309
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
310
+
311
+ # params
312
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
313
+ # out-of-core computing solution
314
+ total_numel = 0
315
+ total_params = 0
316
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
317
+ offset = 0
318
+ avail_numel = full_single_fp32_vector.numel()
319
+ for name, shape in shapes.items():
320
+
321
+ unpartitioned_numel = shape.numel() if _has_callable(shape, 'numel') else math.prod(shape)
322
+ total_numel += unpartitioned_numel
323
+ total_params += 1
324
+
325
+ if debug:
326
+ print(f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} ")
327
+ state_dict[name] = full_single_fp32_vector.narrow(0, offset, unpartitioned_numel).view(shape)
328
+ offset += unpartitioned_numel
329
+
330
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
331
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
332
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
333
+ # live optimizer object, so we are checking that the numbers are within the right range
334
+ align_to = 2 * world_size
335
+
336
+ def zero2_align(x):
337
+ return align_to * math.ceil(x / align_to)
338
+
339
+ if debug:
340
+ print(f"original offset={offset}, avail_numel={avail_numel}")
341
+
342
+ offset = zero2_align(offset)
343
+ avail_numel = zero2_align(avail_numel)
344
+
345
+ if debug:
346
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
347
+
348
+ # Sanity check
349
+ if offset != avail_numel:
350
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
351
+
352
+ print(f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements")
353
+
354
+
355
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size, fp32_flat_groups, zero_model_states,
356
+ exclude_frozen_parameters):
357
+ state_dict = OrderedDict()
358
+
359
+ # buffers
360
+ buffers = zero_model_states[0].buffers
361
+ state_dict.update(buffers)
362
+ if debug:
363
+ print(f"added {len(buffers)} buffers")
364
+
365
+ if not exclude_frozen_parameters:
366
+ _zero2_merge_frozen_params(state_dict, zero_model_states)
367
+
368
+ _zero2_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
369
+
370
+ # recover shared parameters
371
+ for pair in zero_model_states[0].shared_params:
372
+ if pair[1] in state_dict:
373
+ state_dict[pair[0]] = state_dict[pair[1]]
374
+
375
+ return state_dict
376
+
377
+
378
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
379
+ remainder = unpartitioned_numel % world_size
380
+ padding_numel = (world_size - remainder) if remainder else 0
381
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
382
+ return partitioned_numel, padding_numel
383
+
384
+
385
+ def _zero3_merge_frozen_params(state_dict, world_size, zero_model_states):
386
+ if zero_model_states[0].frozen_param_shapes is None or len(zero_model_states[0].frozen_param_shapes) == 0:
387
+ return
388
+
389
+ if debug:
390
+ for i in range(world_size):
391
+ num_elem = sum(s.numel() for s in zero_model_states[i].frozen_param_fragments.values())
392
+ print(f'rank {i}: {FROZEN_PARAM_SHAPES}.numel = {num_elem}')
393
+
394
+ frozen_param_shapes = zero_model_states[0].frozen_param_shapes
395
+ wanted_params = len(frozen_param_shapes)
396
+ wanted_numel = sum(s.numel() for s in frozen_param_shapes.values())
397
+ avail_numel = sum([p.numel() for p in zero_model_states[0].frozen_param_fragments.values()]) * world_size
398
+ print(f'Frozen params: Have {avail_numel} numels to process.')
399
+ print(f'Frozen params: Need {wanted_numel} numels in {wanted_params} params')
400
+
401
+ total_params = 0
402
+ total_numel = 0
403
+ for name, shape in zero_model_states[0].frozen_param_shapes.items():
404
+ total_params += 1
405
+ unpartitioned_numel = shape.numel()
406
+ total_numel += unpartitioned_numel
407
+
408
+ param_frags = tuple(model_state.frozen_param_fragments[name] for model_state in zero_model_states)
409
+ state_dict[name] = torch.cat(param_frags, 0).narrow(0, 0, unpartitioned_numel).view(shape)
410
+
411
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
412
+
413
+ if debug:
414
+ print(
415
+ f"Frozen params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
416
+ )
417
+
418
+ print(f"Reconstructed Frozen fp32 state dict with {total_params} params {total_numel} elements")
419
+
420
+
421
+ class GatheredTensor:
422
+ """
423
+ A pseudo tensor that collects partitioned weights.
424
+ It is more memory efficient when there are multiple groups.
425
+ """
426
+
427
+ def __init__(self, flat_groups, flat_groups_offset, offset, partitioned_numel, shape):
428
+ self.flat_groups = flat_groups
429
+ self.flat_groups_offset = flat_groups_offset
430
+ self.offset = offset
431
+ self.partitioned_numel = partitioned_numel
432
+ self.shape = shape
433
+ self.dtype = self.flat_groups[0][0].dtype
434
+
435
+ def contiguous(self):
436
+ """
437
+ Merge partitioned weights from flat_groups into a single tensor.
438
+ """
439
+ end_idx = self.offset + self.partitioned_numel
440
+ world_size = len(self.flat_groups)
441
+ pad_flat_param_chunks = []
442
+
443
+ for rank_i in range(world_size):
444
+ # for each rank, we need to collect weights from related group/groups
445
+ flat_groups_at_rank_i = self.flat_groups[rank_i]
446
+ start_group_id = None
447
+ end_group_id = None
448
+ for group_id in range(len(self.flat_groups_offset)):
449
+ if self.flat_groups_offset[group_id] <= self.offset < self.flat_groups_offset[group_id + 1]:
450
+ start_group_id = group_id
451
+ if self.flat_groups_offset[group_id] < end_idx <= self.flat_groups_offset[group_id + 1]:
452
+ end_group_id = group_id
453
+ break
454
+ # collect weights from related group/groups
455
+ for group_id in range(start_group_id, end_group_id + 1):
456
+ flat_tensor = flat_groups_at_rank_i[group_id]
457
+ start_offset = self.offset - self.flat_groups_offset[group_id]
458
+ end_offset = min(end_idx, self.flat_groups_offset[group_id + 1]) - self.flat_groups_offset[group_id]
459
+ pad_flat_param_chunks.append(flat_tensor[start_offset:end_offset])
460
+
461
+ # collect weights from all ranks
462
+ pad_flat_param = torch.cat(pad_flat_param_chunks, dim=0)
463
+ param = pad_flat_param[:self.shape.numel()].view(self.shape).contiguous()
464
+ return param
465
+
466
+
467
+ def _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states):
468
+ param_shapes = zero_model_states[0].param_shapes
469
+ avail_numel = sum([flat_group.numel() for flat_group in fp32_flat_groups[0]]) * world_size
470
+
471
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
472
+ # param, re-consolidating each param, while dealing with padding if any
473
+
474
+ # merge list of dicts, preserving order
475
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
476
+
477
+ if debug:
478
+ for i in range(world_size):
479
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
480
+
481
+ wanted_params = len(param_shapes)
482
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
483
+ # not asserting if there is a mismatch due to possible padding
484
+ avail_numel = fp32_flat_groups[0].numel() * world_size
485
+ print(f"Trainable params: Have {avail_numel} numels to process.")
486
+ print(f"Trainable params: Need {wanted_numel} numels in {wanted_params} params.")
487
+
488
+ # params
489
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
490
+ # out-of-core computing solution
491
+ offset = 0
492
+ total_numel = 0
493
+ total_params = 0
494
+ flat_groups_offset = [0] + list(np.cumsum([flat_tensor.numel() for flat_tensor in fp32_flat_groups[0]]))
495
+ for name, shape in tqdm(param_shapes.items(), desc='Gathering sharded weights'):
496
+ unpartitioned_numel = shape.numel()
497
+ total_numel += unpartitioned_numel
498
+ total_params += 1
499
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
500
+
501
+ if debug:
502
+ print(
503
+ f"Trainable params: {total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
504
+ )
505
+
506
+ # memory efficient tensor
507
+ tensor = GatheredTensor(fp32_flat_groups, flat_groups_offset, offset, partitioned_numel, shape)
508
+ state_dict[name] = tensor
509
+ offset += partitioned_numel
510
+
511
+ offset *= world_size
512
+
513
+ # Sanity check
514
+ if offset != avail_numel:
515
+ raise ValueError(f"consumed {offset} numels out of {avail_numel} - something is wrong")
516
+
517
+ print(f"Reconstructed Trainable fp32 state dict with {total_params} params {total_numel} elements")
518
+
519
+
520
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size, fp32_flat_groups, zero_model_states,
521
+ exclude_frozen_parameters):
522
+ state_dict = OrderedDict()
523
+
524
+ # buffers
525
+ buffers = zero_model_states[0].buffers
526
+ state_dict.update(buffers)
527
+ if debug:
528
+ print(f"added {len(buffers)} buffers")
529
+
530
+ if not exclude_frozen_parameters:
531
+ _zero3_merge_frozen_params(state_dict, world_size, zero_model_states)
532
+
533
+ _zero3_merge_trainable_params(state_dict, world_size, fp32_flat_groups, zero_model_states)
534
+
535
+ # recover shared parameters
536
+ for pair in zero_model_states[0].shared_params:
537
+ if pair[1] in state_dict:
538
+ state_dict[pair[0]] = state_dict[pair[1]]
539
+
540
+ return state_dict
541
+
542
+
543
+ def to_torch_tensor(state_dict, return_empty_tensor=False):
544
+ """
545
+ Convert state_dict of GatheredTensor to torch tensor
546
+ """
547
+ torch_state_dict = {}
548
+ converted_tensors = {}
549
+ for name, tensor in state_dict.items():
550
+ tensor_id = id(tensor)
551
+ if tensor_id in converted_tensors: # shared tensors
552
+ shared_tensor = torch_state_dict[converted_tensors[tensor_id]]
553
+ torch_state_dict[name] = shared_tensor
554
+ else:
555
+ converted_tensors[tensor_id] = name
556
+ if return_empty_tensor:
557
+ torch_state_dict[name] = torch.empty(tensor.shape, dtype=tensor.dtype)
558
+ else:
559
+ torch_state_dict[name] = tensor.contiguous()
560
+ return torch_state_dict
561
+
562
+
563
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
564
+ tag=None,
565
+ exclude_frozen_parameters=False,
566
+ lazy_mode=False):
567
+ """
568
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
569
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
570
+ via a model hub.
571
+
572
+ Args:
573
+ - ``checkpoint_dir``: path to the desired checkpoint folder
574
+ - ``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``
575
+ - ``exclude_frozen_parameters``: exclude frozen parameters
576
+ - ``lazy_mode``: get state_dict in lazy mode. It returns a dict of pesduo tensor instead of torch tensor, which is more memory efficient.
577
+ Convert the pesduo tensor to torch tensor by ``.contiguous()``
578
+
579
+ Returns:
580
+ - pytorch ``state_dict``
581
+
582
+ A typical usage might be ::
583
+
584
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
585
+ # do the training and checkpoint saving
586
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
587
+ model = model.cpu() # move to cpu
588
+ model.load_state_dict(state_dict)
589
+ # submit to model hub or save the model to share with others
590
+
591
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
592
+ application. i.e. you will need to re-initialize the deepspeed engine, since
593
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
594
+
595
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
596
+
597
+ Note: the above usage may not work if your application doesn't have sufficient free CPU memory.
598
+ You may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
599
+ the checkpoint. Or you can load state_dict in lazy mode ::
600
+
601
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
602
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, lazy_mode=True) # not on cpu
603
+ for name, lazy_tensor in state_dict.item():
604
+ tensor = lazy_tensor.contiguous() # to cpu
605
+ print(name, tensor)
606
+ # del tensor to release memory if it no longer in use
607
+ """
608
+ if tag is None:
609
+ latest_path = os.path.join(checkpoint_dir, 'latest')
610
+ if os.path.isfile(latest_path):
611
+ with open(latest_path, 'r') as fd:
612
+ tag = fd.read().strip()
613
+ else:
614
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
615
+
616
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
617
+
618
+ if not os.path.isdir(ds_checkpoint_dir):
619
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
620
+
621
+ state_dict = _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir, exclude_frozen_parameters)
622
+ if lazy_mode:
623
+ return state_dict
624
+ else:
625
+ return to_torch_tensor(state_dict)
626
+
627
+
628
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir,
629
+ output_dir,
630
+ max_shard_size="5GB",
631
+ safe_serialization=False,
632
+ tag=None,
633
+ exclude_frozen_parameters=False):
634
+ """
635
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
636
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
637
+
638
+ Args:
639
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
640
+ - ``output_dir``: directory to the pytorch fp32 state_dict output files
641
+ - ``max_shard_size``: the maximum size for a checkpoint before being sharded, default value is 5GB
642
+ - ``safe_serialization``: whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).
643
+ - ``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``
644
+ - ``exclude_frozen_parameters``: exclude frozen parameters
645
+ """
646
+
647
+ # Dependency pre-check
648
+ if safe_serialization:
649
+ try:
650
+ from safetensors.torch import save_file
651
+ except ImportError:
652
+ print('If you want to use `safe_serialization`, please `pip install safetensors`')
653
+ raise
654
+ if max_shard_size is not None:
655
+ try:
656
+ from huggingface_hub import split_torch_state_dict_into_shards
657
+ except ImportError:
658
+ print('If you want to use `max_shard_size`, please `pip install huggingface_hub`')
659
+ raise
660
+
661
+ # Convert zero checkpoint to state_dict
662
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir,
663
+ tag,
664
+ exclude_frozen_parameters,
665
+ lazy_mode=True)
666
+
667
+ # Shard the model if it is too big.
668
+ weights_name = "model.safetensors" if safe_serialization else "pytorch_model.bin"
669
+ if max_shard_size is not None:
670
+ filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
671
+ # an memory-efficient approach for sharding
672
+ empty_state_dict = to_torch_tensor(state_dict, return_empty_tensor=True)
673
+ state_dict_split = split_torch_state_dict_into_shards(empty_state_dict,
674
+ filename_pattern=filename_pattern,
675
+ max_shard_size=max_shard_size)
676
+ else:
677
+ from collections import namedtuple
678
+ StateDictSplit = namedtuple("StateDictSplit", ["is_sharded", "filename_to_tensors"])
679
+ state_dict_split = StateDictSplit(is_sharded=False,
680
+ filename_to_tensors={weights_name: list(state_dict.keys())})
681
+
682
+ # Save the model by shard
683
+ os.makedirs(output_dir, exist_ok=True)
684
+ filename_to_tensors = state_dict_split.filename_to_tensors.items()
685
+ for shard_file, tensors in tqdm(filename_to_tensors, desc="Saving checkpoint shards"):
686
+ shard_state_dict = {tensor_name: state_dict[tensor_name] for tensor_name in tensors}
687
+ shard_state_dict = to_torch_tensor(shard_state_dict)
688
+ output_path = os.path.join(output_dir, shard_file)
689
+ if safe_serialization:
690
+ save_file(shard_state_dict, output_path, metadata={"format": "pt"})
691
+ else:
692
+ torch.save(shard_state_dict, output_path)
693
+ # release the memory of current shard
694
+ for tensor_name in list(shard_state_dict.keys()):
695
+ del state_dict[tensor_name]
696
+ del shard_state_dict[tensor_name]
697
+ del shard_state_dict
698
+ gc.collect()
699
+
700
+ # Save index if sharded
701
+ if state_dict_split.is_sharded:
702
+ index = {
703
+ "metadata": state_dict_split.metadata,
704
+ "weight_map": state_dict_split.tensor_to_filename,
705
+ }
706
+ save_index_file = "model.safetensors.index.json" if safe_serialization else "pytorch_model.bin.index.json"
707
+ save_index_file = os.path.join(output_dir, save_index_file)
708
+ with open(save_index_file, "w", encoding="utf-8") as f:
709
+ content = json.dumps(index, indent=2, sort_keys=True) + "\n"
710
+ f.write(content)
711
+
712
+
713
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
714
+ """
715
+ 1. Put the provided model to cpu
716
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
717
+ 3. Load it into the provided model
718
+
719
+ Args:
720
+ - ``model``: the model object to update
721
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
722
+ - ``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``
723
+
724
+ Returns:
725
+ - ``model`: modified model
726
+
727
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
728
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
729
+ conveniently placed for you in the checkpoint folder.
730
+
731
+ A typical usage might be ::
732
+
733
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
734
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
735
+ # submit to model hub or save the model to share with others
736
+
737
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
738
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
739
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
740
+
741
+ """
742
+ logger.info("Extracting fp32 weights")
743
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
744
+
745
+ logger.info("Overwriting model with fp32 weights")
746
+ model = model.cpu()
747
+ model.load_state_dict(state_dict, strict=False)
748
+
749
+ return model
750
+
751
+
752
+ if __name__ == "__main__":
753
+ parser = argparse.ArgumentParser()
754
+ parser.add_argument("checkpoint_dir",
755
+ type=str,
756
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
757
+ parser.add_argument("output_dir",
758
+ type=str,
759
+ help="directory to the pytorch fp32 state_dict output files"
760
+ "(e.g. path/checkpoint-12-output/)")
761
+ parser.add_argument(
762
+ "--max_shard_size",
763
+ type=str,
764
+ default="5GB",
765
+ help="The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size"
766
+ "lower than this size. If expressed as a string, needs to be digits followed by a unit (like `5MB`"
767
+ "We default it to 5GB in order for models to be able to run easily on free-tier google colab instances"
768
+ "without CPU OOM issues.")
769
+ parser.add_argument(
770
+ "--safe_serialization",
771
+ default=False,
772
+ action='store_true',
773
+ help="Whether to save the model using `safetensors` or the traditional PyTorch way (that uses `pickle`).")
774
+ parser.add_argument("-t",
775
+ "--tag",
776
+ type=str,
777
+ default=None,
778
+ help="checkpoint tag used as a unique identifier for checkpoint. e.g., global_step1")
779
+ parser.add_argument("--exclude_frozen_parameters", action='store_true', help="exclude frozen parameters")
780
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
781
+ args = parser.parse_args()
782
+
783
+ debug = args.debug
784
+
785
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir,
786
+ args.output_dir,
787
+ max_shard_size=args.max_shard_size,
788
+ safe_serialization=args.safe_serialization,
789
+ tag=args.tag,
790
+ exclude_frozen_parameters=args.exclude_frozen_parameters)