nielsbantilan commited on
Commit
ae9a926
1 Parent(s): cff5bac

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +9 -0
  2. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/config.json +26 -0
  3. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/generation_config.json +6 -0
  4. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_0_mp_rank_00_model_states.pt +3 -0
  5. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_0_mp_rank_00_optim_states.pt +3 -0
  6. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_1_mp_rank_00_model_states.pt +3 -0
  7. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_1_mp_rank_00_optim_states.pt +3 -0
  8. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_2_mp_rank_00_model_states.pt +3 -0
  9. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_2_mp_rank_00_optim_states.pt +3 -0
  10. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_3_mp_rank_00_model_states.pt +3 -0
  11. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_3_mp_rank_00_optim_states.pt +3 -0
  12. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_4_mp_rank_00_model_states.pt +3 -0
  13. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_4_mp_rank_00_optim_states.pt +3 -0
  14. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_5_mp_rank_00_model_states.pt +3 -0
  15. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_5_mp_rank_00_optim_states.pt +3 -0
  16. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_6_mp_rank_00_model_states.pt +3 -0
  17. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_6_mp_rank_00_optim_states.pt +3 -0
  18. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_7_mp_rank_00_model_states.pt +3 -0
  19. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_7_mp_rank_00_optim_states.pt +3 -0
  20. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/latest +1 -0
  21. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/pytorch_model.bin +3 -0
  22. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_0.pth +3 -0
  23. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_1.pth +3 -0
  24. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_2.pth +3 -0
  25. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_3.pth +3 -0
  26. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_4.pth +3 -0
  27. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_5.pth +3 -0
  28. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_6.pth +3 -0
  29. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_7.pth +3 -0
  30. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/special_tokens_map.json +6 -0
  31. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/tokenizer.json +0 -0
  32. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/tokenizer_config.json +11 -0
  33. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/trainer_state.json +256 -0
  34. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/training_args.bin +3 -0
  35. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/zero_to_fp32.py +483 -0
  36. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/config.json +26 -0
  37. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/debug-cli.root.log +0 -0
  38. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-382w8jx3/sandbox/local_flytekit/4c88b3443a486fa98c9f8908f5506f41/00000 +3 -0
  39. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-a3aeeflm/sandbox/local_flytekit/inputs.pb +3 -0
  40. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-c7zgddfp/sandbox/local_flytekit/5e22530fba8df34cc608ffa8c222bf1b/00000 +3 -0
  41. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-d910h29y/sandbox/local_flytekit/25e7ee325700a77a2b99075d05ec0e1b/00000 +3 -0
  42. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-pdg_kayz/sandbox/local_flytekit/5c3b680058677bfc4c4820e5987b6b18/00000 +3 -0
  43. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-ugk2fa0x/sandbox/local_flytekit/55362ebdf1c1050e32c5e11bd4950f3a/00000 +3 -0
  44. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uhboju04/sandbox/local_flytekit/c32e366273dfbfb4fe28ea3b76e650e7/00000 +3 -0
  45. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uzrqm4fm/sandbox/local_flytekit/aa57f7d5c2606666a9c805e3219e4290/00000 +3 -0
  46. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-y_wtkdev/sandbox/local_flytekit/4314274ef766fffe04a99df31a991f30/00000 +3 -0
  47. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte_training_config.json +1 -0
  48. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/generation_config.json +6 -0
  49. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/.no_exist/094fbdd0c911feb485ce55de1952ab2e75277e1e/added_tokens.json +0 -0
  50. flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/.no_exist/094fbdd0c911feb485ce55de1952ab2e75277e1e/merges.txt +0 -0
.gitattributes CHANGED
@@ -68,3 +68,12 @@ flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/flyte-rpzbckua/san
68
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/flyte-so3w79m7/sandbox/local_flytekit/32f5ab2fae65d042c0a6d22025dea3ac/00000 filter=lfs diff=lfs merge=lfs -text
69
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/flyte-udcr2wl6/sandbox/local_flytekit/1e3263ea13800320141857b26ef32688/00000 filter=lfs diff=lfs merge=lfs -text
70
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/blobs/844708c42241de49775b872663ad58422a35b8e5a7d50b1f808408db8c1fb84b filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
68
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/flyte-so3w79m7/sandbox/local_flytekit/32f5ab2fae65d042c0a6d22025dea3ac/00000 filter=lfs diff=lfs merge=lfs -text
69
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/flyte-udcr2wl6/sandbox/local_flytekit/1e3263ea13800320141857b26ef32688/00000 filter=lfs diff=lfs merge=lfs -text
70
  flyte7xlnw_t7/local_flytekit/4ab756a0f57dd11dd93940145c628b70/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/blobs/844708c42241de49775b872663ad58422a35b8e5a7d50b1f808408db8c1fb84b filter=lfs diff=lfs merge=lfs -text
71
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-382w8jx3/sandbox/local_flytekit/4c88b3443a486fa98c9f8908f5506f41/00000 filter=lfs diff=lfs merge=lfs -text
72
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-c7zgddfp/sandbox/local_flytekit/5e22530fba8df34cc608ffa8c222bf1b/00000 filter=lfs diff=lfs merge=lfs -text
73
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-d910h29y/sandbox/local_flytekit/25e7ee325700a77a2b99075d05ec0e1b/00000 filter=lfs diff=lfs merge=lfs -text
74
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-pdg_kayz/sandbox/local_flytekit/5c3b680058677bfc4c4820e5987b6b18/00000 filter=lfs diff=lfs merge=lfs -text
75
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-ugk2fa0x/sandbox/local_flytekit/55362ebdf1c1050e32c5e11bd4950f3a/00000 filter=lfs diff=lfs merge=lfs -text
76
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uhboju04/sandbox/local_flytekit/c32e366273dfbfb4fe28ea3b76e650e7/00000 filter=lfs diff=lfs merge=lfs -text
77
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uzrqm4fm/sandbox/local_flytekit/aa57f7d5c2606666a9c805e3219e4290/00000 filter=lfs diff=lfs merge=lfs -text
78
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-y_wtkdev/sandbox/local_flytekit/4314274ef766fffe04a99df31a991f30/00000 filter=lfs diff=lfs merge=lfs -text
79
+ flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/blobs/844708c42241de49775b872663ad58422a35b8e5a7d50b1f808408db8c1fb84b filter=lfs diff=lfs merge=lfs -text
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "togethercomputer/RedPajama-INCITE-Base-3B-v1",
3
+ "architectures": [
4
+ "GPTNeoXForCausalLM"
5
+ ],
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": 0.1,
8
+ "eos_token_id": 0,
9
+ "hidden_act": "gelu",
10
+ "hidden_size": 2560,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 10240,
13
+ "layer_norm_eps": 1e-05,
14
+ "max_position_embeddings": 2048,
15
+ "model_type": "gpt_neox",
16
+ "num_attention_heads": 32,
17
+ "num_hidden_layers": 32,
18
+ "rotary_emb_base": 10000,
19
+ "rotary_pct": 1.0,
20
+ "tie_word_embeddings": false,
21
+ "torch_dtype": "float16",
22
+ "transformers_version": "4.29.2",
23
+ "use_cache": true,
24
+ "use_parallel_residual": false,
25
+ "vocab_size": 50432
26
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.29.2"
6
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_0_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b443973cf22380c2fc16584c972c310902059fa4c63e51a119e69b6f308eb800
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/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:d6787553b3e8478fbb464ffe2a2853d9a134d05d7c06b9c73bf27b4dc40c1ca8
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_1_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53a733b98fead9026a9e9b3c991b94d5afe9362cd870a68a5d993bba3b2884b8
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_1_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b4fdb00150d6cbd23d63d06437f63d607eff593e434a040578b03a0a3e0636e
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_2_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f771a4631a295abb6667f1eef70ff6fbefff786402fbbfef2217d86f4026171
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_2_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7fea132091a15f7daa55d3a4d43726501974454e3ccad0a103d52a1f6a7d8b3a
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_3_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ecb932c3f382d6a7f6c688ef26c4e32534ca433b33d56ba4b70df8438a6fe4b
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_3_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:205e45caf0a44e886ee36cac4a4d40ea787f1841723963ff8194c319a7e3481f
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_4_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10720f1a234f7b2ab376a623d5218887e48cfdcacad17725993844b0eda0763e
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_4_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:548bf66ce543d3ed57485cbda186fc8db9bab6381c0b3c7eb9634d572662cadd
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_5_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:210b90a137e881d53e17439d919c913a9dd8ead2859a89f55a8e65260b9b8c0a
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_5_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4677ce5e7b8ec18a66928493450dba598e12c191a207cd683580248876befc4c
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_6_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12494b56eedd538b14b95fd268aabdf9b41a1a5c6cd79d74588ee9ec4d27c09a
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_6_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d948a9c3f5efc1f767cbd9376871f7feb26885d218b80a623c62544f46e4432
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_7_mp_rank_00_model_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdc870118a24cd9aa6a6d4b6ec8233b37421cdea47cd9bc43821f1c4d36cdcd5
3
+ size 134451731
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/global_step400/zero_pp_rank_7_mp_rank_00_optim_states.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f098bcef0aaad73b511323689dde104708e88d4b20052557cee754ac1e3bb800
3
+ size 4163799934
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/latest ADDED
@@ -0,0 +1 @@
 
 
1
+ global_step400
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2baf929fc95bef2cf669334d46693c0d8619f1a1448c9212da17cd1e763d0078
3
+ size 5686106713
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_0.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c33ff1e041f229f4929cd97511d3c423d186f19cb6173c3db48c240efcf70881
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_1.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d75f98d7698df1a84d8f114e180dc07f88196eb1e62db22097c618e0af0574cd
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_2.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25e8a95b9250ee223d8c57e65392774a9237a60fb54d2db69fb85cdb93a9a49a
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_3.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e61948c058462ad7ccb54fee505c1bfe4dbb9041544e61068b6cfd694ebf5ea6
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_4.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9157b495a851a922fe34c153dede72697fe3d7aaa523ae6d01458b4e73596e2
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51c481c375beeab8f3e9499de5329d40d050e68b1f3694bb18a171e314bef5b9
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_6.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:14db20c93668b240215c58b2feb33ddd28a7f48e49d94018d685b5532c081b4c
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/rng_state_7.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10486fa7d708e6ecd2c4c14193cfad0a4eca6bfe6eb706f1225edc15b375d0b6
3
+ size 21687
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/special_tokens_map.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<|endoftext|>",
3
+ "eos_token": "<|endoftext|>",
4
+ "pad_token": "[PAD]",
5
+ "unk_token": "<|endoftext|>"
6
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/tokenizer_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "bos_token": "<|endoftext|>",
4
+ "clean_up_tokenization_spaces": true,
5
+ "eos_token": "<|endoftext|>",
6
+ "model_max_length": 512,
7
+ "pad_token": "[PAD]",
8
+ "padding_side": "right",
9
+ "tokenizer_class": "GPTNeoXTokenizer",
10
+ "unk_token": "<|endoftext|>"
11
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/trainer_state.json ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "best_metric": null,
3
+ "best_model_checkpoint": null,
4
+ "epoch": 266.6666666666667,
5
+ "global_step": 400,
6
+ "is_hyper_param_search": false,
7
+ "is_local_process_zero": true,
8
+ "is_world_process_zero": true,
9
+ "log_history": [
10
+ {
11
+ "epoch": 6.67,
12
+ "learning_rate": 1.5357481488588927e-05,
13
+ "loss": 1.9835,
14
+ "step": 10
15
+ },
16
+ {
17
+ "epoch": 13.33,
18
+ "learning_rate": 2e-05,
19
+ "loss": 1.0763,
20
+ "step": 20
21
+ },
22
+ {
23
+ "epoch": 20.0,
24
+ "learning_rate": 2e-05,
25
+ "loss": 0.2284,
26
+ "step": 30
27
+ },
28
+ {
29
+ "epoch": 26.67,
30
+ "learning_rate": 2e-05,
31
+ "loss": 0.0691,
32
+ "step": 40
33
+ },
34
+ {
35
+ "epoch": 33.33,
36
+ "learning_rate": 2e-05,
37
+ "loss": 0.0442,
38
+ "step": 50
39
+ },
40
+ {
41
+ "epoch": 40.0,
42
+ "learning_rate": 2e-05,
43
+ "loss": 0.0319,
44
+ "step": 60
45
+ },
46
+ {
47
+ "epoch": 46.67,
48
+ "learning_rate": 2e-05,
49
+ "loss": 0.0243,
50
+ "step": 70
51
+ },
52
+ {
53
+ "epoch": 53.33,
54
+ "learning_rate": 2e-05,
55
+ "loss": 0.0186,
56
+ "step": 80
57
+ },
58
+ {
59
+ "epoch": 60.0,
60
+ "learning_rate": 2e-05,
61
+ "loss": 0.0149,
62
+ "step": 90
63
+ },
64
+ {
65
+ "epoch": 66.67,
66
+ "learning_rate": 2e-05,
67
+ "loss": 0.0119,
68
+ "step": 100
69
+ },
70
+ {
71
+ "epoch": 73.33,
72
+ "learning_rate": 2e-05,
73
+ "loss": 0.0103,
74
+ "step": 110
75
+ },
76
+ {
77
+ "epoch": 80.0,
78
+ "learning_rate": 2e-05,
79
+ "loss": 0.0091,
80
+ "step": 120
81
+ },
82
+ {
83
+ "epoch": 86.67,
84
+ "learning_rate": 2e-05,
85
+ "loss": 0.0081,
86
+ "step": 130
87
+ },
88
+ {
89
+ "epoch": 93.33,
90
+ "learning_rate": 2e-05,
91
+ "loss": 0.0073,
92
+ "step": 140
93
+ },
94
+ {
95
+ "epoch": 100.0,
96
+ "learning_rate": 2e-05,
97
+ "loss": 0.0064,
98
+ "step": 150
99
+ },
100
+ {
101
+ "epoch": 106.67,
102
+ "learning_rate": 2e-05,
103
+ "loss": 0.0064,
104
+ "step": 160
105
+ },
106
+ {
107
+ "epoch": 113.33,
108
+ "learning_rate": 2e-05,
109
+ "loss": 0.0059,
110
+ "step": 170
111
+ },
112
+ {
113
+ "epoch": 120.0,
114
+ "learning_rate": 2e-05,
115
+ "loss": 0.0057,
116
+ "step": 180
117
+ },
118
+ {
119
+ "epoch": 126.67,
120
+ "learning_rate": 2e-05,
121
+ "loss": 0.0054,
122
+ "step": 190
123
+ },
124
+ {
125
+ "epoch": 133.33,
126
+ "learning_rate": 2e-05,
127
+ "loss": 0.0052,
128
+ "step": 200
129
+ },
130
+ {
131
+ "epoch": 140.0,
132
+ "learning_rate": 2e-05,
133
+ "loss": 0.0049,
134
+ "step": 210
135
+ },
136
+ {
137
+ "epoch": 146.67,
138
+ "learning_rate": 2e-05,
139
+ "loss": 0.0046,
140
+ "step": 220
141
+ },
142
+ {
143
+ "epoch": 153.33,
144
+ "learning_rate": 2e-05,
145
+ "loss": 0.0045,
146
+ "step": 230
147
+ },
148
+ {
149
+ "epoch": 160.0,
150
+ "learning_rate": 2e-05,
151
+ "loss": 0.0044,
152
+ "step": 240
153
+ },
154
+ {
155
+ "epoch": 166.67,
156
+ "learning_rate": 2e-05,
157
+ "loss": 0.0043,
158
+ "step": 250
159
+ },
160
+ {
161
+ "epoch": 173.33,
162
+ "learning_rate": 2e-05,
163
+ "loss": 0.0044,
164
+ "step": 260
165
+ },
166
+ {
167
+ "epoch": 180.0,
168
+ "learning_rate": 2e-05,
169
+ "loss": 0.0043,
170
+ "step": 270
171
+ },
172
+ {
173
+ "epoch": 186.67,
174
+ "learning_rate": 2e-05,
175
+ "loss": 0.0044,
176
+ "step": 280
177
+ },
178
+ {
179
+ "epoch": 193.33,
180
+ "learning_rate": 2e-05,
181
+ "loss": 0.0041,
182
+ "step": 290
183
+ },
184
+ {
185
+ "epoch": 200.0,
186
+ "learning_rate": 2e-05,
187
+ "loss": 0.0042,
188
+ "step": 300
189
+ },
190
+ {
191
+ "epoch": 206.67,
192
+ "learning_rate": 2e-05,
193
+ "loss": 0.0043,
194
+ "step": 310
195
+ },
196
+ {
197
+ "epoch": 213.33,
198
+ "learning_rate": 2e-05,
199
+ "loss": 0.004,
200
+ "step": 320
201
+ },
202
+ {
203
+ "epoch": 220.0,
204
+ "learning_rate": 2e-05,
205
+ "loss": 0.004,
206
+ "step": 330
207
+ },
208
+ {
209
+ "epoch": 226.67,
210
+ "learning_rate": 2e-05,
211
+ "loss": 0.0041,
212
+ "step": 340
213
+ },
214
+ {
215
+ "epoch": 233.33,
216
+ "learning_rate": 2e-05,
217
+ "loss": 0.0039,
218
+ "step": 350
219
+ },
220
+ {
221
+ "epoch": 240.0,
222
+ "learning_rate": 2e-05,
223
+ "loss": 0.0039,
224
+ "step": 360
225
+ },
226
+ {
227
+ "epoch": 246.67,
228
+ "learning_rate": 2e-05,
229
+ "loss": 0.0038,
230
+ "step": 370
231
+ },
232
+ {
233
+ "epoch": 253.33,
234
+ "learning_rate": 2e-05,
235
+ "loss": 0.0039,
236
+ "step": 380
237
+ },
238
+ {
239
+ "epoch": 260.0,
240
+ "learning_rate": 2e-05,
241
+ "loss": 0.0039,
242
+ "step": 390
243
+ },
244
+ {
245
+ "epoch": 266.67,
246
+ "learning_rate": 2e-05,
247
+ "loss": 0.0038,
248
+ "step": 400
249
+ }
250
+ ],
251
+ "max_steps": 500,
252
+ "num_train_epochs": 500,
253
+ "total_flos": 168282732625920.0,
254
+ "trial_name": null,
255
+ "trial_params": null
256
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2188a20782c485df4937a49e7b018f87feb047b94549b3e8907cdc9eff5c9801
3
+ size 5563
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/checkpoint-400/zero_to_fp32.py ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ '''Copyright The Microsoft DeepSpeed Team'''
3
+
4
+ # This script extracts fp32 consolidated weights from a zero 2 and 3 DeepSpeed checkpoints. It gets
5
+ # copied into the top level checkpoint dir, so the user can easily do the conversion at any point in
6
+ # the future. Once extracted, the weights don't require DeepSpeed and can be used in any
7
+ # application.
8
+ #
9
+ # example: python zero_to_fp32.py . pytorch_model.bin
10
+
11
+ import argparse
12
+ import torch
13
+ import glob
14
+ import math
15
+ import os
16
+ import re
17
+ from collections import OrderedDict
18
+
19
+ # while this script doesn't use deepspeed to recover data, since the checkpoints are pickled with
20
+ # DeepSpeed data structures it has to be available in the current python environment.
21
+ from deepspeed.utils import logger
22
+ from deepspeed.checkpoint.constants import (DS_VERSION,
23
+ OPTIMIZER_STATE_DICT,
24
+ SINGLE_PARTITION_OF_FP32_GROUPS,
25
+ FP32_FLAT_GROUPS,
26
+ ZERO_STAGE,
27
+ PARTITION_COUNT,
28
+ PARAM_SHAPES,
29
+ BUFFER_NAMES)
30
+
31
+ debug = 0
32
+
33
+ # load to cpu
34
+ device = torch.device('cpu')
35
+
36
+
37
+ def atoi(text):
38
+ return int(text) if text.isdigit() else text
39
+
40
+
41
+ def natural_keys(text):
42
+ '''
43
+ alist.sort(key=natural_keys) sorts in human order
44
+ http://nedbatchelder.com/blog/200712/human_sorting.html
45
+ (See Toothy's implementation in the comments)
46
+ '''
47
+ return [atoi(c) for c in re.split(r'(\d+)', text)]
48
+
49
+
50
+ def get_model_state_file(checkpoint_dir, zero_stage):
51
+ if not os.path.isdir(checkpoint_dir):
52
+ raise FileNotFoundError(f"Directory '{checkpoint_dir}' doesn't exist")
53
+
54
+ # there should be only one file
55
+ if zero_stage == 2:
56
+ file = os.path.join(checkpoint_dir, "mp_rank_00_model_states.pt")
57
+ elif zero_stage == 3:
58
+ file = os.path.join(checkpoint_dir, "zero_pp_rank_0_mp_rank_00_model_states.pt")
59
+
60
+ if not os.path.exists(file):
61
+ raise FileNotFoundError(f"can't find model states file at '{file}'")
62
+
63
+ return file
64
+
65
+
66
+ def get_optim_files(checkpoint_dir):
67
+ # XXX: need to test that this simple glob rule works for multi-node setup too
68
+ optim_files = sorted(glob.glob(os.path.join(checkpoint_dir,
69
+ "*_optim_states.pt")),
70
+ key=natural_keys)
71
+
72
+ if len(optim_files) == 0:
73
+ raise FileNotFoundError(
74
+ f"can't find '*_optim_states.pt' files in directory '{checkpoint_dir}'")
75
+
76
+ return optim_files
77
+
78
+
79
+ def parse_model_state(file):
80
+ state_dict = torch.load(file, map_location=device)
81
+
82
+ if BUFFER_NAMES not in state_dict:
83
+ raise ValueError(f"{file} is not a model state checkpoint")
84
+ buffer_names = state_dict[BUFFER_NAMES]
85
+ if debug:
86
+ print("Found buffers:", buffer_names)
87
+
88
+ # recover just the buffers while restoring them to fp32 if they were saved in fp16
89
+ buffers = {
90
+ k: v.float()
91
+ for k,
92
+ v in state_dict["module"].items() if k in buffer_names
93
+ }
94
+ param_shapes = state_dict[PARAM_SHAPES]
95
+
96
+ ds_version = state_dict.get(DS_VERSION, None)
97
+
98
+ return buffers, param_shapes, ds_version
99
+
100
+
101
+ def parse_optim_states(files, ds_checkpoint_dir):
102
+
103
+ total_files = len(files)
104
+ state_dicts = []
105
+ for f in files:
106
+ state_dicts.append(torch.load(f, map_location=device))
107
+
108
+ if not ZERO_STAGE in state_dicts[0][OPTIMIZER_STATE_DICT]:
109
+ raise ValueError(f"{files[0]} is not a zero checkpoint")
110
+ zero_stage = state_dicts[0][OPTIMIZER_STATE_DICT][ZERO_STAGE]
111
+ world_size = state_dicts[0][OPTIMIZER_STATE_DICT][PARTITION_COUNT]
112
+
113
+ # For ZeRO-2 each param group can have different partition_count as data parallelism for expert
114
+ # parameters can be different from data parallelism for non-expert parameters. So we can just
115
+ # use the max of the partition_count to get the dp world_size.
116
+
117
+ if type(world_size) is list:
118
+ world_size = max(world_size)
119
+
120
+ if world_size != total_files:
121
+ raise ValueError(
122
+ f"Expected {world_size} of '*_optim_states.pt' under '{ds_checkpoint_dir}' but found {total_files} files. "
123
+ "Possibly due to an overwrite of an old checkpoint, or a checkpoint didn't get saved by one or more processes."
124
+ )
125
+
126
+ # the groups are named differently in each stage
127
+ if zero_stage == 2:
128
+ fp32_groups_key = SINGLE_PARTITION_OF_FP32_GROUPS
129
+ elif zero_stage == 3:
130
+ fp32_groups_key = FP32_FLAT_GROUPS
131
+ else:
132
+ raise ValueError(f"unknown zero stage {zero_stage}")
133
+
134
+ if zero_stage == 2:
135
+ fp32_flat_groups = [
136
+ state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key]
137
+ for i in range(len(state_dicts))
138
+ ]
139
+ elif zero_stage == 3:
140
+ # if there is more than one param group, there will be multiple flattened tensors - one
141
+ # flattened tensor per group - for simplicity merge them into a single tensor
142
+ #
143
+ # XXX: could make the script more memory efficient for when there are multiple groups - it
144
+ # will require matching the sub-lists of param_shapes for each param group flattened tensor
145
+
146
+ fp32_flat_groups = [
147
+ torch.cat(state_dicts[i][OPTIMIZER_STATE_DICT][fp32_groups_key],
148
+ 0) for i in range(len(state_dicts))
149
+ ]
150
+
151
+ return zero_stage, world_size, fp32_flat_groups
152
+
153
+
154
+ def _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir):
155
+ """
156
+ Returns fp32 state_dict reconstructed from ds checkpoint
157
+
158
+ Args:
159
+ - ``ds_checkpoint_dir``: path to the deepspeed checkpoint folder (where the optimizer files are)
160
+
161
+ """
162
+ print(f"Processing zero checkpoint '{ds_checkpoint_dir}'")
163
+
164
+ optim_files = get_optim_files(ds_checkpoint_dir)
165
+ zero_stage, world_size, fp32_flat_groups = parse_optim_states(optim_files, ds_checkpoint_dir)
166
+ print(
167
+ f"Detected checkpoint of type zero stage {zero_stage}, world_size: {world_size}")
168
+
169
+ model_file = get_model_state_file(ds_checkpoint_dir, zero_stage)
170
+ buffers, param_shapes, ds_version = parse_model_state(model_file)
171
+ print(f'Parsing checkpoint created by deepspeed=={ds_version}')
172
+
173
+ if zero_stage == 2:
174
+ return _get_fp32_state_dict_from_zero2_checkpoint(world_size,
175
+ param_shapes,
176
+ fp32_flat_groups,
177
+ buffers)
178
+ elif zero_stage == 3:
179
+ return _get_fp32_state_dict_from_zero3_checkpoint(world_size,
180
+ param_shapes,
181
+ fp32_flat_groups,
182
+ buffers)
183
+
184
+
185
+ def _get_fp32_state_dict_from_zero2_checkpoint(world_size,
186
+ param_shapes,
187
+ fp32_flat_groups,
188
+ buffers):
189
+
190
+ # Reconstruction protocol:
191
+ #
192
+ # XXX: document this
193
+
194
+ if debug:
195
+ for i in range(world_size):
196
+ for j in range(len(fp32_flat_groups[0])):
197
+ print(
198
+ f"{FP32_FLAT_GROUPS}[{i}][{j}].shape={fp32_flat_groups[i][j].shape}")
199
+
200
+ # XXX: memory usage doubles here (zero2)
201
+ num_param_groups = len(fp32_flat_groups[0])
202
+ merged_single_partition_of_fp32_groups = []
203
+ for i in range(num_param_groups):
204
+ merged_partitions = [sd[i] for sd in fp32_flat_groups]
205
+ full_single_fp32_vector = torch.cat(merged_partitions, 0)
206
+ merged_single_partition_of_fp32_groups.append(full_single_fp32_vector)
207
+ avail_numel = sum([
208
+ full_single_fp32_vector.numel()
209
+ for full_single_fp32_vector in merged_single_partition_of_fp32_groups
210
+ ])
211
+
212
+ if debug:
213
+ wanted_params = sum([len(shapes) for shapes in param_shapes])
214
+ wanted_numel = sum(
215
+ [sum(shape.numel() for shape in shapes.values()) for shapes in param_shapes])
216
+ # not asserting if there is a mismatch due to possible padding
217
+ print(f"Have {avail_numel} numels to process.")
218
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
219
+
220
+ state_dict = OrderedDict()
221
+
222
+ # buffers
223
+ state_dict.update(buffers)
224
+ if debug:
225
+ print(f"added {len(buffers)} buffers")
226
+
227
+ # params
228
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
229
+ # out-of-core computing solution
230
+ total_numel = 0
231
+ total_params = 0
232
+ for shapes, full_single_fp32_vector in zip(param_shapes, merged_single_partition_of_fp32_groups):
233
+ offset = 0
234
+ avail_numel = full_single_fp32_vector.numel()
235
+ for name, shape in shapes.items():
236
+
237
+ unpartitioned_numel = shape.numel()
238
+ total_numel += unpartitioned_numel
239
+ total_params += 1
240
+
241
+ if debug:
242
+ print(
243
+ f"{name} full shape: {shape} unpartitioned numel {unpartitioned_numel} "
244
+ )
245
+ state_dict[name] = full_single_fp32_vector.narrow(
246
+ 0,
247
+ offset,
248
+ unpartitioned_numel).view(shape)
249
+ offset += unpartitioned_numel
250
+
251
+ # Z2 started to align to 2*world_size to improve nccl performance. Therefore both offset and
252
+ # avail_numel can differ by anywhere between 0..2*world_size. Due to two unrelated complex
253
+ # paddings performed in the code it's almost impossible to predict the exact numbers w/o the
254
+ # live optimizer object, so we are checking that the numbers are within the right range
255
+ align_to = 2 * world_size
256
+
257
+ def zero2_align(x):
258
+ return align_to * math.ceil(x / align_to)
259
+
260
+ if debug:
261
+ print(f"original offset={offset}, avail_numel={avail_numel}")
262
+
263
+ offset = zero2_align(offset)
264
+ avail_numel = zero2_align(avail_numel)
265
+
266
+ if debug:
267
+ print(f"aligned offset={offset}, avail_numel={avail_numel}")
268
+
269
+ # Sanity check
270
+ if offset != avail_numel:
271
+ raise ValueError(
272
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
273
+
274
+ print(
275
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
276
+ )
277
+
278
+ return state_dict
279
+
280
+
281
+ def zero3_partitioned_param_info(unpartitioned_numel, world_size):
282
+ remainder = unpartitioned_numel % world_size
283
+ padding_numel = (world_size - remainder) if remainder else 0
284
+ partitioned_numel = math.ceil(unpartitioned_numel / world_size)
285
+ return partitioned_numel, padding_numel
286
+
287
+
288
+ def _get_fp32_state_dict_from_zero3_checkpoint(world_size,
289
+ param_shapes,
290
+ fp32_flat_groups,
291
+ buffers):
292
+
293
+ # Reconstruction protocol: For zero3 we need to zip the partitions together at boundary of each
294
+ # param, re-consolidating each param, while dealing with padding if any
295
+
296
+ avail_numel = fp32_flat_groups[0].numel() * world_size
297
+ # merge list of dicts, preserving order
298
+ param_shapes = {k: v for d in param_shapes for k, v in d.items()}
299
+
300
+ if debug:
301
+ for i in range(world_size):
302
+ print(f"{FP32_FLAT_GROUPS}[{i}].shape={fp32_flat_groups[i].shape}")
303
+
304
+ wanted_params = len(param_shapes)
305
+ wanted_numel = sum(shape.numel() for shape in param_shapes.values())
306
+ # not asserting if there is a mismatch due to possible padding
307
+ print(f"Have {avail_numel} numels to process.")
308
+ print(f"Need {wanted_numel} numels in {wanted_params} params.")
309
+
310
+ state_dict = OrderedDict()
311
+
312
+ # buffers
313
+ state_dict.update(buffers)
314
+ if debug:
315
+ print(f"added {len(buffers)} buffers")
316
+
317
+ # params
318
+ # XXX: for huge models that can't fit into the host's RAM we will have to recode this to support
319
+ # out-of-core computing solution
320
+ offset = 0
321
+ total_numel = 0
322
+ total_params = 0
323
+ for name, shape in param_shapes.items():
324
+
325
+ unpartitioned_numel = shape.numel()
326
+ total_numel += unpartitioned_numel
327
+ total_params += 1
328
+
329
+ partitioned_numel, partitioned_padding_numel = zero3_partitioned_param_info(unpartitioned_numel, world_size)
330
+
331
+ if debug:
332
+ print(
333
+ f"{total_params} {name} full shape: {shape} partition0 numel={partitioned_numel} partitioned_padding_numel={partitioned_padding_numel}"
334
+ )
335
+
336
+ # XXX: memory usage doubles here
337
+ state_dict[name] = torch.cat(
338
+ tuple(fp32_flat_groups[i].narrow(0,
339
+ offset,
340
+ partitioned_numel)
341
+ for i in range(world_size)),
342
+ 0).narrow(0,
343
+ 0,
344
+ unpartitioned_numel).view(shape)
345
+ offset += partitioned_numel
346
+
347
+ offset *= world_size
348
+
349
+ # Sanity check
350
+ if offset != avail_numel:
351
+ raise ValueError(
352
+ f"consumed {offset} numels out of {avail_numel} - something is wrong")
353
+
354
+ print(
355
+ f"Reconstructed fp32 state dict with {total_params} params {total_numel} elements"
356
+ )
357
+
358
+ return state_dict
359
+
360
+
361
+ def get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag=None):
362
+ """
363
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated state_dict that can be loaded with
364
+ ``load_state_dict()`` and used for training without DeepSpeed or shared with others, for example
365
+ via a model hub.
366
+
367
+ Args:
368
+ - ``checkpoint_dir``: path to the desired checkpoint folder
369
+ - ``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``
370
+
371
+ Returns:
372
+ - pytorch ``state_dict``
373
+
374
+ Note: this approach may not work if your application doesn't have sufficient free CPU memory and
375
+ you may need to use the offline approach using the ``zero_to_fp32.py`` script that is saved with
376
+ the checkpoint.
377
+
378
+ A typical usage might be ::
379
+
380
+ from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
381
+ # do the training and checkpoint saving
382
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
383
+ model = model.cpu() # move to cpu
384
+ model.load_state_dict(state_dict)
385
+ # submit to model hub or save the model to share with others
386
+
387
+ In this example the ``model`` will no longer be usable in the deepspeed context of the same
388
+ application. i.e. you will need to re-initialize the deepspeed engine, since
389
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
390
+
391
+ If you want it all done for you, use ``load_state_dict_from_zero_checkpoint`` instead.
392
+
393
+ """
394
+ if tag is None:
395
+ latest_path = os.path.join(checkpoint_dir, 'latest')
396
+ if os.path.isfile(latest_path):
397
+ with open(latest_path, 'r') as fd:
398
+ tag = fd.read().strip()
399
+ else:
400
+ raise ValueError(f"Unable to find 'latest' file at {latest_path}")
401
+
402
+ ds_checkpoint_dir = os.path.join(checkpoint_dir, tag)
403
+
404
+ if not os.path.isdir(ds_checkpoint_dir):
405
+ raise FileNotFoundError(f"Directory '{ds_checkpoint_dir}' doesn't exist")
406
+
407
+ return _get_fp32_state_dict_from_zero_checkpoint(ds_checkpoint_dir)
408
+
409
+
410
+ def convert_zero_checkpoint_to_fp32_state_dict(checkpoint_dir, output_file, tag=None):
411
+ """
412
+ Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict`` file that can be
413
+ loaded with ``torch.load(file)`` + ``load_state_dict()`` and used for training without DeepSpeed.
414
+
415
+ Args:
416
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
417
+ - ``output_file``: path to the pytorch fp32 state_dict output file (e.g. path/pytorch_model.bin)
418
+ - ``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``
419
+ """
420
+
421
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
422
+ print(f"Saving fp32 state dict to {output_file}")
423
+ torch.save(state_dict, output_file)
424
+
425
+
426
+ def load_state_dict_from_zero_checkpoint(model, checkpoint_dir, tag=None):
427
+ """
428
+ 1. Put the provided model to cpu
429
+ 2. Convert ZeRO 2 or 3 checkpoint into a single fp32 consolidated ``state_dict``
430
+ 3. Load it into the provided model
431
+
432
+ Args:
433
+ - ``model``: the model object to update
434
+ - ``checkpoint_dir``: path to the desired checkpoint folder. (one that contains the tag-folder, like ``global_step14``)
435
+ - ``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``
436
+
437
+ Returns:
438
+ - ``model`: modified model
439
+
440
+ Make sure you have plenty of CPU memory available before you call this function. If you don't
441
+ have enough use the ``zero_to_fp32.py`` utility to do the conversion. You will find it
442
+ conveniently placed for you in the checkpoint folder.
443
+
444
+ A typical usage might be ::
445
+
446
+ from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
447
+ model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
448
+ # submit to model hub or save the model to share with others
449
+
450
+ Note, that once this was run, the ``model`` will no longer be usable in the deepspeed context
451
+ of the same application. i.e. you will need to re-initialize the deepspeed engine, since
452
+ ``model.load_state_dict(state_dict)`` will remove all the deepspeed magic from it.
453
+
454
+ """
455
+ logger.info(f"Extracting fp32 weights")
456
+ state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir, tag)
457
+
458
+ logger.info(f"Overwriting model with fp32 weights")
459
+ model = model.cpu()
460
+ model.load_state_dict(state_dict, strict=False)
461
+
462
+ return model
463
+
464
+
465
+ if __name__ == "__main__":
466
+
467
+ parser = argparse.ArgumentParser()
468
+ parser.add_argument(
469
+ "checkpoint_dir",
470
+ type=str,
471
+ help="path to the desired checkpoint folder, e.g., path/checkpoint-12")
472
+ parser.add_argument(
473
+ "output_file",
474
+ type=str,
475
+ help=
476
+ "path to the pytorch fp32 state_dict output file (e.g. path/checkpoint-12/pytorch_model.bin)"
477
+ )
478
+ parser.add_argument("-d", "--debug", action='store_true', help="enable debug")
479
+ args = parser.parse_args()
480
+
481
+ debug = args.debug
482
+
483
+ convert_zero_checkpoint_to_fp32_state_dict(args.checkpoint_dir, args.output_file)
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/config.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "togethercomputer/RedPajama-INCITE-Base-3B-v1",
3
+ "architectures": [
4
+ "GPTNeoXForCausalLM"
5
+ ],
6
+ "bos_token_id": 0,
7
+ "classifier_dropout": 0.1,
8
+ "eos_token_id": 0,
9
+ "hidden_act": "gelu",
10
+ "hidden_size": 2560,
11
+ "initializer_range": 0.02,
12
+ "intermediate_size": 10240,
13
+ "layer_norm_eps": 1e-05,
14
+ "max_position_embeddings": 2048,
15
+ "model_type": "gpt_neox",
16
+ "num_attention_heads": 32,
17
+ "num_hidden_layers": 32,
18
+ "rotary_emb_base": 10000,
19
+ "rotary_pct": 1.0,
20
+ "tie_word_embeddings": false,
21
+ "torch_dtype": "float16",
22
+ "transformers_version": "4.29.2",
23
+ "use_cache": true,
24
+ "use_parallel_residual": false,
25
+ "vocab_size": 50432
26
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/debug-cli.root.log ADDED
File without changes
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-382w8jx3/sandbox/local_flytekit/4c88b3443a486fa98c9f8908f5506f41/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-a3aeeflm/sandbox/local_flytekit/inputs.pb ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f505b46f94a30383b5e43f20a92abda2b6cc1107511eda096d64f6dcec14b3a
3
+ size 1839
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-c7zgddfp/sandbox/local_flytekit/5e22530fba8df34cc608ffa8c222bf1b/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-d910h29y/sandbox/local_flytekit/25e7ee325700a77a2b99075d05ec0e1b/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-pdg_kayz/sandbox/local_flytekit/5c3b680058677bfc4c4820e5987b6b18/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-ugk2fa0x/sandbox/local_flytekit/55362ebdf1c1050e32c5e11bd4950f3a/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uhboju04/sandbox/local_flytekit/c32e366273dfbfb4fe28ea3b76e650e7/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-uzrqm4fm/sandbox/local_flytekit/aa57f7d5c2606666a9c805e3219e4290/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte-y_wtkdev/sandbox/local_flytekit/4314274ef766fffe04a99df31a991f30/00000 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:067772915d011157436dc1ea88cb38756555e25be2d07616d1ee97dfac6e6535
3
+ size 133886409
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/flyte_training_config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"base_model": "togethercomputer/RedPajama-INCITE-Base-3B-v1", "data_path": "wikipedia", "data_name": "20220301.simple", "num_epochs": 1, "max_steps": 500, "learning_rate": 2e-05, "weight_decay": 0.02, "warmup_ratio": 0.03, "lr_scheduler_type": "cosine", "batch_size": 16, "micro_batch_size": 1, "val_set_size": 0, "group_by_length": false, "instruction_key": "instruction", "input_key": "input", "output_key": "output", "device_map": "auto", "cache_dir": null, "optim": "adamw_torch", "model_max_length": 512, "debug_mode": false, "debug_train_data_size": 1024, "wandb_project": ""}
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 0,
5
+ "transformers_version": "4.29.2"
6
+ }
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/.no_exist/094fbdd0c911feb485ce55de1952ab2e75277e1e/added_tokens.json ADDED
File without changes
flyte7z9neqk5/local_flytekit/2002aa999dad15fe8dfd5901c73c9d2a/models--togethercomputer--RedPajama-INCITE-Base-3B-v1/.no_exist/094fbdd0c911feb485ce55de1952ab2e75277e1e/merges.txt ADDED
File without changes