eousphoros commited on
Commit
9fae48b
·
verified ·
1 Parent(s): a552333

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. README.md +23 -0
  2. SHA256SUMS +66 -0
  3. SHA256SUMS.bf16 +64 -0
  4. SHA256SUMS.fp8 +64 -0
  5. chat_template.jinja +170 -0
  6. config.json +140 -0
  7. fp32-release.json +1365 -0
  8. fp32_common.py +585 -0
  9. generation_config.json +12 -0
  10. masters_to_bf16.py +87 -0
  11. merge_lora.py +256 -0
  12. merges.txt +0 -0
  13. model-part-00001.safetensors +3 -0
  14. model-part-00005.safetensors +3 -0
  15. model-part-00007.safetensors +3 -0
  16. model-part-00008.safetensors +3 -0
  17. model-part-00011.safetensors +3 -0
  18. model-part-00013.safetensors +3 -0
  19. model-part-00015.safetensors +3 -0
  20. model-part-00017.safetensors +3 -0
  21. model-part-00018.safetensors +3 -0
  22. model-part-00021.safetensors +3 -0
  23. model-part-00023.safetensors +3 -0
  24. model-part-00025.safetensors +3 -0
  25. model-part-00026.safetensors +3 -0
  26. model-part-00027.safetensors +3 -0
  27. model-part-00028.safetensors +3 -0
  28. model-part-00029.safetensors +3 -0
  29. model-part-00031.safetensors +3 -0
  30. model-part-00033.safetensors +3 -0
  31. model-part-00035.safetensors +3 -0
  32. model-part-00036.safetensors +3 -0
  33. model-part-00037.safetensors +3 -0
  34. model-part-00038.safetensors +3 -0
  35. model-part-00039.safetensors +3 -0
  36. model-part-00041.safetensors +3 -0
  37. model-part-00043.safetensors +3 -0
  38. model-part-00044.safetensors +3 -0
  39. model-part-00045.safetensors +3 -0
  40. model-part-00047.safetensors +3 -0
  41. model-part-00048.safetensors +3 -0
  42. model-part-00051.safetensors +3 -0
  43. model-part-00053.safetensors +3 -0
  44. model.safetensors.index.json +0 -0
  45. mtp.json +30 -0
  46. preprocessor_config.json +21 -0
  47. to_fp8.py +155 -0
  48. tokenizer_config.json +305 -0
  49. video_preprocessor_config.json +21 -0
  50. vocab.json +0 -0
README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ pipeline_tag: image-text-to-text
5
+ base_model: Qwen/Qwen3.8-27B
6
+ base_model_relation: finetune
7
+ tags:
8
+ - experimental
9
+ - preview
10
+ ---
11
+
12
+ # Turnstone Lambda 671
13
+
14
+ Preview release of Turnstone Lambda 671. This repository contains the FP32 weights and export scripts. Other details, such as final pre-exported weights and benchmarks, are in flight. Based on the Qwen3.8-27B architecture. The RL rollout harness is a [fork of Turnstone](https://github.com/turnstonelabs/turnstone/pull/1604), hence the name.
15
+
16
+ ## Export
17
+
18
+ ```bash
19
+ python masters_to_bf16.py . ../turnstone-lambda-671-bf16 --check
20
+ python to_fp8.py . ../turnstone-lambda-671-fp8 --check
21
+ ```
22
+
23
+ `--check` compares the output with `SHA256SUMS.bf16` or `SHA256SUMS.fp8`. `mtp.safetensors` holds the MTP draft head; `--no-mtp` leaves it out. To merge a LoRA first: `python merge_lora.py . ADAPTER_DIR ../merged-fp32`.
SHA256SUMS ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c3cf9e34abf4f9e36c2d72165aa9c132d3e2a725b6c2586aaa3a8af9d7a81041 chat_template.jinja
2
+ 191e0af232104ed8b65258cf3fb2b842e288008baca7633c11b82a1ac7203aab config.json
3
+ 4a7218bc45f5c65a4c23beb63e8cd50b1cb25cbe9769f9e7c4d0d492521590bd fp32-release.json
4
+ e70c136c1b78ddc1fb0905bac8e733a4dc448d4f852a5dd75143fffc70be550e generation_config.json
5
+ a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt
6
+ 3b63ad07184a1fba566c5de37bde1cb67b639f4eb173fc42decf273f8b59ef9b model-part-00001.safetensors
7
+ a773f18b2ce598327aac20843ea2589e7d656e0ccabbdf5f71b1587018604b9e model-part-00002.safetensors
8
+ bdf9df3f826223b82a66469d2b4e98fc0036631d08deb2012482ad0e1d80fd91 model-part-00003.safetensors
9
+ 25ac351e4e294aecc3f162969be0dfe2274d7dd159ee4a01315ebee85c452665 model-part-00004.safetensors
10
+ 1c800dd082e55c356e9bbcc4dd6501d33bb007cd637500d52112de169d6e8202 model-part-00005.safetensors
11
+ 82f22b5686afc704be19ff7d2840118e9ab96d0261f0ed23ec6864de35a00831 model-part-00006.safetensors
12
+ 96073f636ccc950e643b91081152d41de2533c991ff876a40f8a5f0571e21de0 model-part-00007.safetensors
13
+ 716986ea6aab109bfd74fc0e9239420e32b5ac33b4950a8ba11f20b51baccbcb model-part-00008.safetensors
14
+ 973aeca6a6cb417053687dc25049f33442c04a902b5f5241849582f02b628ce4 model-part-00009.safetensors
15
+ 7677751226938a6e977d20bfa901189c821a2dc3c7332b2591e5d925627d4321 model-part-00010.safetensors
16
+ 949f4ea3075b5ecc03e4591229eb48273582dbdd5010534711003be4640051fc model-part-00011.safetensors
17
+ 54a4391c27541aaf695b5205e76dbebc09d4aaba099d16dc1da8bd6ff20c03bf model-part-00012.safetensors
18
+ c2ae678fe26319990d9ed2712dda707f2a3567312bb4fc4bdbc7e0cfac8e5c9b model-part-00013.safetensors
19
+ 15b95470dbe3bc413d0ba0037104d2ddf4e81dfc3b02067599020e9dfc109dae model-part-00014.safetensors
20
+ 130d646414d4129d822a24e514c55ad3b6f9d8ffbf7868a2e567d32a49e28ca1 model-part-00015.safetensors
21
+ 1625715a17d676346ea0ecfe089c2c26f58780f1198644732804661cb9b2b896 model-part-00016.safetensors
22
+ 2a61c57020da3b6a4cb9ee3b5344e52c5b37fd75fc1ede91563cf5c382633f22 model-part-00017.safetensors
23
+ 552958e1ea49ff2c5caeee254efe0e1219d47289d43144bc12a08c95d34ffd22 model-part-00018.safetensors
24
+ b15be5e18cbe73700ba9f8525187b94eb311b4c8e48b4c4b79c898195a8d4fd2 model-part-00019.safetensors
25
+ e6844984a8b5988a8795e8b7e2f15ff9ec217fffdce247b3f2ed2e51c3c4e4e5 model-part-00020.safetensors
26
+ c672b4020496230f5a35b47efa5b46d5a66e531b5b6e748831a54255250c1a74 model-part-00021.safetensors
27
+ 23a540c14698583389168be432281b23b16c3a715607408cf2f5ef42353fbf4b model-part-00022.safetensors
28
+ 628541f31c50c9d7e79ebfcc41b4c851b15ae2b487eeb5a7b3dca113c1d86bca model-part-00023.safetensors
29
+ 125f51ef46a335e62b5d4124d7e3c7d38ac442d9c2f619241036a660fd12952a model-part-00024.safetensors
30
+ dbbe74e032eaa89528532427a176ead28488038b98ce7a0a1a7c15d977b2e0c2 model-part-00025.safetensors
31
+ 4c7583b879f5b14e12f9ccbdc7b2222d054746cc854182f8155a0730fc596bdb model-part-00026.safetensors
32
+ 4df242169472c5172f66053c824b3a7d624ee8fe2598a96f0eb03e3491d12116 model-part-00027.safetensors
33
+ b41cacac783676e88a709360f890c3a38d80988ae1bfcfe2c53ca7d1273989c3 model-part-00028.safetensors
34
+ 25f58a16104fd08ae37971e22306cb0b9022aa32037a0d297821ed5975c636bf model-part-00029.safetensors
35
+ 190385635ad6f0890c665674ea01a0462c339a5e2071ef01cdfbe0e6a5e9d7c4 model-part-00030.safetensors
36
+ 0a14160649c5504bf5d21c96be02b56d1069b9bd335661ada4a6e9f65de93f4a model-part-00031.safetensors
37
+ 6dc940aff3f47a57682d619527b07ba4022408df8deb41c5256f024536c2cecb model-part-00032.safetensors
38
+ ad39bc53fc6542308032e919c3dafd1f638c9312b2f3e559c44267bef786b2a0 model-part-00033.safetensors
39
+ 9e92116bb742ff137443b5fbdb67b04a16d3131da013510bac5205d621031d2f model-part-00034.safetensors
40
+ fb4d8a4b15d3b950b446343439f72094a1cc8bba8d3c87e66ae9aef6e2d411cf model-part-00035.safetensors
41
+ c9099c0b4fe363a2238ba84be4e31a7bef8f9c2ae932e4b44d87eb04a44e3adc model-part-00036.safetensors
42
+ 49e4549da43e8f704e4f35683556befd7d83eb23896a9c706ee76a78f1b3efb9 model-part-00037.safetensors
43
+ 5694acdd4de4203e47235edb68b1723ef6a7944ca8236eef0737fe776afffb71 model-part-00038.safetensors
44
+ 6a0c3c45d6f6239d98a95459e4662242d3cfe819b64ad1d128e2dc32637e7154 model-part-00039.safetensors
45
+ 323a99fc58282711fd150ad0b2de276fe1340bdaea9113f39f0d4979a790e1c5 model-part-00040.safetensors
46
+ 86df8d4b6391fab5f9d5935147a6cea21eeb9040e783c7c83358d0b7c1fbc435 model-part-00041.safetensors
47
+ 4e96d283e5e14aaf36c8b4942b55dfa2b6f03773ab5c4028414c5815af82d300 model-part-00042.safetensors
48
+ c7190ff49af5afb133e599cf8f363f51dae7473e6d8eebab39090a491aeca8c2 model-part-00043.safetensors
49
+ 995c206ca10537f23bf3ec0c237b955291d200d6abccb5bef133eb5133044d94 model-part-00044.safetensors
50
+ 98a1899b71f9b1fab87006aae45f997492e56e91ef7f9ee7faec29ac3a82cbe2 model-part-00045.safetensors
51
+ 5c5d0edcf096e170970c163cd845c4f42db99cd30dd845169c6eb79c840cc05f model-part-00046.safetensors
52
+ ee6d7d15396c59d40596c2f746d60874eeab652e4adf73e8beef5e8b85eba175 model-part-00047.safetensors
53
+ bb343921bdcb78c275e34886953f726ed555aeb031cf5a26eaeaa83be75817f7 model-part-00048.safetensors
54
+ aa7a08af20289f5f3077969ddc3f5cf53ea4d6a66802d29ed111ce2282fae763 model-part-00049.safetensors
55
+ 89f3cf6a044126cc99aeee2090d5597b73c5d417ef52611d7b09077b02de8bb8 model-part-00050.safetensors
56
+ 64554b13bc43f8a453cb89100b92d0161f6cadfd1b25dc0a4744c0f12e94656f model-part-00051.safetensors
57
+ 87cd4cb70dadc02745b17967a29274fceddcc150b3c8145979efea78f8f7676f model-part-00052.safetensors
58
+ 11bc906b703d39acf82164de1b4f5ea71e2f66990a62f7d709cbcfad4c8bf63b model-part-00053.safetensors
59
+ 23d541c6273e11b8090b0c2ecd66fdeca6783015f547087e5ee4ac47de20b1a1 model.safetensors.index.json
60
+ 7184b0652c9eef85291fee126646a9d7437e8b8050e5b0d0dd90b31370427518 mtp.json
61
+ 7454f34b3a0cf80ceb03adc97d48dfba7644bec0f44c3a5f06182b06df4b7e2b mtp.safetensors
62
+ 27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 preprocessor_config.json
63
+ 0997f410c57a1f4e53b09e4be8f4a172d90edd9564368fb0847030937229b9f3 tokenizer.json
64
+ b11349aafa7cdc6a320767cf7ceb29ed82f7eda5d65e8e0819e76f0ce947bf27 tokenizer_config.json
65
+ 7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13 video_preprocessor_config.json
66
+ ce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003 vocab.json
SHA256SUMS.bf16 ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c3cf9e34abf4f9e36c2d72165aa9c132d3e2a725b6c2586aaa3a8af9d7a81041 chat_template.jinja
2
+ 191e0af232104ed8b65258cf3fb2b842e288008baca7633c11b82a1ac7203aab config.json
3
+ e70c136c1b78ddc1fb0905bac8e733a4dc448d4f852a5dd75143fffc70be550e generation_config.json
4
+ a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt
5
+ 355e8ef5db712fc78cf66a83bb05c326327543a8656d237be9250468c630b80a model-part-00001.safetensors
6
+ 5d38d109779e8bd1217615cbfc12c6a12bb3ccb58914334f50050f74921cb147 model-part-00002.safetensors
7
+ 2425df3662d1e5e51f0f6df53627c8dd33a51c99a6c50098b5aae05849f6cfef model-part-00003.safetensors
8
+ 86c20299125a968445e3656026d3d55fcca8a8bdb6257e472eee811526de0520 model-part-00004.safetensors
9
+ 69a8675c1ee3d6c995f9ee22b34c4d3b42bc1ab94e15d677e09a4e40c901febc model-part-00005.safetensors
10
+ 8138bfce52c2ff894011a836beea56987a78bdd2d79a6d8c9c11faf9c699db5b model-part-00006.safetensors
11
+ 7d50194d48442c518f163953a30cee8462d142e70adb2849130a0723d773e5e5 model-part-00007.safetensors
12
+ cb327577eee3f16403d74b415c28985c4c0b206d56d026bb0eb0e65d5c025cad model-part-00008.safetensors
13
+ 4deec02ee9bf42b75355580cefcdac95b9c817dd76335b57e6ed7b5a8cc96ed8 model-part-00009.safetensors
14
+ 65c6a6767917c789f3860708c3fa045dac2db2d65247b861bd761c27d5113922 model-part-00010.safetensors
15
+ b601b68fc5191630cccae61aea2a1228f6e89260f57307a037bf4b084686dfb6 model-part-00011.safetensors
16
+ ca68b23539ee66a02e41cef4d358f315df4cf3326d89d2f5e48e7258207e83ef model-part-00012.safetensors
17
+ a5dc6a27a8bf1c918712c7960b5427903460308d707e91eb0dbe64fdc0dbd56b model-part-00013.safetensors
18
+ de944ba4f3e23aeef9ac3d2ca276501bf4d1d964e8c6c6d402e801e6a7bfb872 model-part-00014.safetensors
19
+ 3910a5ca7ddb52635862a7f96fc1443f936296f7c5abb37071a8e3105725890d model-part-00015.safetensors
20
+ 2740a1b30966d8bbdfe016b914569fb12f5f8fdedee483a0f84f222fef7cda5f model-part-00016.safetensors
21
+ 7ead010e4a0867b3b6f7456e68ae9e4e45f6aa8cb2b73b39a63ec1422fc483e1 model-part-00017.safetensors
22
+ 0c51e80e571d37e252a43a2ca3c227aff22cbad36f1d5028c2b29702040f4b2e model-part-00018.safetensors
23
+ 9c92d328c3fd6be184dd48304fc23755e420d0175a91baa2b43fc573a9e37499 model-part-00019.safetensors
24
+ aca2eb2fd929013d9311874bb7ad6e4cc2fe0ae5d822def0776eb2c67e4d1cb3 model-part-00020.safetensors
25
+ 44a623cffda80279819ccea3d0be8f0ff392d41351baaaa2b7a166da1b366281 model-part-00021.safetensors
26
+ 65206f3aa08f052790196d3dd44463df481ea1426046e4af08113fb432468412 model-part-00022.safetensors
27
+ e0c88e58e4c9dd4e2c16f1b5ec2115b3f16557b47af1d0609979722da4162076 model-part-00023.safetensors
28
+ a98fd93b3dd41b18e075ca858d25b1647b23285aa58f3d20995553fb3f710f70 model-part-00024.safetensors
29
+ 220e071ec484a434ca583dec6418dbc8e36aaf3f328fafc109049d07d8815a93 model-part-00025.safetensors
30
+ 6182e25c289fc9bc205375588d63dbdd5dadfcf76b14e33d3b1e17821c4a8fa6 model-part-00026.safetensors
31
+ 9800e60e910ce72fd14e46e08f4aa8a871aeaf85a87373bd2c80bf11c3c37ac4 model-part-00027.safetensors
32
+ abff8dffc00cc9c33b1c06a81d7062f1d0f9fe5e20bff0c1271fc892c60594cc model-part-00028.safetensors
33
+ 7b00f940b34ad6b16342400c935b4775eef89f50830ca31903e60aebe6a675fa model-part-00029.safetensors
34
+ 4a7fb2d5a1b9ae620d555d11fdbb357ad503ff23ea650c27d25882d11b00397b model-part-00030.safetensors
35
+ 89ca89296031c88856ad448193b0036e42edc022f267e7ab7c452ad3d672fd14 model-part-00031.safetensors
36
+ 5f132b8ecbe7b6730d41434dc4ac510d225f8f78b207e34008f45b8b9474a59a model-part-00032.safetensors
37
+ 4d29b4119ae03ee338bc9efcf5c8b803e13aad6622160f900d0e45bae523e212 model-part-00033.safetensors
38
+ 4172f2e31208e9362f2b463e5433d980d47ea51cb0865cc72e4c7846dbdc6edc model-part-00034.safetensors
39
+ 5aca5437678abce1865843e120e026da83d68396794a46f55c5e4a6b128b192f model-part-00035.safetensors
40
+ 08e76a1e70cb9c1fec2a1cf5c2f2dc935d88edfbd05db29bd19369aa503881de model-part-00036.safetensors
41
+ 52a182934ac5e7501ef2d1f9f8ff5f258b2ee8ffbb0431a33e71da92713924eb model-part-00037.safetensors
42
+ 1feb91086dc970deec9136f5bebd843bab14558cd81d5886cf75c39f736b0d91 model-part-00038.safetensors
43
+ 51391e969646291ae543800c464cc10b51da84e1caf3d8b584f2f0e272e9b1b7 model-part-00039.safetensors
44
+ 0d477ddbe0bc1d7af87f9e1d1df2a0bc1f58a3e9412e6ddd7a0b03741cdc866d model-part-00040.safetensors
45
+ f8bd05cf3b29e0eeafe8a0b2521537b778e15c4d8938662acc28b80175d8c0fc model-part-00041.safetensors
46
+ 578191335a368a4836b0bb116ac07b2131be78e54b2b769b2764b6e4caea76a7 model-part-00042.safetensors
47
+ f12325f953bf54e71c52c7c968a23d480582414c472b1facf83132deb41f1bfd model-part-00043.safetensors
48
+ dae6194c8731b39ed68022549ba8fcca38d71cdf0eecc9aae9c95a4e2120e995 model-part-00044.safetensors
49
+ 21f32bf67820dec1aadfad9e0686243f1aaf5da402bc5f24d4e9a540a5abd4fd model-part-00045.safetensors
50
+ ae4add49901f15a7b4ab27166832cc9dc383ca724e966d0f934f4731a4f2a4cd model-part-00046.safetensors
51
+ 6845e64b4f134befde7ca014a5ea3f627a9e4957c8b239a6c715704baf33ffa8 model-part-00047.safetensors
52
+ ccaa75dbd86cbfb38d8d2d3b739b7396f9fe2452342095f94bf537e1b9f253ee model-part-00048.safetensors
53
+ ab6ebd0de7006019260971f570ec5479d6d78759e61fa03cf0fdfb2b40ab81a0 model-part-00049.safetensors
54
+ 2b5bcf9543277abb6d4b4790a6439102df57e8e186617e9c5b1fd7f2a2b6f9ed model-part-00050.safetensors
55
+ 79d301df5f7a5de7ecf78c77e8cdcb140b89537a51e95b280741677b010f4701 model-part-00051.safetensors
56
+ dd32076c103cf6e3a1757b0e1173fef02548ce5d97815c491290701c500995f8 model-part-00052.safetensors
57
+ 858a895d995a39ba59e523807eb33f7f9070cce3fdf66387ae375415a1db05e8 model-part-00053.safetensors
58
+ c5d97acb0a6b998fb118c83d5061b2d817597b7bde0989daa85d6bc9c08242a9 model-part-00054.safetensors
59
+ 2bfb40b84b71e39d624c92693267ced4f66c9aee0ba72140130df2bdef19bbc7 model.safetensors.index.json
60
+ 27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 preprocessor_config.json
61
+ 0997f410c57a1f4e53b09e4be8f4a172d90edd9564368fb0847030937229b9f3 tokenizer.json
62
+ b11349aafa7cdc6a320767cf7ceb29ed82f7eda5d65e8e0819e76f0ce947bf27 tokenizer_config.json
63
+ 7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13 video_preprocessor_config.json
64
+ ce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003 vocab.json
SHA256SUMS.fp8 ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c3cf9e34abf4f9e36c2d72165aa9c132d3e2a725b6c2586aaa3a8af9d7a81041 chat_template.jinja
2
+ 74227dd615bf1ea975aa676bdf355a0379858c12f394b5365cd9dfa5fc2c70bc config.json
3
+ e70c136c1b78ddc1fb0905bac8e733a4dc448d4f852a5dd75143fffc70be550e generation_config.json
4
+ a9d356d7bdf1ef4949e3e748e95b8e10ad9d4e2e838eddc38a0a7b6b94d1db8d merges.txt
5
+ 355e8ef5db712fc78cf66a83bb05c326327543a8656d237be9250468c630b80a model-part-00001.safetensors
6
+ 5d38d109779e8bd1217615cbfc12c6a12bb3ccb58914334f50050f74921cb147 model-part-00002.safetensors
7
+ 2425df3662d1e5e51f0f6df53627c8dd33a51c99a6c50098b5aae05849f6cfef model-part-00003.safetensors
8
+ 986965ddf1cff20b45f3e741c82600bedbae3ccc9f3a6d26d28d3e8dd7711c4a model-part-00004.safetensors
9
+ 5be53ef313b590f6ac73c65fc172d8c757f84c2cfa9be5798a9abc2086bbb81a model-part-00005.safetensors
10
+ 12de5c97374a806ac6e702370eed2a8759dfba216f37ed306e17a5ac69a2de60 model-part-00006.safetensors
11
+ b415f6bcdf59f9e60f34b7b71dc820e375332cdb43f3e2a6d9827b80822739a0 model-part-00007.safetensors
12
+ c89b87885948dcadfe8d9415002ad2184ba282177483099f064ca69db885b844 model-part-00008.safetensors
13
+ b70e8be1d5e5d08ff5a1c9526f0ea7c7bed66655e0a8cf77160e1e733a160d8e model-part-00009.safetensors
14
+ 8a200d710b807511726df05937e9b0d434a42ccf0a4ed0f078b34cd4051da00a model-part-00010.safetensors
15
+ eb6624a1e5b8c67ce78b5894fde553562a4c9252b2199f3b13981489bd51b325 model-part-00011.safetensors
16
+ 5eb9704cd2fb68e01d713f661cdfa941f72f9069869793d2a2d4c704662ee2ba model-part-00012.safetensors
17
+ 1e3c6de9a410da04038a01f6940a2c06d24c5b3a64711661242d452bdab7141b model-part-00013.safetensors
18
+ c9b199fccae22bbf79f9f55092c889e36b133e6fc894f8f4d30816a4e255dea5 model-part-00014.safetensors
19
+ ae187404d4a7e1feea792d402b7e41a5f6e7daafff744f8ebb4e693ace0825d0 model-part-00015.safetensors
20
+ 00ebf3cc96941d1beabab8fe5c29b84d1ae55eb19fa83fb2626da498fb333c80 model-part-00016.safetensors
21
+ 1b7975b28cbf78c9cc47738ed708c040a9d4ba8cdc9a9e9ea89a7f8b53e0618a model-part-00017.safetensors
22
+ 0a939c537f395d2fa1001ada1c88e25f6c1db983a82de68159a058565fc17038 model-part-00018.safetensors
23
+ 02afa2b20661da671fd5414fdd35bdc6ae6aac7cea1d269a2051509c4ef451ad model-part-00019.safetensors
24
+ f94171afe4cc7e8a03c79832db12fde700e5b234970738c53df22d6afc271c97 model-part-00020.safetensors
25
+ 72b099e3f28a1828e8dd0cd2976c56e2c8c140d93c19f12007cc42fe2b2e11ef model-part-00021.safetensors
26
+ 431619aacfa0cc19b7f6445c9f8192db445a111d6c5bdf7459adaad4716df182 model-part-00022.safetensors
27
+ fa5ec7fde7bddbcf6bc3d0fda479680fa5edd42a8ccf5cf287e9b0e51176806c model-part-00023.safetensors
28
+ 4b195b5e07a9006fed7d8f40c8177d36b933dab6f6af85fbc00646652c2d2c50 model-part-00024.safetensors
29
+ d3319d7f18b3c896ce47b4bd61d3d6282fdf238f0c1d92f58dc438e4c4884eb0 model-part-00025.safetensors
30
+ 7cf74c251182e557479d1052821374e8fafb168a672ad545448853a688ac6a2d model-part-00026.safetensors
31
+ fce8ecdfb256f6a7a0bb3443079234ccd855a0f7a8e82e44e283629585069717 model-part-00027.safetensors
32
+ d63e3c3c3394650e2a0334ac43f9c4517082d0cde796e1c8382d7b839b5ac2f1 model-part-00028.safetensors
33
+ 9c87ecc62f3ec4697a9284300b077733af456a547f1a6200dc1fdcae05aeb374 model-part-00029.safetensors
34
+ c30547e6b9b59dd04dc68472517f047cf56e5163a7489be67323b0a60227305f model-part-00030.safetensors
35
+ 1342ac3f0ca9fa879752f443b23bd66bdd8f3110b060c4f68af8dd95bd20fab1 model-part-00031.safetensors
36
+ 6523332cc7215bc22633aea44f4e93fcd817be9e803f656f0d63a38f81f31eb1 model-part-00032.safetensors
37
+ 9cc0041e444b07f3996f99c97384826d4edcdc3f013f727216b12b1aa6777e6b model-part-00033.safetensors
38
+ b34351eaa9094fd0332f711a9fdb6347f59521ac0490b39895ae9c670282c80f model-part-00034.safetensors
39
+ 5df0115f977249061ca2987a15ec156f202f1201423aad226a4b00b173764c82 model-part-00035.safetensors
40
+ c0f392bdd3206909cf8559939a4138272f2ea1e873f436b31ba9e33889ba3c1c model-part-00036.safetensors
41
+ 43b9421c94ce8265a67c4051ed697c8d49c0830792b8c4f0ec76556365abbc9b model-part-00037.safetensors
42
+ 7219c698167444ada9f15c7b9e87500acf5f098cae4936231ad281c9e9abcd08 model-part-00038.safetensors
43
+ 010754fccd97afd809b4085bd599099080e33ad35d257e30fdc7216cbb1c2a74 model-part-00039.safetensors
44
+ 07c7be7e38b36ce743d88cb73d46d5ad52a12afc986151dea5599e4d434ec447 model-part-00040.safetensors
45
+ ae1e61600f66504edb123b4057f28e5ea0d123da36943823abc17a1bfac20a74 model-part-00041.safetensors
46
+ b5bb9d3fbef6384df46239b92df6ab2fd4d980e53a5e20d8e770b49c331b8656 model-part-00042.safetensors
47
+ 952f83df2701b58a66345b61ec0c0438f8acd054a1479f13e7f09ce314dbf804 model-part-00043.safetensors
48
+ cfe9ead8164468dc15c0ec7578a6210a07cd90ff6da04b6bdff5bc67b65b8807 model-part-00044.safetensors
49
+ 9128f42bce010e4cee5e5ec86f1c9b128dd322b7dbcf6647b85b4e04e5c221b1 model-part-00045.safetensors
50
+ 4aff2dc240df5d25e6c1315c37b05a5080a63dc07a4defc308433db8b117868b model-part-00046.safetensors
51
+ 5224ade6ed16ffc92929aee2fbd1b035030934f78a9be854bab87968e978bb63 model-part-00047.safetensors
52
+ d4758ce9890d139ac1fe08b8bdaad6938bca09b877d560ce1a33250ec3db8318 model-part-00048.safetensors
53
+ 6b062c6df34d833cc54379ff7ed635d16fdc434ea830237520791a44d501b0db model-part-00049.safetensors
54
+ 30356bc71ef1fefaae1629d67a76fdce52bfd41e1350f6c3714fccd241e37c0e model-part-00050.safetensors
55
+ 284652f01543e0d26288a2202baf89e6c26c804c23082dbfe53d6f9d024e0a02 model-part-00051.safetensors
56
+ ef35a780d5cf5c2fd1f9bf161934e6be09016823248e6bf6eeb4e49d982f67b7 model-part-00052.safetensors
57
+ 1145fc8c99171f71c8ba8d1a0612701eff74b5c4a69c5c0a0b85389f538d9537 model-part-00053.safetensors
58
+ 6c203693250b9fae7f95b161152f752a9f606f985a044de47480b7d14e32374e model-part-00054.safetensors
59
+ de4086d48817477d6aa434003f426d1f3cf3725cc0e7e57921e6036d698348c8 model.safetensors.index.json
60
+ 27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 preprocessor_config.json
61
+ 0997f410c57a1f4e53b09e4be8f4a172d90edd9564368fb0847030937229b9f3 tokenizer.json
62
+ b11349aafa7cdc6a320767cf7ceb29ed82f7eda5d65e8e0819e76f0ce947bf27 tokenizer_config.json
63
+ 7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13 video_preprocessor_config.json
64
+ ce99b4cb2983d118806ce0a8b777a35b093e2000a503ebde25853284c9dfa003 vocab.json
chat_template.jinja ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set image_count = namespace(value=0) %}
2
+ {%- set video_count = namespace(value=0) %}
3
+ {%- macro render_content(content, do_vision_count, is_system_content=false) %}
4
+ {%- if content is string %}
5
+ {{- content }}
6
+ {%- elif content is iterable and content is not mapping %}
7
+ {%- for item in content %}
8
+ {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
9
+ {%- if is_system_content %}
10
+ {{- raise_exception('System message cannot contain images.') }}
11
+ {%- endif %}
12
+ {%- if do_vision_count %}
13
+ {%- set image_count.value = image_count.value + 1 %}
14
+ {%- endif %}
15
+ {%- if add_vision_id %}
16
+ {{- 'Picture ' ~ image_count.value ~ ': ' }}
17
+ {%- endif %}
18
+ {{- '<|vision_start|><|image_pad|><|vision_end|>' }}
19
+ {%- elif 'video' in item or item.type == 'video' %}
20
+ {%- if is_system_content %}
21
+ {{- raise_exception('System message cannot contain videos.') }}
22
+ {%- endif %}
23
+ {%- if do_vision_count %}
24
+ {%- set video_count.value = video_count.value + 1 %}
25
+ {%- endif %}
26
+ {%- if add_vision_id %}
27
+ {{- 'Video ' ~ video_count.value ~ ': ' }}
28
+ {%- endif %}
29
+ {{- '<|vision_start|><|video_pad|><|vision_end|>' }}
30
+ {%- elif 'text' in item %}
31
+ {{- item.text }}
32
+ {%- else %}
33
+ {{- raise_exception('Unexpected item type in content.') }}
34
+ {%- endif %}
35
+ {%- endfor %}
36
+ {%- elif content is none or content is undefined %}
37
+ {{- '' }}
38
+ {%- else %}
39
+ {{- raise_exception('Unexpected content type.') }}
40
+ {%- endif %}
41
+ {%- endmacro %}
42
+ {%- if not messages %}
43
+ {{- raise_exception('No messages provided.') }}
44
+ {%- endif %}
45
+ {%- set reasoning_instructions = '' %}
46
+ {%- if enable_thinking is undefined or enable_thinking is true %}
47
+ {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}
48
+ {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}
49
+ {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}
50
+ {%- endif %}
51
+ {%- if resolved_reasoning_effort == 'xhigh' %}
52
+ {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}
53
+ {%- elif resolved_reasoning_effort == 'low' %}
54
+ {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}
55
+ {%- endif %}
56
+ {%- endif %}
57
+ {%- if tools and tools is iterable and tools is not mapping %}
58
+ {{- '<|im_start|>system\n' }}
59
+ {%- if reasoning_instructions %}
60
+ {{- reasoning_instructions + '\n\n' }}
61
+ {%- endif %}
62
+ {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
63
+ {%- for tool in tools %}
64
+ {{- "\n" }}
65
+ {{- tool | tojson }}
66
+ {%- endfor %}
67
+ {{- "\n</tools>" }}
68
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
69
+ {%- if messages[0].role == 'system' %}
70
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
71
+ {%- if content %}
72
+ {{- '\n\n' + content }}
73
+ {%- endif %}
74
+ {%- endif %}
75
+ {{- '<|im_end|>\n' }}
76
+ {%- else %}
77
+ {%- if messages[0].role == 'system' %}
78
+ {%- set content = render_content(messages[0].content, false, true)|trim %}
79
+ {%- if content %}
80
+ {{- '<|im_start|>system\n' + (reasoning_instructions + '\n\n' if reasoning_instructions else '') + content + '<|im_end|>\n' }}
81
+ {%- elif reasoning_instructions %}
82
+ {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
83
+ {%- endif %}
84
+ {%- elif reasoning_instructions %}
85
+ {{- '<|im_start|>system\n' + reasoning_instructions + '<|im_end|>\n' }}
86
+ {%- endif %}
87
+ {%- endif %}
88
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
89
+ {%- for message in messages[::-1] %}
90
+ {%- set index = (messages|length - 1) - loop.index0 %}
91
+ {%- if ns.multi_step_tool and message.role == "user" %}
92
+ {%- set content = render_content(message.content, false)|trim %}
93
+ {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
94
+ {%- set ns.multi_step_tool = false %}
95
+ {%- set ns.last_query_index = index %}
96
+ {%- endif %}
97
+ {%- endif %}
98
+ {%- endfor %}
99
+ {%- if ns.multi_step_tool %}
100
+ {{- raise_exception('No user query found in messages.') }}
101
+ {%- endif %}
102
+ {%- for message in messages %}
103
+ {%- set content = render_content(message.content, true)|trim %}
104
+ {%- if message.role == "system" %}
105
+ {%- if not loop.first %}
106
+ {{- raise_exception('System message must be at the beginning.') }}
107
+ {%- endif %}
108
+ {%- elif message.role == "user" %}
109
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
110
+ {%- elif message.role == "assistant" %}
111
+ {%- set reasoning_content = '' %}
112
+ {%- if message.reasoning_content is string %}
113
+ {%- set reasoning_content = message.reasoning_content %}
114
+ {%- endif %}
115
+ {%- set reasoning_content = reasoning_content|trim %}
116
+ {%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %}
117
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
118
+ {%- else %}
119
+ {{- '<|im_start|>' + message.role + '\n' + content }}
120
+ {%- endif %}
121
+ {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
122
+ {%- for tool_call in message.tool_calls %}
123
+ {%- if tool_call.function is defined %}
124
+ {%- set tool_call = tool_call.function %}
125
+ {%- endif %}
126
+ {%- if loop.first %}
127
+ {%- if content|trim %}
128
+ {{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
129
+ {%- else %}
130
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
131
+ {%- endif %}
132
+ {%- else %}
133
+ {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
134
+ {%- endif %}
135
+ {%- if tool_call.arguments is defined and tool_call.arguments != '' %}
136
+ {%- for args_name, args_value in tool_call.arguments|items %}
137
+ {{- '<parameter=' + args_name + '>\n' }}
138
+ {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
139
+ {{- args_value }}
140
+ {{- '\n</parameter>\n' }}
141
+ {%- endfor %}
142
+ {%- endif %}
143
+ {{- '</function>\n</tool_call>' }}
144
+ {%- endfor %}
145
+ {%- endif %}
146
+ {{- '<|im_end|>\n' }}
147
+ {%- elif message.role == "tool" %}
148
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
149
+ {{- '<|im_start|>user' }}
150
+ {%- endif %}
151
+ {{- '\n<tool_response>\n' }}
152
+ {{- content }}
153
+ {{- '\n</tool_response>' }}
154
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
155
+ {{- '<|im_end|>\n' }}
156
+ {%- elif loop.last %}
157
+ {{- '<|im_end|>\n' }}
158
+ {%- endif %}
159
+ {%- else %}
160
+ {{- raise_exception('Unexpected message role.') }}
161
+ {%- endif %}
162
+ {%- endfor %}
163
+ {%- if add_generation_prompt %}
164
+ {{- '<|im_start|>assistant\n' }}
165
+ {%- if enable_thinking is defined and enable_thinking is false %}
166
+ {{- '<think>\n\n</think>\n\n' }}
167
+ {%- else %}
168
+ {{- '<think>\n' }}
169
+ {%- endif %}
170
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen3_5ForConditionalGeneration"
4
+ ],
5
+ "image_token_id": 248056,
6
+ "language_model_only": false,
7
+ "model_type": "qwen3_5",
8
+ "text_config": {
9
+ "attention_bias": false,
10
+ "attention_dropout": 0.0,
11
+ "attn_output_gate": true,
12
+ "bos_token_id": 248044,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 248044,
15
+ "full_attention_interval": 4,
16
+ "head_dim": 256,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 5120,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 17408,
21
+ "layer_types": [
22
+ "linear_attention",
23
+ "linear_attention",
24
+ "linear_attention",
25
+ "full_attention",
26
+ "linear_attention",
27
+ "linear_attention",
28
+ "linear_attention",
29
+ "full_attention",
30
+ "linear_attention",
31
+ "linear_attention",
32
+ "linear_attention",
33
+ "full_attention",
34
+ "linear_attention",
35
+ "linear_attention",
36
+ "linear_attention",
37
+ "full_attention",
38
+ "linear_attention",
39
+ "linear_attention",
40
+ "linear_attention",
41
+ "full_attention",
42
+ "linear_attention",
43
+ "linear_attention",
44
+ "linear_attention",
45
+ "full_attention",
46
+ "linear_attention",
47
+ "linear_attention",
48
+ "linear_attention",
49
+ "full_attention",
50
+ "linear_attention",
51
+ "linear_attention",
52
+ "linear_attention",
53
+ "full_attention",
54
+ "linear_attention",
55
+ "linear_attention",
56
+ "linear_attention",
57
+ "full_attention",
58
+ "linear_attention",
59
+ "linear_attention",
60
+ "linear_attention",
61
+ "full_attention",
62
+ "linear_attention",
63
+ "linear_attention",
64
+ "linear_attention",
65
+ "full_attention",
66
+ "linear_attention",
67
+ "linear_attention",
68
+ "linear_attention",
69
+ "full_attention",
70
+ "linear_attention",
71
+ "linear_attention",
72
+ "linear_attention",
73
+ "full_attention",
74
+ "linear_attention",
75
+ "linear_attention",
76
+ "linear_attention",
77
+ "full_attention",
78
+ "linear_attention",
79
+ "linear_attention",
80
+ "linear_attention",
81
+ "full_attention",
82
+ "linear_attention",
83
+ "linear_attention",
84
+ "linear_attention",
85
+ "full_attention"
86
+ ],
87
+ "linear_conv_kernel_dim": 4,
88
+ "linear_key_head_dim": 128,
89
+ "linear_num_key_heads": 16,
90
+ "linear_num_value_heads": 48,
91
+ "linear_value_head_dim": 128,
92
+ "mamba_ssm_dtype": "float32",
93
+ "max_position_embeddings": 262144,
94
+ "model_type": "qwen3_5_text",
95
+ "mtp_num_hidden_layers": 1,
96
+ "mtp_use_dedicated_embeddings": false,
97
+ "num_attention_heads": 24,
98
+ "num_hidden_layers": 64,
99
+ "num_key_value_heads": 4,
100
+ "output_gate_type": "swish",
101
+ "pad_token_id": null,
102
+ "partial_rotary_factor": 0.25,
103
+ "rms_norm_eps": 1e-06,
104
+ "rope_parameters": {
105
+ "mrope_interleaved": true,
106
+ "mrope_section": [
107
+ 11,
108
+ 11,
109
+ 10
110
+ ],
111
+ "partial_rotary_factor": 0.25,
112
+ "rope_theta": 10000000,
113
+ "rope_type": "default"
114
+ },
115
+ "tie_word_embeddings": false,
116
+ "use_cache": true,
117
+ "vocab_size": 248320
118
+ },
119
+ "tie_word_embeddings": false,
120
+ "transformers_version": "5.8.0.dev0",
121
+ "video_token_id": 248057,
122
+ "vision_config": {
123
+ "deepstack_visual_indexes": [],
124
+ "depth": 27,
125
+ "hidden_act": "gelu_pytorch_tanh",
126
+ "hidden_size": 1152,
127
+ "in_channels": 3,
128
+ "initializer_range": 0.02,
129
+ "intermediate_size": 4304,
130
+ "model_type": "qwen3_5",
131
+ "num_heads": 16,
132
+ "num_position_embeddings": 2304,
133
+ "out_hidden_size": 5120,
134
+ "patch_size": 16,
135
+ "spatial_merge_size": 2,
136
+ "temporal_patch_size": 2
137
+ },
138
+ "vision_end_token_id": 248054,
139
+ "vision_start_token_id": 248053
140
+ }
fp32-release.json ADDED
@@ -0,0 +1,1365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "fp32-masters-v1",
3
+ "source": {
4
+ "run": "grpo-mixed-2",
5
+ "step": 11,
6
+ "checkpoint": "checkpoint-0011",
7
+ "complete_json_sha256": "1e4d994ab4030585eb91605b02988e860bf3159483d56721954e3a0969154145",
8
+ "optimizer_file": "optimizer-0.pt",
9
+ "optimizer_file_sha256": "a4b0fadbce5b55e50ff73e23ebf86cb87762af8c21bc2f2d88084c5ea8451916",
10
+ "optimizer_file_sha256_checked": true,
11
+ "weights_file_sha256": "dbe3919154340c1519c6c4e00337dd2197b7b9937be3a0c6b1b9c0db9d00b285",
12
+ "bf16_export": "persona_lambda_27b_v10_eot_l61-63r4_mtp3_grpo-mixed-2",
13
+ "bf16_export_index_sha256": "2bfb40b84b71e39d624c92693267ced4f66c9aee0ba72140130df2bdef19bbc7",
14
+ "bf16_export_weight_version": "grpo-mixed-2:step-0011",
15
+ "frozen_parts_from": "persona_lambda_27b_v10_eot_l61-63r4_mtp3",
16
+ "draft_head_checkpoint": "checkpoint-00182.pt",
17
+ "draft_head_checkpoint_sha256": "8f9e012e0c9c5523c73eca4ee7da5ad68e02ee49c85d807d62d12ffd96dbd882",
18
+ "draft_head_checkpoint_update": 182
19
+ },
20
+ "tensors": {
21
+ "trained_from_masters": 851,
22
+ "trained_elements": 26895998464,
23
+ "frozen_vision_upcast": 333,
24
+ "draft_head_from_masters": 15,
25
+ "checkpoint_records": 611
26
+ },
27
+ "rounding": "BF16 = round-to-nearest-even(FP32) for every tensor except linear_attn.A_log, which stays FP32",
28
+ "mtp": {
29
+ "file": "mtp.safetensors",
30
+ "sha256": "7454f34b3a0cf80ceb03adc97d48dfba7644bec0f44c3a5f06182b06df4b7e2b",
31
+ "bf16_shards": {
32
+ "mtp.fc.weight": "model-part-00053.safetensors",
33
+ "mtp.layers.0.input_layernorm.weight": "model-part-00053.safetensors",
34
+ "mtp.layers.0.mlp.down_proj.weight": "model-part-00053.safetensors",
35
+ "mtp.layers.0.mlp.gate_proj.weight": "model-part-00053.safetensors",
36
+ "mtp.layers.0.mlp.up_proj.weight": "model-part-00054.safetensors",
37
+ "mtp.layers.0.post_attention_layernorm.weight": "model-part-00054.safetensors",
38
+ "mtp.layers.0.self_attn.k_norm.weight": "model-part-00054.safetensors",
39
+ "mtp.layers.0.self_attn.k_proj.weight": "model-part-00054.safetensors",
40
+ "mtp.layers.0.self_attn.o_proj.weight": "model-part-00054.safetensors",
41
+ "mtp.layers.0.self_attn.q_norm.weight": "model-part-00054.safetensors",
42
+ "mtp.layers.0.self_attn.q_proj.weight": "model-part-00054.safetensors",
43
+ "mtp.layers.0.self_attn.v_proj.weight": "model-part-00054.safetensors",
44
+ "mtp.norm.weight": "model-part-00054.safetensors",
45
+ "mtp.pre_fc_norm_embedding.weight": "model-part-00054.safetensors",
46
+ "mtp.pre_fc_norm_hidden.weight": "model-part-00054.safetensors"
47
+ }
48
+ },
49
+ "fp8": {
50
+ "quantized": [
51
+ "model.language_model.layers.0.linear_attn.in_proj_qkv.weight",
52
+ "model.language_model.layers.0.linear_attn.in_proj_z.weight",
53
+ "model.language_model.layers.0.linear_attn.out_proj.weight",
54
+ "model.language_model.layers.0.mlp.down_proj.weight",
55
+ "model.language_model.layers.0.mlp.gate_proj.weight",
56
+ "model.language_model.layers.0.mlp.up_proj.weight",
57
+ "model.language_model.layers.1.linear_attn.in_proj_qkv.weight",
58
+ "model.language_model.layers.1.linear_attn.in_proj_z.weight",
59
+ "model.language_model.layers.1.linear_attn.out_proj.weight",
60
+ "model.language_model.layers.1.mlp.down_proj.weight",
61
+ "model.language_model.layers.1.mlp.gate_proj.weight",
62
+ "model.language_model.layers.1.mlp.up_proj.weight",
63
+ "model.language_model.layers.10.linear_attn.in_proj_qkv.weight",
64
+ "model.language_model.layers.10.linear_attn.in_proj_z.weight",
65
+ "model.language_model.layers.10.linear_attn.out_proj.weight",
66
+ "model.language_model.layers.10.mlp.down_proj.weight",
67
+ "model.language_model.layers.10.mlp.gate_proj.weight",
68
+ "model.language_model.layers.10.mlp.up_proj.weight",
69
+ "model.language_model.layers.11.mlp.down_proj.weight",
70
+ "model.language_model.layers.11.mlp.gate_proj.weight",
71
+ "model.language_model.layers.11.mlp.up_proj.weight",
72
+ "model.language_model.layers.11.self_attn.k_proj.weight",
73
+ "model.language_model.layers.11.self_attn.o_proj.weight",
74
+ "model.language_model.layers.11.self_attn.q_proj.weight",
75
+ "model.language_model.layers.11.self_attn.v_proj.weight",
76
+ "model.language_model.layers.12.linear_attn.in_proj_qkv.weight",
77
+ "model.language_model.layers.12.linear_attn.in_proj_z.weight",
78
+ "model.language_model.layers.12.linear_attn.out_proj.weight",
79
+ "model.language_model.layers.12.mlp.down_proj.weight",
80
+ "model.language_model.layers.12.mlp.gate_proj.weight",
81
+ "model.language_model.layers.12.mlp.up_proj.weight",
82
+ "model.language_model.layers.13.linear_attn.in_proj_qkv.weight",
83
+ "model.language_model.layers.13.linear_attn.in_proj_z.weight",
84
+ "model.language_model.layers.13.linear_attn.out_proj.weight",
85
+ "model.language_model.layers.13.mlp.down_proj.weight",
86
+ "model.language_model.layers.13.mlp.gate_proj.weight",
87
+ "model.language_model.layers.13.mlp.up_proj.weight",
88
+ "model.language_model.layers.14.linear_attn.in_proj_qkv.weight",
89
+ "model.language_model.layers.14.linear_attn.in_proj_z.weight",
90
+ "model.language_model.layers.14.linear_attn.out_proj.weight",
91
+ "model.language_model.layers.14.mlp.down_proj.weight",
92
+ "model.language_model.layers.14.mlp.gate_proj.weight",
93
+ "model.language_model.layers.14.mlp.up_proj.weight",
94
+ "model.language_model.layers.15.mlp.down_proj.weight",
95
+ "model.language_model.layers.15.mlp.gate_proj.weight",
96
+ "model.language_model.layers.15.mlp.up_proj.weight",
97
+ "model.language_model.layers.15.self_attn.k_proj.weight",
98
+ "model.language_model.layers.15.self_attn.o_proj.weight",
99
+ "model.language_model.layers.15.self_attn.q_proj.weight",
100
+ "model.language_model.layers.15.self_attn.v_proj.weight",
101
+ "model.language_model.layers.16.linear_attn.in_proj_qkv.weight",
102
+ "model.language_model.layers.16.linear_attn.in_proj_z.weight",
103
+ "model.language_model.layers.16.linear_attn.out_proj.weight",
104
+ "model.language_model.layers.16.mlp.down_proj.weight",
105
+ "model.language_model.layers.16.mlp.gate_proj.weight",
106
+ "model.language_model.layers.16.mlp.up_proj.weight",
107
+ "model.language_model.layers.17.linear_attn.in_proj_qkv.weight",
108
+ "model.language_model.layers.17.linear_attn.in_proj_z.weight",
109
+ "model.language_model.layers.17.linear_attn.out_proj.weight",
110
+ "model.language_model.layers.17.mlp.down_proj.weight",
111
+ "model.language_model.layers.17.mlp.gate_proj.weight",
112
+ "model.language_model.layers.17.mlp.up_proj.weight",
113
+ "model.language_model.layers.18.linear_attn.in_proj_qkv.weight",
114
+ "model.language_model.layers.18.linear_attn.in_proj_z.weight",
115
+ "model.language_model.layers.18.linear_attn.out_proj.weight",
116
+ "model.language_model.layers.18.mlp.down_proj.weight",
117
+ "model.language_model.layers.18.mlp.gate_proj.weight",
118
+ "model.language_model.layers.18.mlp.up_proj.weight",
119
+ "model.language_model.layers.19.mlp.down_proj.weight",
120
+ "model.language_model.layers.19.mlp.gate_proj.weight",
121
+ "model.language_model.layers.19.mlp.up_proj.weight",
122
+ "model.language_model.layers.19.self_attn.k_proj.weight",
123
+ "model.language_model.layers.19.self_attn.o_proj.weight",
124
+ "model.language_model.layers.19.self_attn.q_proj.weight",
125
+ "model.language_model.layers.19.self_attn.v_proj.weight",
126
+ "model.language_model.layers.2.linear_attn.in_proj_qkv.weight",
127
+ "model.language_model.layers.2.linear_attn.in_proj_z.weight",
128
+ "model.language_model.layers.2.linear_attn.out_proj.weight",
129
+ "model.language_model.layers.2.mlp.down_proj.weight",
130
+ "model.language_model.layers.2.mlp.gate_proj.weight",
131
+ "model.language_model.layers.2.mlp.up_proj.weight",
132
+ "model.language_model.layers.20.linear_attn.in_proj_qkv.weight",
133
+ "model.language_model.layers.20.linear_attn.in_proj_z.weight",
134
+ "model.language_model.layers.20.linear_attn.out_proj.weight",
135
+ "model.language_model.layers.20.mlp.down_proj.weight",
136
+ "model.language_model.layers.20.mlp.gate_proj.weight",
137
+ "model.language_model.layers.20.mlp.up_proj.weight",
138
+ "model.language_model.layers.21.linear_attn.in_proj_qkv.weight",
139
+ "model.language_model.layers.21.linear_attn.in_proj_z.weight",
140
+ "model.language_model.layers.21.linear_attn.out_proj.weight",
141
+ "model.language_model.layers.21.mlp.down_proj.weight",
142
+ "model.language_model.layers.21.mlp.gate_proj.weight",
143
+ "model.language_model.layers.21.mlp.up_proj.weight",
144
+ "model.language_model.layers.22.linear_attn.in_proj_qkv.weight",
145
+ "model.language_model.layers.22.linear_attn.in_proj_z.weight",
146
+ "model.language_model.layers.22.linear_attn.out_proj.weight",
147
+ "model.language_model.layers.22.mlp.down_proj.weight",
148
+ "model.language_model.layers.22.mlp.gate_proj.weight",
149
+ "model.language_model.layers.22.mlp.up_proj.weight",
150
+ "model.language_model.layers.23.mlp.down_proj.weight",
151
+ "model.language_model.layers.23.mlp.gate_proj.weight",
152
+ "model.language_model.layers.23.mlp.up_proj.weight",
153
+ "model.language_model.layers.23.self_attn.k_proj.weight",
154
+ "model.language_model.layers.23.self_attn.o_proj.weight",
155
+ "model.language_model.layers.23.self_attn.q_proj.weight",
156
+ "model.language_model.layers.23.self_attn.v_proj.weight",
157
+ "model.language_model.layers.24.linear_attn.in_proj_qkv.weight",
158
+ "model.language_model.layers.24.linear_attn.in_proj_z.weight",
159
+ "model.language_model.layers.24.linear_attn.out_proj.weight",
160
+ "model.language_model.layers.24.mlp.down_proj.weight",
161
+ "model.language_model.layers.24.mlp.gate_proj.weight",
162
+ "model.language_model.layers.24.mlp.up_proj.weight",
163
+ "model.language_model.layers.25.linear_attn.in_proj_qkv.weight",
164
+ "model.language_model.layers.25.linear_attn.in_proj_z.weight",
165
+ "model.language_model.layers.25.linear_attn.out_proj.weight",
166
+ "model.language_model.layers.25.mlp.down_proj.weight",
167
+ "model.language_model.layers.25.mlp.gate_proj.weight",
168
+ "model.language_model.layers.25.mlp.up_proj.weight",
169
+ "model.language_model.layers.26.linear_attn.in_proj_qkv.weight",
170
+ "model.language_model.layers.26.linear_attn.in_proj_z.weight",
171
+ "model.language_model.layers.26.linear_attn.out_proj.weight",
172
+ "model.language_model.layers.26.mlp.down_proj.weight",
173
+ "model.language_model.layers.26.mlp.gate_proj.weight",
174
+ "model.language_model.layers.26.mlp.up_proj.weight",
175
+ "model.language_model.layers.27.mlp.down_proj.weight",
176
+ "model.language_model.layers.27.mlp.gate_proj.weight",
177
+ "model.language_model.layers.27.mlp.up_proj.weight",
178
+ "model.language_model.layers.27.self_attn.k_proj.weight",
179
+ "model.language_model.layers.27.self_attn.o_proj.weight",
180
+ "model.language_model.layers.27.self_attn.q_proj.weight",
181
+ "model.language_model.layers.27.self_attn.v_proj.weight",
182
+ "model.language_model.layers.28.linear_attn.in_proj_qkv.weight",
183
+ "model.language_model.layers.28.linear_attn.in_proj_z.weight",
184
+ "model.language_model.layers.28.linear_attn.out_proj.weight",
185
+ "model.language_model.layers.28.mlp.down_proj.weight",
186
+ "model.language_model.layers.28.mlp.gate_proj.weight",
187
+ "model.language_model.layers.28.mlp.up_proj.weight",
188
+ "model.language_model.layers.29.linear_attn.in_proj_qkv.weight",
189
+ "model.language_model.layers.29.linear_attn.in_proj_z.weight",
190
+ "model.language_model.layers.29.linear_attn.out_proj.weight",
191
+ "model.language_model.layers.29.mlp.down_proj.weight",
192
+ "model.language_model.layers.29.mlp.gate_proj.weight",
193
+ "model.language_model.layers.29.mlp.up_proj.weight",
194
+ "model.language_model.layers.3.mlp.down_proj.weight",
195
+ "model.language_model.layers.3.mlp.gate_proj.weight",
196
+ "model.language_model.layers.3.mlp.up_proj.weight",
197
+ "model.language_model.layers.3.self_attn.k_proj.weight",
198
+ "model.language_model.layers.3.self_attn.o_proj.weight",
199
+ "model.language_model.layers.3.self_attn.q_proj.weight",
200
+ "model.language_model.layers.3.self_attn.v_proj.weight",
201
+ "model.language_model.layers.30.linear_attn.in_proj_qkv.weight",
202
+ "model.language_model.layers.30.linear_attn.in_proj_z.weight",
203
+ "model.language_model.layers.30.linear_attn.out_proj.weight",
204
+ "model.language_model.layers.30.mlp.down_proj.weight",
205
+ "model.language_model.layers.30.mlp.gate_proj.weight",
206
+ "model.language_model.layers.30.mlp.up_proj.weight",
207
+ "model.language_model.layers.31.mlp.down_proj.weight",
208
+ "model.language_model.layers.31.mlp.gate_proj.weight",
209
+ "model.language_model.layers.31.mlp.up_proj.weight",
210
+ "model.language_model.layers.31.self_attn.k_proj.weight",
211
+ "model.language_model.layers.31.self_attn.o_proj.weight",
212
+ "model.language_model.layers.31.self_attn.q_proj.weight",
213
+ "model.language_model.layers.31.self_attn.v_proj.weight",
214
+ "model.language_model.layers.32.linear_attn.in_proj_qkv.weight",
215
+ "model.language_model.layers.32.linear_attn.in_proj_z.weight",
216
+ "model.language_model.layers.32.linear_attn.out_proj.weight",
217
+ "model.language_model.layers.32.mlp.down_proj.weight",
218
+ "model.language_model.layers.32.mlp.gate_proj.weight",
219
+ "model.language_model.layers.32.mlp.up_proj.weight",
220
+ "model.language_model.layers.33.linear_attn.in_proj_qkv.weight",
221
+ "model.language_model.layers.33.linear_attn.in_proj_z.weight",
222
+ "model.language_model.layers.33.linear_attn.out_proj.weight",
223
+ "model.language_model.layers.33.mlp.down_proj.weight",
224
+ "model.language_model.layers.33.mlp.gate_proj.weight",
225
+ "model.language_model.layers.33.mlp.up_proj.weight",
226
+ "model.language_model.layers.34.linear_attn.in_proj_qkv.weight",
227
+ "model.language_model.layers.34.linear_attn.in_proj_z.weight",
228
+ "model.language_model.layers.34.linear_attn.out_proj.weight",
229
+ "model.language_model.layers.34.mlp.down_proj.weight",
230
+ "model.language_model.layers.34.mlp.gate_proj.weight",
231
+ "model.language_model.layers.34.mlp.up_proj.weight",
232
+ "model.language_model.layers.35.mlp.down_proj.weight",
233
+ "model.language_model.layers.35.mlp.gate_proj.weight",
234
+ "model.language_model.layers.35.mlp.up_proj.weight",
235
+ "model.language_model.layers.35.self_attn.k_proj.weight",
236
+ "model.language_model.layers.35.self_attn.o_proj.weight",
237
+ "model.language_model.layers.35.self_attn.q_proj.weight",
238
+ "model.language_model.layers.35.self_attn.v_proj.weight",
239
+ "model.language_model.layers.36.linear_attn.in_proj_qkv.weight",
240
+ "model.language_model.layers.36.linear_attn.in_proj_z.weight",
241
+ "model.language_model.layers.36.linear_attn.out_proj.weight",
242
+ "model.language_model.layers.36.mlp.down_proj.weight",
243
+ "model.language_model.layers.36.mlp.gate_proj.weight",
244
+ "model.language_model.layers.36.mlp.up_proj.weight",
245
+ "model.language_model.layers.37.linear_attn.in_proj_qkv.weight",
246
+ "model.language_model.layers.37.linear_attn.in_proj_z.weight",
247
+ "model.language_model.layers.37.linear_attn.out_proj.weight",
248
+ "model.language_model.layers.37.mlp.down_proj.weight",
249
+ "model.language_model.layers.37.mlp.gate_proj.weight",
250
+ "model.language_model.layers.37.mlp.up_proj.weight",
251
+ "model.language_model.layers.38.linear_attn.in_proj_qkv.weight",
252
+ "model.language_model.layers.38.linear_attn.in_proj_z.weight",
253
+ "model.language_model.layers.38.linear_attn.out_proj.weight",
254
+ "model.language_model.layers.38.mlp.down_proj.weight",
255
+ "model.language_model.layers.38.mlp.gate_proj.weight",
256
+ "model.language_model.layers.38.mlp.up_proj.weight",
257
+ "model.language_model.layers.39.mlp.down_proj.weight",
258
+ "model.language_model.layers.39.mlp.gate_proj.weight",
259
+ "model.language_model.layers.39.mlp.up_proj.weight",
260
+ "model.language_model.layers.39.self_attn.k_proj.weight",
261
+ "model.language_model.layers.39.self_attn.o_proj.weight",
262
+ "model.language_model.layers.39.self_attn.q_proj.weight",
263
+ "model.language_model.layers.39.self_attn.v_proj.weight",
264
+ "model.language_model.layers.4.linear_attn.in_proj_qkv.weight",
265
+ "model.language_model.layers.4.linear_attn.in_proj_z.weight",
266
+ "model.language_model.layers.4.linear_attn.out_proj.weight",
267
+ "model.language_model.layers.4.mlp.down_proj.weight",
268
+ "model.language_model.layers.4.mlp.gate_proj.weight",
269
+ "model.language_model.layers.4.mlp.up_proj.weight",
270
+ "model.language_model.layers.40.linear_attn.in_proj_qkv.weight",
271
+ "model.language_model.layers.40.linear_attn.in_proj_z.weight",
272
+ "model.language_model.layers.40.linear_attn.out_proj.weight",
273
+ "model.language_model.layers.40.mlp.down_proj.weight",
274
+ "model.language_model.layers.40.mlp.gate_proj.weight",
275
+ "model.language_model.layers.40.mlp.up_proj.weight",
276
+ "model.language_model.layers.41.linear_attn.in_proj_qkv.weight",
277
+ "model.language_model.layers.41.linear_attn.in_proj_z.weight",
278
+ "model.language_model.layers.41.linear_attn.out_proj.weight",
279
+ "model.language_model.layers.41.mlp.down_proj.weight",
280
+ "model.language_model.layers.41.mlp.gate_proj.weight",
281
+ "model.language_model.layers.41.mlp.up_proj.weight",
282
+ "model.language_model.layers.42.linear_attn.in_proj_qkv.weight",
283
+ "model.language_model.layers.42.linear_attn.in_proj_z.weight",
284
+ "model.language_model.layers.42.linear_attn.out_proj.weight",
285
+ "model.language_model.layers.42.mlp.down_proj.weight",
286
+ "model.language_model.layers.42.mlp.gate_proj.weight",
287
+ "model.language_model.layers.42.mlp.up_proj.weight",
288
+ "model.language_model.layers.43.mlp.down_proj.weight",
289
+ "model.language_model.layers.43.mlp.gate_proj.weight",
290
+ "model.language_model.layers.43.mlp.up_proj.weight",
291
+ "model.language_model.layers.43.self_attn.k_proj.weight",
292
+ "model.language_model.layers.43.self_attn.o_proj.weight",
293
+ "model.language_model.layers.43.self_attn.q_proj.weight",
294
+ "model.language_model.layers.43.self_attn.v_proj.weight",
295
+ "model.language_model.layers.44.linear_attn.in_proj_qkv.weight",
296
+ "model.language_model.layers.44.linear_attn.in_proj_z.weight",
297
+ "model.language_model.layers.44.linear_attn.out_proj.weight",
298
+ "model.language_model.layers.44.mlp.down_proj.weight",
299
+ "model.language_model.layers.44.mlp.gate_proj.weight",
300
+ "model.language_model.layers.44.mlp.up_proj.weight",
301
+ "model.language_model.layers.45.linear_attn.in_proj_qkv.weight",
302
+ "model.language_model.layers.45.linear_attn.in_proj_z.weight",
303
+ "model.language_model.layers.45.linear_attn.out_proj.weight",
304
+ "model.language_model.layers.45.mlp.down_proj.weight",
305
+ "model.language_model.layers.45.mlp.gate_proj.weight",
306
+ "model.language_model.layers.45.mlp.up_proj.weight",
307
+ "model.language_model.layers.46.linear_attn.in_proj_qkv.weight",
308
+ "model.language_model.layers.46.linear_attn.in_proj_z.weight",
309
+ "model.language_model.layers.46.linear_attn.out_proj.weight",
310
+ "model.language_model.layers.46.mlp.down_proj.weight",
311
+ "model.language_model.layers.46.mlp.gate_proj.weight",
312
+ "model.language_model.layers.46.mlp.up_proj.weight",
313
+ "model.language_model.layers.47.mlp.down_proj.weight",
314
+ "model.language_model.layers.47.mlp.gate_proj.weight",
315
+ "model.language_model.layers.47.mlp.up_proj.weight",
316
+ "model.language_model.layers.47.self_attn.k_proj.weight",
317
+ "model.language_model.layers.47.self_attn.o_proj.weight",
318
+ "model.language_model.layers.47.self_attn.q_proj.weight",
319
+ "model.language_model.layers.47.self_attn.v_proj.weight",
320
+ "model.language_model.layers.48.linear_attn.in_proj_qkv.weight",
321
+ "model.language_model.layers.48.linear_attn.in_proj_z.weight",
322
+ "model.language_model.layers.48.linear_attn.out_proj.weight",
323
+ "model.language_model.layers.48.mlp.down_proj.weight",
324
+ "model.language_model.layers.48.mlp.gate_proj.weight",
325
+ "model.language_model.layers.48.mlp.up_proj.weight",
326
+ "model.language_model.layers.49.linear_attn.in_proj_qkv.weight",
327
+ "model.language_model.layers.49.linear_attn.in_proj_z.weight",
328
+ "model.language_model.layers.49.linear_attn.out_proj.weight",
329
+ "model.language_model.layers.49.mlp.down_proj.weight",
330
+ "model.language_model.layers.49.mlp.gate_proj.weight",
331
+ "model.language_model.layers.49.mlp.up_proj.weight",
332
+ "model.language_model.layers.5.linear_attn.in_proj_qkv.weight",
333
+ "model.language_model.layers.5.linear_attn.in_proj_z.weight",
334
+ "model.language_model.layers.5.linear_attn.out_proj.weight",
335
+ "model.language_model.layers.5.mlp.down_proj.weight",
336
+ "model.language_model.layers.5.mlp.gate_proj.weight",
337
+ "model.language_model.layers.5.mlp.up_proj.weight",
338
+ "model.language_model.layers.50.linear_attn.in_proj_qkv.weight",
339
+ "model.language_model.layers.50.linear_attn.in_proj_z.weight",
340
+ "model.language_model.layers.50.linear_attn.out_proj.weight",
341
+ "model.language_model.layers.50.mlp.down_proj.weight",
342
+ "model.language_model.layers.50.mlp.gate_proj.weight",
343
+ "model.language_model.layers.50.mlp.up_proj.weight",
344
+ "model.language_model.layers.51.mlp.down_proj.weight",
345
+ "model.language_model.layers.51.mlp.gate_proj.weight",
346
+ "model.language_model.layers.51.mlp.up_proj.weight",
347
+ "model.language_model.layers.51.self_attn.k_proj.weight",
348
+ "model.language_model.layers.51.self_attn.o_proj.weight",
349
+ "model.language_model.layers.51.self_attn.q_proj.weight",
350
+ "model.language_model.layers.51.self_attn.v_proj.weight",
351
+ "model.language_model.layers.52.linear_attn.in_proj_qkv.weight",
352
+ "model.language_model.layers.52.linear_attn.in_proj_z.weight",
353
+ "model.language_model.layers.52.linear_attn.out_proj.weight",
354
+ "model.language_model.layers.52.mlp.down_proj.weight",
355
+ "model.language_model.layers.52.mlp.gate_proj.weight",
356
+ "model.language_model.layers.52.mlp.up_proj.weight",
357
+ "model.language_model.layers.53.linear_attn.in_proj_qkv.weight",
358
+ "model.language_model.layers.53.linear_attn.in_proj_z.weight",
359
+ "model.language_model.layers.53.linear_attn.out_proj.weight",
360
+ "model.language_model.layers.53.mlp.down_proj.weight",
361
+ "model.language_model.layers.53.mlp.gate_proj.weight",
362
+ "model.language_model.layers.53.mlp.up_proj.weight",
363
+ "model.language_model.layers.54.linear_attn.in_proj_qkv.weight",
364
+ "model.language_model.layers.54.linear_attn.in_proj_z.weight",
365
+ "model.language_model.layers.54.linear_attn.out_proj.weight",
366
+ "model.language_model.layers.54.mlp.down_proj.weight",
367
+ "model.language_model.layers.54.mlp.gate_proj.weight",
368
+ "model.language_model.layers.54.mlp.up_proj.weight",
369
+ "model.language_model.layers.55.mlp.down_proj.weight",
370
+ "model.language_model.layers.55.mlp.gate_proj.weight",
371
+ "model.language_model.layers.55.mlp.up_proj.weight",
372
+ "model.language_model.layers.55.self_attn.k_proj.weight",
373
+ "model.language_model.layers.55.self_attn.o_proj.weight",
374
+ "model.language_model.layers.55.self_attn.q_proj.weight",
375
+ "model.language_model.layers.55.self_attn.v_proj.weight",
376
+ "model.language_model.layers.56.linear_attn.in_proj_qkv.weight",
377
+ "model.language_model.layers.56.linear_attn.in_proj_z.weight",
378
+ "model.language_model.layers.56.linear_attn.out_proj.weight",
379
+ "model.language_model.layers.56.mlp.down_proj.weight",
380
+ "model.language_model.layers.56.mlp.gate_proj.weight",
381
+ "model.language_model.layers.56.mlp.up_proj.weight",
382
+ "model.language_model.layers.57.linear_attn.in_proj_qkv.weight",
383
+ "model.language_model.layers.57.linear_attn.in_proj_z.weight",
384
+ "model.language_model.layers.57.linear_attn.out_proj.weight",
385
+ "model.language_model.layers.57.mlp.down_proj.weight",
386
+ "model.language_model.layers.57.mlp.gate_proj.weight",
387
+ "model.language_model.layers.57.mlp.up_proj.weight",
388
+ "model.language_model.layers.58.linear_attn.in_proj_qkv.weight",
389
+ "model.language_model.layers.58.linear_attn.in_proj_z.weight",
390
+ "model.language_model.layers.58.linear_attn.out_proj.weight",
391
+ "model.language_model.layers.58.mlp.down_proj.weight",
392
+ "model.language_model.layers.58.mlp.gate_proj.weight",
393
+ "model.language_model.layers.58.mlp.up_proj.weight",
394
+ "model.language_model.layers.59.mlp.down_proj.weight",
395
+ "model.language_model.layers.59.mlp.gate_proj.weight",
396
+ "model.language_model.layers.59.mlp.up_proj.weight",
397
+ "model.language_model.layers.59.self_attn.k_proj.weight",
398
+ "model.language_model.layers.59.self_attn.o_proj.weight",
399
+ "model.language_model.layers.59.self_attn.q_proj.weight",
400
+ "model.language_model.layers.59.self_attn.v_proj.weight",
401
+ "model.language_model.layers.6.linear_attn.in_proj_qkv.weight",
402
+ "model.language_model.layers.6.linear_attn.in_proj_z.weight",
403
+ "model.language_model.layers.6.linear_attn.out_proj.weight",
404
+ "model.language_model.layers.6.mlp.down_proj.weight",
405
+ "model.language_model.layers.6.mlp.gate_proj.weight",
406
+ "model.language_model.layers.6.mlp.up_proj.weight",
407
+ "model.language_model.layers.60.linear_attn.in_proj_qkv.weight",
408
+ "model.language_model.layers.60.linear_attn.in_proj_z.weight",
409
+ "model.language_model.layers.60.linear_attn.out_proj.weight",
410
+ "model.language_model.layers.60.mlp.down_proj.weight",
411
+ "model.language_model.layers.60.mlp.gate_proj.weight",
412
+ "model.language_model.layers.60.mlp.up_proj.weight",
413
+ "model.language_model.layers.61.linear_attn.in_proj_qkv.weight",
414
+ "model.language_model.layers.61.linear_attn.in_proj_z.weight",
415
+ "model.language_model.layers.61.linear_attn.out_proj.weight",
416
+ "model.language_model.layers.61.mlp.down_proj.weight",
417
+ "model.language_model.layers.61.mlp.gate_proj.weight",
418
+ "model.language_model.layers.61.mlp.up_proj.weight",
419
+ "model.language_model.layers.62.linear_attn.in_proj_qkv.weight",
420
+ "model.language_model.layers.62.linear_attn.in_proj_z.weight",
421
+ "model.language_model.layers.62.linear_attn.out_proj.weight",
422
+ "model.language_model.layers.62.mlp.down_proj.weight",
423
+ "model.language_model.layers.62.mlp.gate_proj.weight",
424
+ "model.language_model.layers.62.mlp.up_proj.weight",
425
+ "model.language_model.layers.63.mlp.down_proj.weight",
426
+ "model.language_model.layers.63.mlp.gate_proj.weight",
427
+ "model.language_model.layers.63.mlp.up_proj.weight",
428
+ "model.language_model.layers.63.self_attn.k_proj.weight",
429
+ "model.language_model.layers.63.self_attn.o_proj.weight",
430
+ "model.language_model.layers.63.self_attn.q_proj.weight",
431
+ "model.language_model.layers.63.self_attn.v_proj.weight",
432
+ "model.language_model.layers.7.mlp.down_proj.weight",
433
+ "model.language_model.layers.7.mlp.gate_proj.weight",
434
+ "model.language_model.layers.7.mlp.up_proj.weight",
435
+ "model.language_model.layers.7.self_attn.k_proj.weight",
436
+ "model.language_model.layers.7.self_attn.o_proj.weight",
437
+ "model.language_model.layers.7.self_attn.q_proj.weight",
438
+ "model.language_model.layers.7.self_attn.v_proj.weight",
439
+ "model.language_model.layers.8.linear_attn.in_proj_qkv.weight",
440
+ "model.language_model.layers.8.linear_attn.in_proj_z.weight",
441
+ "model.language_model.layers.8.linear_attn.out_proj.weight",
442
+ "model.language_model.layers.8.mlp.down_proj.weight",
443
+ "model.language_model.layers.8.mlp.gate_proj.weight",
444
+ "model.language_model.layers.8.mlp.up_proj.weight",
445
+ "model.language_model.layers.9.linear_attn.in_proj_qkv.weight",
446
+ "model.language_model.layers.9.linear_attn.in_proj_z.weight",
447
+ "model.language_model.layers.9.linear_attn.out_proj.weight",
448
+ "model.language_model.layers.9.mlp.down_proj.weight",
449
+ "model.language_model.layers.9.mlp.gate_proj.weight",
450
+ "model.language_model.layers.9.mlp.up_proj.weight",
451
+ "mtp.layers.0.mlp.down_proj.weight",
452
+ "mtp.layers.0.mlp.gate_proj.weight",
453
+ "mtp.layers.0.mlp.up_proj.weight",
454
+ "mtp.layers.0.self_attn.k_proj.weight",
455
+ "mtp.layers.0.self_attn.o_proj.weight",
456
+ "mtp.layers.0.self_attn.q_proj.weight",
457
+ "mtp.layers.0.self_attn.v_proj.weight"
458
+ ],
459
+ "quantization_config": {
460
+ "activation_scheme": "dynamic",
461
+ "fmt": "e4m3",
462
+ "quant_method": "fp8",
463
+ "modules_to_not_convert": [
464
+ "model.visual.blocks.0.attn.proj",
465
+ "model.visual.blocks.0.attn.qkv",
466
+ "model.visual.blocks.0.mlp.linear_fc1",
467
+ "model.visual.blocks.0.mlp.linear_fc2",
468
+ "visual.blocks.0.attn.proj",
469
+ "visual.blocks.0.attn.qkv_proj",
470
+ "visual.blocks.0.mlp.linear_fc1",
471
+ "visual.blocks.0.mlp.linear_fc2",
472
+ "model.visual.blocks.1.attn.proj",
473
+ "model.visual.blocks.1.attn.qkv",
474
+ "model.visual.blocks.1.mlp.linear_fc1",
475
+ "model.visual.blocks.1.mlp.linear_fc2",
476
+ "visual.blocks.1.attn.proj",
477
+ "visual.blocks.1.attn.qkv_proj",
478
+ "visual.blocks.1.mlp.linear_fc1",
479
+ "visual.blocks.1.mlp.linear_fc2",
480
+ "model.visual.blocks.2.attn.proj",
481
+ "model.visual.blocks.2.attn.qkv",
482
+ "model.visual.blocks.2.mlp.linear_fc1",
483
+ "model.visual.blocks.2.mlp.linear_fc2",
484
+ "visual.blocks.2.attn.proj",
485
+ "visual.blocks.2.attn.qkv_proj",
486
+ "visual.blocks.2.mlp.linear_fc1",
487
+ "visual.blocks.2.mlp.linear_fc2",
488
+ "model.visual.blocks.3.attn.proj",
489
+ "model.visual.blocks.3.attn.qkv",
490
+ "model.visual.blocks.3.mlp.linear_fc1",
491
+ "model.visual.blocks.3.mlp.linear_fc2",
492
+ "visual.blocks.3.attn.proj",
493
+ "visual.blocks.3.attn.qkv_proj",
494
+ "visual.blocks.3.mlp.linear_fc1",
495
+ "visual.blocks.3.mlp.linear_fc2",
496
+ "model.visual.blocks.4.attn.proj",
497
+ "model.visual.blocks.4.attn.qkv",
498
+ "model.visual.blocks.4.mlp.linear_fc1",
499
+ "model.visual.blocks.4.mlp.linear_fc2",
500
+ "visual.blocks.4.attn.proj",
501
+ "visual.blocks.4.attn.qkv_proj",
502
+ "visual.blocks.4.mlp.linear_fc1",
503
+ "visual.blocks.4.mlp.linear_fc2",
504
+ "model.visual.blocks.5.attn.proj",
505
+ "model.visual.blocks.5.attn.qkv",
506
+ "model.visual.blocks.5.mlp.linear_fc1",
507
+ "model.visual.blocks.5.mlp.linear_fc2",
508
+ "visual.blocks.5.attn.proj",
509
+ "visual.blocks.5.attn.qkv_proj",
510
+ "visual.blocks.5.mlp.linear_fc1",
511
+ "visual.blocks.5.mlp.linear_fc2",
512
+ "model.visual.blocks.6.attn.proj",
513
+ "model.visual.blocks.6.attn.qkv",
514
+ "model.visual.blocks.6.mlp.linear_fc1",
515
+ "model.visual.blocks.6.mlp.linear_fc2",
516
+ "visual.blocks.6.attn.proj",
517
+ "visual.blocks.6.attn.qkv_proj",
518
+ "visual.blocks.6.mlp.linear_fc1",
519
+ "visual.blocks.6.mlp.linear_fc2",
520
+ "model.visual.blocks.7.attn.proj",
521
+ "model.visual.blocks.7.attn.qkv",
522
+ "model.visual.blocks.7.mlp.linear_fc1",
523
+ "model.visual.blocks.7.mlp.linear_fc2",
524
+ "visual.blocks.7.attn.proj",
525
+ "visual.blocks.7.attn.qkv_proj",
526
+ "visual.blocks.7.mlp.linear_fc1",
527
+ "visual.blocks.7.mlp.linear_fc2",
528
+ "model.visual.blocks.8.attn.proj",
529
+ "model.visual.blocks.8.attn.qkv",
530
+ "model.visual.blocks.8.mlp.linear_fc1",
531
+ "model.visual.blocks.8.mlp.linear_fc2",
532
+ "visual.blocks.8.attn.proj",
533
+ "visual.blocks.8.attn.qkv_proj",
534
+ "visual.blocks.8.mlp.linear_fc1",
535
+ "visual.blocks.8.mlp.linear_fc2",
536
+ "model.visual.blocks.9.attn.proj",
537
+ "model.visual.blocks.9.attn.qkv",
538
+ "model.visual.blocks.9.mlp.linear_fc1",
539
+ "model.visual.blocks.9.mlp.linear_fc2",
540
+ "visual.blocks.9.attn.proj",
541
+ "visual.blocks.9.attn.qkv_proj",
542
+ "visual.blocks.9.mlp.linear_fc1",
543
+ "visual.blocks.9.mlp.linear_fc2",
544
+ "model.visual.blocks.10.attn.proj",
545
+ "model.visual.blocks.10.attn.qkv",
546
+ "model.visual.blocks.10.mlp.linear_fc1",
547
+ "model.visual.blocks.10.mlp.linear_fc2",
548
+ "visual.blocks.10.attn.proj",
549
+ "visual.blocks.10.attn.qkv_proj",
550
+ "visual.blocks.10.mlp.linear_fc1",
551
+ "visual.blocks.10.mlp.linear_fc2",
552
+ "model.visual.blocks.11.attn.proj",
553
+ "model.visual.blocks.11.attn.qkv",
554
+ "model.visual.blocks.11.mlp.linear_fc1",
555
+ "model.visual.blocks.11.mlp.linear_fc2",
556
+ "visual.blocks.11.attn.proj",
557
+ "visual.blocks.11.attn.qkv_proj",
558
+ "visual.blocks.11.mlp.linear_fc1",
559
+ "visual.blocks.11.mlp.linear_fc2",
560
+ "model.visual.blocks.12.attn.proj",
561
+ "model.visual.blocks.12.attn.qkv",
562
+ "model.visual.blocks.12.mlp.linear_fc1",
563
+ "model.visual.blocks.12.mlp.linear_fc2",
564
+ "visual.blocks.12.attn.proj",
565
+ "visual.blocks.12.attn.qkv_proj",
566
+ "visual.blocks.12.mlp.linear_fc1",
567
+ "visual.blocks.12.mlp.linear_fc2",
568
+ "model.visual.blocks.13.attn.proj",
569
+ "model.visual.blocks.13.attn.qkv",
570
+ "model.visual.blocks.13.mlp.linear_fc1",
571
+ "model.visual.blocks.13.mlp.linear_fc2",
572
+ "visual.blocks.13.attn.proj",
573
+ "visual.blocks.13.attn.qkv_proj",
574
+ "visual.blocks.13.mlp.linear_fc1",
575
+ "visual.blocks.13.mlp.linear_fc2",
576
+ "model.visual.blocks.14.attn.proj",
577
+ "model.visual.blocks.14.attn.qkv",
578
+ "model.visual.blocks.14.mlp.linear_fc1",
579
+ "model.visual.blocks.14.mlp.linear_fc2",
580
+ "visual.blocks.14.attn.proj",
581
+ "visual.blocks.14.attn.qkv_proj",
582
+ "visual.blocks.14.mlp.linear_fc1",
583
+ "visual.blocks.14.mlp.linear_fc2",
584
+ "model.visual.blocks.15.attn.proj",
585
+ "model.visual.blocks.15.attn.qkv",
586
+ "model.visual.blocks.15.mlp.linear_fc1",
587
+ "model.visual.blocks.15.mlp.linear_fc2",
588
+ "visual.blocks.15.attn.proj",
589
+ "visual.blocks.15.attn.qkv_proj",
590
+ "visual.blocks.15.mlp.linear_fc1",
591
+ "visual.blocks.15.mlp.linear_fc2",
592
+ "model.visual.blocks.16.attn.proj",
593
+ "model.visual.blocks.16.attn.qkv",
594
+ "model.visual.blocks.16.mlp.linear_fc1",
595
+ "model.visual.blocks.16.mlp.linear_fc2",
596
+ "visual.blocks.16.attn.proj",
597
+ "visual.blocks.16.attn.qkv_proj",
598
+ "visual.blocks.16.mlp.linear_fc1",
599
+ "visual.blocks.16.mlp.linear_fc2",
600
+ "model.visual.blocks.17.attn.proj",
601
+ "model.visual.blocks.17.attn.qkv",
602
+ "model.visual.blocks.17.mlp.linear_fc1",
603
+ "model.visual.blocks.17.mlp.linear_fc2",
604
+ "visual.blocks.17.attn.proj",
605
+ "visual.blocks.17.attn.qkv_proj",
606
+ "visual.blocks.17.mlp.linear_fc1",
607
+ "visual.blocks.17.mlp.linear_fc2",
608
+ "model.visual.blocks.18.attn.proj",
609
+ "model.visual.blocks.18.attn.qkv",
610
+ "model.visual.blocks.18.mlp.linear_fc1",
611
+ "model.visual.blocks.18.mlp.linear_fc2",
612
+ "visual.blocks.18.attn.proj",
613
+ "visual.blocks.18.attn.qkv_proj",
614
+ "visual.blocks.18.mlp.linear_fc1",
615
+ "visual.blocks.18.mlp.linear_fc2",
616
+ "model.visual.blocks.19.attn.proj",
617
+ "model.visual.blocks.19.attn.qkv",
618
+ "model.visual.blocks.19.mlp.linear_fc1",
619
+ "model.visual.blocks.19.mlp.linear_fc2",
620
+ "visual.blocks.19.attn.proj",
621
+ "visual.blocks.19.attn.qkv_proj",
622
+ "visual.blocks.19.mlp.linear_fc1",
623
+ "visual.blocks.19.mlp.linear_fc2",
624
+ "model.visual.blocks.20.attn.proj",
625
+ "model.visual.blocks.20.attn.qkv",
626
+ "model.visual.blocks.20.mlp.linear_fc1",
627
+ "model.visual.blocks.20.mlp.linear_fc2",
628
+ "visual.blocks.20.attn.proj",
629
+ "visual.blocks.20.attn.qkv_proj",
630
+ "visual.blocks.20.mlp.linear_fc1",
631
+ "visual.blocks.20.mlp.linear_fc2",
632
+ "model.visual.blocks.21.attn.proj",
633
+ "model.visual.blocks.21.attn.qkv",
634
+ "model.visual.blocks.21.mlp.linear_fc1",
635
+ "model.visual.blocks.21.mlp.linear_fc2",
636
+ "visual.blocks.21.attn.proj",
637
+ "visual.blocks.21.attn.qkv_proj",
638
+ "visual.blocks.21.mlp.linear_fc1",
639
+ "visual.blocks.21.mlp.linear_fc2",
640
+ "model.visual.blocks.22.attn.proj",
641
+ "model.visual.blocks.22.attn.qkv",
642
+ "model.visual.blocks.22.mlp.linear_fc1",
643
+ "model.visual.blocks.22.mlp.linear_fc2",
644
+ "visual.blocks.22.attn.proj",
645
+ "visual.blocks.22.attn.qkv_proj",
646
+ "visual.blocks.22.mlp.linear_fc1",
647
+ "visual.blocks.22.mlp.linear_fc2",
648
+ "model.visual.blocks.23.attn.proj",
649
+ "model.visual.blocks.23.attn.qkv",
650
+ "model.visual.blocks.23.mlp.linear_fc1",
651
+ "model.visual.blocks.23.mlp.linear_fc2",
652
+ "visual.blocks.23.attn.proj",
653
+ "visual.blocks.23.attn.qkv_proj",
654
+ "visual.blocks.23.mlp.linear_fc1",
655
+ "visual.blocks.23.mlp.linear_fc2",
656
+ "model.visual.blocks.24.attn.proj",
657
+ "model.visual.blocks.24.attn.qkv",
658
+ "model.visual.blocks.24.mlp.linear_fc1",
659
+ "model.visual.blocks.24.mlp.linear_fc2",
660
+ "visual.blocks.24.attn.proj",
661
+ "visual.blocks.24.attn.qkv_proj",
662
+ "visual.blocks.24.mlp.linear_fc1",
663
+ "visual.blocks.24.mlp.linear_fc2",
664
+ "model.visual.blocks.25.attn.proj",
665
+ "model.visual.blocks.25.attn.qkv",
666
+ "model.visual.blocks.25.mlp.linear_fc1",
667
+ "model.visual.blocks.25.mlp.linear_fc2",
668
+ "visual.blocks.25.attn.proj",
669
+ "visual.blocks.25.attn.qkv_proj",
670
+ "visual.blocks.25.mlp.linear_fc1",
671
+ "visual.blocks.25.mlp.linear_fc2",
672
+ "model.visual.blocks.26.attn.proj",
673
+ "model.visual.blocks.26.attn.qkv",
674
+ "model.visual.blocks.26.mlp.linear_fc1",
675
+ "model.visual.blocks.26.mlp.linear_fc2",
676
+ "visual.blocks.26.attn.proj",
677
+ "visual.blocks.26.attn.qkv_proj",
678
+ "visual.blocks.26.mlp.linear_fc1",
679
+ "visual.blocks.26.mlp.linear_fc2",
680
+ "model.visual.deepstack_merger_list.0.linear_fc1",
681
+ "model.visual.deepstack_merger_list.0.linear_fc2",
682
+ "model.visual.deepstack_merger_list.0.norm",
683
+ "visual.deepstack_merger_list.0.linear_fc1",
684
+ "visual.deepstack_merger_list.0.linear_fc2",
685
+ "visual.deepstack_merger_list.0.norm",
686
+ "model.visual.deepstack_merger_list.1.linear_fc1",
687
+ "model.visual.deepstack_merger_list.1.linear_fc2",
688
+ "model.visual.deepstack_merger_list.1.norm",
689
+ "visual.deepstack_merger_list.1.linear_fc1",
690
+ "visual.deepstack_merger_list.1.linear_fc2",
691
+ "visual.deepstack_merger_list.1.norm",
692
+ "model.visual.deepstack_merger_list.2.linear_fc1",
693
+ "model.visual.deepstack_merger_list.2.linear_fc2",
694
+ "model.visual.deepstack_merger_list.2.norm",
695
+ "visual.deepstack_merger_list.2.linear_fc1",
696
+ "visual.deepstack_merger_list.2.linear_fc2",
697
+ "visual.deepstack_merger_list.2.norm",
698
+ "model.visual.merger.linear_fc1",
699
+ "model.visual.merger.linear_fc2",
700
+ "model.visual.merger.norm",
701
+ "model.visual.patch_embed.proj",
702
+ "model.visual.pos_embed",
703
+ "visual.merger.linear_fc1",
704
+ "visual.merger.linear_fc2",
705
+ "visual.merger.norm",
706
+ "visual.patch_embed.proj",
707
+ "visual.pos_embed",
708
+ "visual",
709
+ "model.visual",
710
+ "lm_head",
711
+ "model.embed_tokens",
712
+ "model.language_model.layers.0.input_layernorm",
713
+ "model.language_model.layers.0.mlp.shared_expert_gate",
714
+ "model.language_model.layers.0.post_attention_layernorm",
715
+ "model.language_model.layers.0.mlp.gate",
716
+ "model.language_model.layers.0.linear_attn.A_log",
717
+ "model.language_model.layers.0.linear_attn.conv1d",
718
+ "model.language_model.layers.0.linear_attn.dt_bias",
719
+ "model.language_model.layers.0.linear_attn.in_proj_ba",
720
+ "model.language_model.layers.0.linear_attn.in_proj_b",
721
+ "model.language_model.layers.0.linear_attn.in_proj_a",
722
+ "model.language_model.layers.0.linear_attn.norm",
723
+ "model.language_model.layers.1.input_layernorm",
724
+ "model.language_model.layers.1.mlp.shared_expert_gate",
725
+ "model.language_model.layers.1.post_attention_layernorm",
726
+ "model.language_model.layers.1.mlp.gate",
727
+ "model.language_model.layers.1.linear_attn.A_log",
728
+ "model.language_model.layers.1.linear_attn.conv1d",
729
+ "model.language_model.layers.1.linear_attn.dt_bias",
730
+ "model.language_model.layers.1.linear_attn.in_proj_ba",
731
+ "model.language_model.layers.1.linear_attn.in_proj_b",
732
+ "model.language_model.layers.1.linear_attn.in_proj_a",
733
+ "model.language_model.layers.1.linear_attn.norm",
734
+ "model.language_model.layers.2.input_layernorm",
735
+ "model.language_model.layers.2.mlp.shared_expert_gate",
736
+ "model.language_model.layers.2.post_attention_layernorm",
737
+ "model.language_model.layers.2.mlp.gate",
738
+ "model.language_model.layers.2.linear_attn.A_log",
739
+ "model.language_model.layers.2.linear_attn.conv1d",
740
+ "model.language_model.layers.2.linear_attn.dt_bias",
741
+ "model.language_model.layers.2.linear_attn.in_proj_ba",
742
+ "model.language_model.layers.2.linear_attn.in_proj_b",
743
+ "model.language_model.layers.2.linear_attn.in_proj_a",
744
+ "model.language_model.layers.2.linear_attn.norm",
745
+ "model.language_model.layers.3.input_layernorm",
746
+ "model.language_model.layers.3.mlp.shared_expert_gate",
747
+ "model.language_model.layers.3.post_attention_layernorm",
748
+ "model.language_model.layers.3.mlp.gate",
749
+ "model.language_model.layers.3.self_attn.k_norm",
750
+ "model.language_model.layers.3.self_attn.q_norm",
751
+ "model.language_model.layers.4.input_layernorm",
752
+ "model.language_model.layers.4.mlp.shared_expert_gate",
753
+ "model.language_model.layers.4.post_attention_layernorm",
754
+ "model.language_model.layers.4.mlp.gate",
755
+ "model.language_model.layers.4.linear_attn.A_log",
756
+ "model.language_model.layers.4.linear_attn.conv1d",
757
+ "model.language_model.layers.4.linear_attn.dt_bias",
758
+ "model.language_model.layers.4.linear_attn.in_proj_ba",
759
+ "model.language_model.layers.4.linear_attn.in_proj_b",
760
+ "model.language_model.layers.4.linear_attn.in_proj_a",
761
+ "model.language_model.layers.4.linear_attn.norm",
762
+ "model.language_model.layers.5.input_layernorm",
763
+ "model.language_model.layers.5.mlp.shared_expert_gate",
764
+ "model.language_model.layers.5.post_attention_layernorm",
765
+ "model.language_model.layers.5.mlp.gate",
766
+ "model.language_model.layers.5.linear_attn.A_log",
767
+ "model.language_model.layers.5.linear_attn.conv1d",
768
+ "model.language_model.layers.5.linear_attn.dt_bias",
769
+ "model.language_model.layers.5.linear_attn.in_proj_ba",
770
+ "model.language_model.layers.5.linear_attn.in_proj_b",
771
+ "model.language_model.layers.5.linear_attn.in_proj_a",
772
+ "model.language_model.layers.5.linear_attn.norm",
773
+ "model.language_model.layers.6.input_layernorm",
774
+ "model.language_model.layers.6.mlp.shared_expert_gate",
775
+ "model.language_model.layers.6.post_attention_layernorm",
776
+ "model.language_model.layers.6.mlp.gate",
777
+ "model.language_model.layers.6.linear_attn.A_log",
778
+ "model.language_model.layers.6.linear_attn.conv1d",
779
+ "model.language_model.layers.6.linear_attn.dt_bias",
780
+ "model.language_model.layers.6.linear_attn.in_proj_ba",
781
+ "model.language_model.layers.6.linear_attn.in_proj_b",
782
+ "model.language_model.layers.6.linear_attn.in_proj_a",
783
+ "model.language_model.layers.6.linear_attn.norm",
784
+ "model.language_model.layers.7.input_layernorm",
785
+ "model.language_model.layers.7.mlp.shared_expert_gate",
786
+ "model.language_model.layers.7.post_attention_layernorm",
787
+ "model.language_model.layers.7.mlp.gate",
788
+ "model.language_model.layers.7.self_attn.k_norm",
789
+ "model.language_model.layers.7.self_attn.q_norm",
790
+ "model.language_model.layers.8.input_layernorm",
791
+ "model.language_model.layers.8.mlp.shared_expert_gate",
792
+ "model.language_model.layers.8.post_attention_layernorm",
793
+ "model.language_model.layers.8.mlp.gate",
794
+ "model.language_model.layers.8.linear_attn.A_log",
795
+ "model.language_model.layers.8.linear_attn.conv1d",
796
+ "model.language_model.layers.8.linear_attn.dt_bias",
797
+ "model.language_model.layers.8.linear_attn.in_proj_ba",
798
+ "model.language_model.layers.8.linear_attn.in_proj_b",
799
+ "model.language_model.layers.8.linear_attn.in_proj_a",
800
+ "model.language_model.layers.8.linear_attn.norm",
801
+ "model.language_model.layers.9.input_layernorm",
802
+ "model.language_model.layers.9.mlp.shared_expert_gate",
803
+ "model.language_model.layers.9.post_attention_layernorm",
804
+ "model.language_model.layers.9.mlp.gate",
805
+ "model.language_model.layers.9.linear_attn.A_log",
806
+ "model.language_model.layers.9.linear_attn.conv1d",
807
+ "model.language_model.layers.9.linear_attn.dt_bias",
808
+ "model.language_model.layers.9.linear_attn.in_proj_ba",
809
+ "model.language_model.layers.9.linear_attn.in_proj_b",
810
+ "model.language_model.layers.9.linear_attn.in_proj_a",
811
+ "model.language_model.layers.9.linear_attn.norm",
812
+ "model.language_model.layers.10.input_layernorm",
813
+ "model.language_model.layers.10.mlp.shared_expert_gate",
814
+ "model.language_model.layers.10.post_attention_layernorm",
815
+ "model.language_model.layers.10.mlp.gate",
816
+ "model.language_model.layers.10.linear_attn.A_log",
817
+ "model.language_model.layers.10.linear_attn.conv1d",
818
+ "model.language_model.layers.10.linear_attn.dt_bias",
819
+ "model.language_model.layers.10.linear_attn.in_proj_ba",
820
+ "model.language_model.layers.10.linear_attn.in_proj_b",
821
+ "model.language_model.layers.10.linear_attn.in_proj_a",
822
+ "model.language_model.layers.10.linear_attn.norm",
823
+ "model.language_model.layers.11.input_layernorm",
824
+ "model.language_model.layers.11.mlp.shared_expert_gate",
825
+ "model.language_model.layers.11.post_attention_layernorm",
826
+ "model.language_model.layers.11.mlp.gate",
827
+ "model.language_model.layers.11.self_attn.k_norm",
828
+ "model.language_model.layers.11.self_attn.q_norm",
829
+ "model.language_model.layers.12.input_layernorm",
830
+ "model.language_model.layers.12.mlp.shared_expert_gate",
831
+ "model.language_model.layers.12.post_attention_layernorm",
832
+ "model.language_model.layers.12.mlp.gate",
833
+ "model.language_model.layers.12.linear_attn.A_log",
834
+ "model.language_model.layers.12.linear_attn.conv1d",
835
+ "model.language_model.layers.12.linear_attn.dt_bias",
836
+ "model.language_model.layers.12.linear_attn.in_proj_ba",
837
+ "model.language_model.layers.12.linear_attn.in_proj_b",
838
+ "model.language_model.layers.12.linear_attn.in_proj_a",
839
+ "model.language_model.layers.12.linear_attn.norm",
840
+ "model.language_model.layers.13.input_layernorm",
841
+ "model.language_model.layers.13.mlp.shared_expert_gate",
842
+ "model.language_model.layers.13.post_attention_layernorm",
843
+ "model.language_model.layers.13.mlp.gate",
844
+ "model.language_model.layers.13.linear_attn.A_log",
845
+ "model.language_model.layers.13.linear_attn.conv1d",
846
+ "model.language_model.layers.13.linear_attn.dt_bias",
847
+ "model.language_model.layers.13.linear_attn.in_proj_ba",
848
+ "model.language_model.layers.13.linear_attn.in_proj_b",
849
+ "model.language_model.layers.13.linear_attn.in_proj_a",
850
+ "model.language_model.layers.13.linear_attn.norm",
851
+ "model.language_model.layers.14.input_layernorm",
852
+ "model.language_model.layers.14.mlp.shared_expert_gate",
853
+ "model.language_model.layers.14.post_attention_layernorm",
854
+ "model.language_model.layers.14.mlp.gate",
855
+ "model.language_model.layers.14.linear_attn.A_log",
856
+ "model.language_model.layers.14.linear_attn.conv1d",
857
+ "model.language_model.layers.14.linear_attn.dt_bias",
858
+ "model.language_model.layers.14.linear_attn.in_proj_ba",
859
+ "model.language_model.layers.14.linear_attn.in_proj_b",
860
+ "model.language_model.layers.14.linear_attn.in_proj_a",
861
+ "model.language_model.layers.14.linear_attn.norm",
862
+ "model.language_model.layers.15.input_layernorm",
863
+ "model.language_model.layers.15.mlp.shared_expert_gate",
864
+ "model.language_model.layers.15.post_attention_layernorm",
865
+ "model.language_model.layers.15.mlp.gate",
866
+ "model.language_model.layers.15.self_attn.k_norm",
867
+ "model.language_model.layers.15.self_attn.q_norm",
868
+ "model.language_model.layers.16.input_layernorm",
869
+ "model.language_model.layers.16.mlp.shared_expert_gate",
870
+ "model.language_model.layers.16.post_attention_layernorm",
871
+ "model.language_model.layers.16.mlp.gate",
872
+ "model.language_model.layers.16.linear_attn.A_log",
873
+ "model.language_model.layers.16.linear_attn.conv1d",
874
+ "model.language_model.layers.16.linear_attn.dt_bias",
875
+ "model.language_model.layers.16.linear_attn.in_proj_ba",
876
+ "model.language_model.layers.16.linear_attn.in_proj_b",
877
+ "model.language_model.layers.16.linear_attn.in_proj_a",
878
+ "model.language_model.layers.16.linear_attn.norm",
879
+ "model.language_model.layers.17.input_layernorm",
880
+ "model.language_model.layers.17.mlp.shared_expert_gate",
881
+ "model.language_model.layers.17.post_attention_layernorm",
882
+ "model.language_model.layers.17.mlp.gate",
883
+ "model.language_model.layers.17.linear_attn.A_log",
884
+ "model.language_model.layers.17.linear_attn.conv1d",
885
+ "model.language_model.layers.17.linear_attn.dt_bias",
886
+ "model.language_model.layers.17.linear_attn.in_proj_ba",
887
+ "model.language_model.layers.17.linear_attn.in_proj_b",
888
+ "model.language_model.layers.17.linear_attn.in_proj_a",
889
+ "model.language_model.layers.17.linear_attn.norm",
890
+ "model.language_model.layers.18.input_layernorm",
891
+ "model.language_model.layers.18.mlp.shared_expert_gate",
892
+ "model.language_model.layers.18.post_attention_layernorm",
893
+ "model.language_model.layers.18.mlp.gate",
894
+ "model.language_model.layers.18.linear_attn.A_log",
895
+ "model.language_model.layers.18.linear_attn.conv1d",
896
+ "model.language_model.layers.18.linear_attn.dt_bias",
897
+ "model.language_model.layers.18.linear_attn.in_proj_ba",
898
+ "model.language_model.layers.18.linear_attn.in_proj_b",
899
+ "model.language_model.layers.18.linear_attn.in_proj_a",
900
+ "model.language_model.layers.18.linear_attn.norm",
901
+ "model.language_model.layers.19.input_layernorm",
902
+ "model.language_model.layers.19.mlp.shared_expert_gate",
903
+ "model.language_model.layers.19.post_attention_layernorm",
904
+ "model.language_model.layers.19.mlp.gate",
905
+ "model.language_model.layers.19.self_attn.k_norm",
906
+ "model.language_model.layers.19.self_attn.q_norm",
907
+ "model.language_model.layers.20.input_layernorm",
908
+ "model.language_model.layers.20.mlp.shared_expert_gate",
909
+ "model.language_model.layers.20.post_attention_layernorm",
910
+ "model.language_model.layers.20.mlp.gate",
911
+ "model.language_model.layers.20.linear_attn.A_log",
912
+ "model.language_model.layers.20.linear_attn.conv1d",
913
+ "model.language_model.layers.20.linear_attn.dt_bias",
914
+ "model.language_model.layers.20.linear_attn.in_proj_ba",
915
+ "model.language_model.layers.20.linear_attn.in_proj_b",
916
+ "model.language_model.layers.20.linear_attn.in_proj_a",
917
+ "model.language_model.layers.20.linear_attn.norm",
918
+ "model.language_model.layers.21.input_layernorm",
919
+ "model.language_model.layers.21.mlp.shared_expert_gate",
920
+ "model.language_model.layers.21.post_attention_layernorm",
921
+ "model.language_model.layers.21.mlp.gate",
922
+ "model.language_model.layers.21.linear_attn.A_log",
923
+ "model.language_model.layers.21.linear_attn.conv1d",
924
+ "model.language_model.layers.21.linear_attn.dt_bias",
925
+ "model.language_model.layers.21.linear_attn.in_proj_ba",
926
+ "model.language_model.layers.21.linear_attn.in_proj_b",
927
+ "model.language_model.layers.21.linear_attn.in_proj_a",
928
+ "model.language_model.layers.21.linear_attn.norm",
929
+ "model.language_model.layers.22.input_layernorm",
930
+ "model.language_model.layers.22.mlp.shared_expert_gate",
931
+ "model.language_model.layers.22.post_attention_layernorm",
932
+ "model.language_model.layers.22.mlp.gate",
933
+ "model.language_model.layers.22.linear_attn.A_log",
934
+ "model.language_model.layers.22.linear_attn.conv1d",
935
+ "model.language_model.layers.22.linear_attn.dt_bias",
936
+ "model.language_model.layers.22.linear_attn.in_proj_ba",
937
+ "model.language_model.layers.22.linear_attn.in_proj_b",
938
+ "model.language_model.layers.22.linear_attn.in_proj_a",
939
+ "model.language_model.layers.22.linear_attn.norm",
940
+ "model.language_model.layers.23.input_layernorm",
941
+ "model.language_model.layers.23.mlp.shared_expert_gate",
942
+ "model.language_model.layers.23.post_attention_layernorm",
943
+ "model.language_model.layers.23.mlp.gate",
944
+ "model.language_model.layers.23.self_attn.k_norm",
945
+ "model.language_model.layers.23.self_attn.q_norm",
946
+ "model.language_model.layers.24.input_layernorm",
947
+ "model.language_model.layers.24.mlp.shared_expert_gate",
948
+ "model.language_model.layers.24.post_attention_layernorm",
949
+ "model.language_model.layers.24.mlp.gate",
950
+ "model.language_model.layers.24.linear_attn.A_log",
951
+ "model.language_model.layers.24.linear_attn.conv1d",
952
+ "model.language_model.layers.24.linear_attn.dt_bias",
953
+ "model.language_model.layers.24.linear_attn.in_proj_ba",
954
+ "model.language_model.layers.24.linear_attn.in_proj_b",
955
+ "model.language_model.layers.24.linear_attn.in_proj_a",
956
+ "model.language_model.layers.24.linear_attn.norm",
957
+ "model.language_model.layers.25.input_layernorm",
958
+ "model.language_model.layers.25.mlp.shared_expert_gate",
959
+ "model.language_model.layers.25.post_attention_layernorm",
960
+ "model.language_model.layers.25.mlp.gate",
961
+ "model.language_model.layers.25.linear_attn.A_log",
962
+ "model.language_model.layers.25.linear_attn.conv1d",
963
+ "model.language_model.layers.25.linear_attn.dt_bias",
964
+ "model.language_model.layers.25.linear_attn.in_proj_ba",
965
+ "model.language_model.layers.25.linear_attn.in_proj_b",
966
+ "model.language_model.layers.25.linear_attn.in_proj_a",
967
+ "model.language_model.layers.25.linear_attn.norm",
968
+ "model.language_model.layers.26.input_layernorm",
969
+ "model.language_model.layers.26.mlp.shared_expert_gate",
970
+ "model.language_model.layers.26.post_attention_layernorm",
971
+ "model.language_model.layers.26.mlp.gate",
972
+ "model.language_model.layers.26.linear_attn.A_log",
973
+ "model.language_model.layers.26.linear_attn.conv1d",
974
+ "model.language_model.layers.26.linear_attn.dt_bias",
975
+ "model.language_model.layers.26.linear_attn.in_proj_ba",
976
+ "model.language_model.layers.26.linear_attn.in_proj_b",
977
+ "model.language_model.layers.26.linear_attn.in_proj_a",
978
+ "model.language_model.layers.26.linear_attn.norm",
979
+ "model.language_model.layers.27.input_layernorm",
980
+ "model.language_model.layers.27.mlp.shared_expert_gate",
981
+ "model.language_model.layers.27.post_attention_layernorm",
982
+ "model.language_model.layers.27.mlp.gate",
983
+ "model.language_model.layers.27.self_attn.k_norm",
984
+ "model.language_model.layers.27.self_attn.q_norm",
985
+ "model.language_model.layers.28.input_layernorm",
986
+ "model.language_model.layers.28.mlp.shared_expert_gate",
987
+ "model.language_model.layers.28.post_attention_layernorm",
988
+ "model.language_model.layers.28.mlp.gate",
989
+ "model.language_model.layers.28.linear_attn.A_log",
990
+ "model.language_model.layers.28.linear_attn.conv1d",
991
+ "model.language_model.layers.28.linear_attn.dt_bias",
992
+ "model.language_model.layers.28.linear_attn.in_proj_ba",
993
+ "model.language_model.layers.28.linear_attn.in_proj_b",
994
+ "model.language_model.layers.28.linear_attn.in_proj_a",
995
+ "model.language_model.layers.28.linear_attn.norm",
996
+ "model.language_model.layers.29.input_layernorm",
997
+ "model.language_model.layers.29.mlp.shared_expert_gate",
998
+ "model.language_model.layers.29.post_attention_layernorm",
999
+ "model.language_model.layers.29.mlp.gate",
1000
+ "model.language_model.layers.29.linear_attn.A_log",
1001
+ "model.language_model.layers.29.linear_attn.conv1d",
1002
+ "model.language_model.layers.29.linear_attn.dt_bias",
1003
+ "model.language_model.layers.29.linear_attn.in_proj_ba",
1004
+ "model.language_model.layers.29.linear_attn.in_proj_b",
1005
+ "model.language_model.layers.29.linear_attn.in_proj_a",
1006
+ "model.language_model.layers.29.linear_attn.norm",
1007
+ "model.language_model.layers.30.input_layernorm",
1008
+ "model.language_model.layers.30.mlp.shared_expert_gate",
1009
+ "model.language_model.layers.30.post_attention_layernorm",
1010
+ "model.language_model.layers.30.mlp.gate",
1011
+ "model.language_model.layers.30.linear_attn.A_log",
1012
+ "model.language_model.layers.30.linear_attn.conv1d",
1013
+ "model.language_model.layers.30.linear_attn.dt_bias",
1014
+ "model.language_model.layers.30.linear_attn.in_proj_ba",
1015
+ "model.language_model.layers.30.linear_attn.in_proj_b",
1016
+ "model.language_model.layers.30.linear_attn.in_proj_a",
1017
+ "model.language_model.layers.30.linear_attn.norm",
1018
+ "model.language_model.layers.31.input_layernorm",
1019
+ "model.language_model.layers.31.mlp.shared_expert_gate",
1020
+ "model.language_model.layers.31.post_attention_layernorm",
1021
+ "model.language_model.layers.31.mlp.gate",
1022
+ "model.language_model.layers.31.self_attn.k_norm",
1023
+ "model.language_model.layers.31.self_attn.q_norm",
1024
+ "model.language_model.layers.32.input_layernorm",
1025
+ "model.language_model.layers.32.mlp.shared_expert_gate",
1026
+ "model.language_model.layers.32.post_attention_layernorm",
1027
+ "model.language_model.layers.32.mlp.gate",
1028
+ "model.language_model.layers.32.linear_attn.A_log",
1029
+ "model.language_model.layers.32.linear_attn.conv1d",
1030
+ "model.language_model.layers.32.linear_attn.dt_bias",
1031
+ "model.language_model.layers.32.linear_attn.in_proj_ba",
1032
+ "model.language_model.layers.32.linear_attn.in_proj_b",
1033
+ "model.language_model.layers.32.linear_attn.in_proj_a",
1034
+ "model.language_model.layers.32.linear_attn.norm",
1035
+ "model.language_model.layers.33.input_layernorm",
1036
+ "model.language_model.layers.33.mlp.shared_expert_gate",
1037
+ "model.language_model.layers.33.post_attention_layernorm",
1038
+ "model.language_model.layers.33.mlp.gate",
1039
+ "model.language_model.layers.33.linear_attn.A_log",
1040
+ "model.language_model.layers.33.linear_attn.conv1d",
1041
+ "model.language_model.layers.33.linear_attn.dt_bias",
1042
+ "model.language_model.layers.33.linear_attn.in_proj_ba",
1043
+ "model.language_model.layers.33.linear_attn.in_proj_b",
1044
+ "model.language_model.layers.33.linear_attn.in_proj_a",
1045
+ "model.language_model.layers.33.linear_attn.norm",
1046
+ "model.language_model.layers.34.input_layernorm",
1047
+ "model.language_model.layers.34.mlp.shared_expert_gate",
1048
+ "model.language_model.layers.34.post_attention_layernorm",
1049
+ "model.language_model.layers.34.mlp.gate",
1050
+ "model.language_model.layers.34.linear_attn.A_log",
1051
+ "model.language_model.layers.34.linear_attn.conv1d",
1052
+ "model.language_model.layers.34.linear_attn.dt_bias",
1053
+ "model.language_model.layers.34.linear_attn.in_proj_ba",
1054
+ "model.language_model.layers.34.linear_attn.in_proj_b",
1055
+ "model.language_model.layers.34.linear_attn.in_proj_a",
1056
+ "model.language_model.layers.34.linear_attn.norm",
1057
+ "model.language_model.layers.35.input_layernorm",
1058
+ "model.language_model.layers.35.mlp.shared_expert_gate",
1059
+ "model.language_model.layers.35.post_attention_layernorm",
1060
+ "model.language_model.layers.35.mlp.gate",
1061
+ "model.language_model.layers.35.self_attn.k_norm",
1062
+ "model.language_model.layers.35.self_attn.q_norm",
1063
+ "model.language_model.layers.36.input_layernorm",
1064
+ "model.language_model.layers.36.mlp.shared_expert_gate",
1065
+ "model.language_model.layers.36.post_attention_layernorm",
1066
+ "model.language_model.layers.36.mlp.gate",
1067
+ "model.language_model.layers.36.linear_attn.A_log",
1068
+ "model.language_model.layers.36.linear_attn.conv1d",
1069
+ "model.language_model.layers.36.linear_attn.dt_bias",
1070
+ "model.language_model.layers.36.linear_attn.in_proj_ba",
1071
+ "model.language_model.layers.36.linear_attn.in_proj_b",
1072
+ "model.language_model.layers.36.linear_attn.in_proj_a",
1073
+ "model.language_model.layers.36.linear_attn.norm",
1074
+ "model.language_model.layers.37.input_layernorm",
1075
+ "model.language_model.layers.37.mlp.shared_expert_gate",
1076
+ "model.language_model.layers.37.post_attention_layernorm",
1077
+ "model.language_model.layers.37.mlp.gate",
1078
+ "model.language_model.layers.37.linear_attn.A_log",
1079
+ "model.language_model.layers.37.linear_attn.conv1d",
1080
+ "model.language_model.layers.37.linear_attn.dt_bias",
1081
+ "model.language_model.layers.37.linear_attn.in_proj_ba",
1082
+ "model.language_model.layers.37.linear_attn.in_proj_b",
1083
+ "model.language_model.layers.37.linear_attn.in_proj_a",
1084
+ "model.language_model.layers.37.linear_attn.norm",
1085
+ "model.language_model.layers.38.input_layernorm",
1086
+ "model.language_model.layers.38.mlp.shared_expert_gate",
1087
+ "model.language_model.layers.38.post_attention_layernorm",
1088
+ "model.language_model.layers.38.mlp.gate",
1089
+ "model.language_model.layers.38.linear_attn.A_log",
1090
+ "model.language_model.layers.38.linear_attn.conv1d",
1091
+ "model.language_model.layers.38.linear_attn.dt_bias",
1092
+ "model.language_model.layers.38.linear_attn.in_proj_ba",
1093
+ "model.language_model.layers.38.linear_attn.in_proj_b",
1094
+ "model.language_model.layers.38.linear_attn.in_proj_a",
1095
+ "model.language_model.layers.38.linear_attn.norm",
1096
+ "model.language_model.layers.39.input_layernorm",
1097
+ "model.language_model.layers.39.mlp.shared_expert_gate",
1098
+ "model.language_model.layers.39.post_attention_layernorm",
1099
+ "model.language_model.layers.39.mlp.gate",
1100
+ "model.language_model.layers.39.self_attn.k_norm",
1101
+ "model.language_model.layers.39.self_attn.q_norm",
1102
+ "model.language_model.layers.40.input_layernorm",
1103
+ "model.language_model.layers.40.mlp.shared_expert_gate",
1104
+ "model.language_model.layers.40.post_attention_layernorm",
1105
+ "model.language_model.layers.40.mlp.gate",
1106
+ "model.language_model.layers.40.linear_attn.A_log",
1107
+ "model.language_model.layers.40.linear_attn.conv1d",
1108
+ "model.language_model.layers.40.linear_attn.dt_bias",
1109
+ "model.language_model.layers.40.linear_attn.in_proj_ba",
1110
+ "model.language_model.layers.40.linear_attn.in_proj_b",
1111
+ "model.language_model.layers.40.linear_attn.in_proj_a",
1112
+ "model.language_model.layers.40.linear_attn.norm",
1113
+ "model.language_model.layers.41.input_layernorm",
1114
+ "model.language_model.layers.41.mlp.shared_expert_gate",
1115
+ "model.language_model.layers.41.post_attention_layernorm",
1116
+ "model.language_model.layers.41.mlp.gate",
1117
+ "model.language_model.layers.41.linear_attn.A_log",
1118
+ "model.language_model.layers.41.linear_attn.conv1d",
1119
+ "model.language_model.layers.41.linear_attn.dt_bias",
1120
+ "model.language_model.layers.41.linear_attn.in_proj_ba",
1121
+ "model.language_model.layers.41.linear_attn.in_proj_b",
1122
+ "model.language_model.layers.41.linear_attn.in_proj_a",
1123
+ "model.language_model.layers.41.linear_attn.norm",
1124
+ "model.language_model.layers.42.input_layernorm",
1125
+ "model.language_model.layers.42.mlp.shared_expert_gate",
1126
+ "model.language_model.layers.42.post_attention_layernorm",
1127
+ "model.language_model.layers.42.mlp.gate",
1128
+ "model.language_model.layers.42.linear_attn.A_log",
1129
+ "model.language_model.layers.42.linear_attn.conv1d",
1130
+ "model.language_model.layers.42.linear_attn.dt_bias",
1131
+ "model.language_model.layers.42.linear_attn.in_proj_ba",
1132
+ "model.language_model.layers.42.linear_attn.in_proj_b",
1133
+ "model.language_model.layers.42.linear_attn.in_proj_a",
1134
+ "model.language_model.layers.42.linear_attn.norm",
1135
+ "model.language_model.layers.43.input_layernorm",
1136
+ "model.language_model.layers.43.mlp.shared_expert_gate",
1137
+ "model.language_model.layers.43.post_attention_layernorm",
1138
+ "model.language_model.layers.43.mlp.gate",
1139
+ "model.language_model.layers.43.self_attn.k_norm",
1140
+ "model.language_model.layers.43.self_attn.q_norm",
1141
+ "model.language_model.layers.44.input_layernorm",
1142
+ "model.language_model.layers.44.mlp.shared_expert_gate",
1143
+ "model.language_model.layers.44.post_attention_layernorm",
1144
+ "model.language_model.layers.44.mlp.gate",
1145
+ "model.language_model.layers.44.linear_attn.A_log",
1146
+ "model.language_model.layers.44.linear_attn.conv1d",
1147
+ "model.language_model.layers.44.linear_attn.dt_bias",
1148
+ "model.language_model.layers.44.linear_attn.in_proj_ba",
1149
+ "model.language_model.layers.44.linear_attn.in_proj_b",
1150
+ "model.language_model.layers.44.linear_attn.in_proj_a",
1151
+ "model.language_model.layers.44.linear_attn.norm",
1152
+ "model.language_model.layers.45.input_layernorm",
1153
+ "model.language_model.layers.45.mlp.shared_expert_gate",
1154
+ "model.language_model.layers.45.post_attention_layernorm",
1155
+ "model.language_model.layers.45.mlp.gate",
1156
+ "model.language_model.layers.45.linear_attn.A_log",
1157
+ "model.language_model.layers.45.linear_attn.conv1d",
1158
+ "model.language_model.layers.45.linear_attn.dt_bias",
1159
+ "model.language_model.layers.45.linear_attn.in_proj_ba",
1160
+ "model.language_model.layers.45.linear_attn.in_proj_b",
1161
+ "model.language_model.layers.45.linear_attn.in_proj_a",
1162
+ "model.language_model.layers.45.linear_attn.norm",
1163
+ "model.language_model.layers.46.input_layernorm",
1164
+ "model.language_model.layers.46.mlp.shared_expert_gate",
1165
+ "model.language_model.layers.46.post_attention_layernorm",
1166
+ "model.language_model.layers.46.mlp.gate",
1167
+ "model.language_model.layers.46.linear_attn.A_log",
1168
+ "model.language_model.layers.46.linear_attn.conv1d",
1169
+ "model.language_model.layers.46.linear_attn.dt_bias",
1170
+ "model.language_model.layers.46.linear_attn.in_proj_ba",
1171
+ "model.language_model.layers.46.linear_attn.in_proj_b",
1172
+ "model.language_model.layers.46.linear_attn.in_proj_a",
1173
+ "model.language_model.layers.46.linear_attn.norm",
1174
+ "model.language_model.layers.47.input_layernorm",
1175
+ "model.language_model.layers.47.mlp.shared_expert_gate",
1176
+ "model.language_model.layers.47.post_attention_layernorm",
1177
+ "model.language_model.layers.47.mlp.gate",
1178
+ "model.language_model.layers.47.self_attn.k_norm",
1179
+ "model.language_model.layers.47.self_attn.q_norm",
1180
+ "model.language_model.layers.48.input_layernorm",
1181
+ "model.language_model.layers.48.mlp.shared_expert_gate",
1182
+ "model.language_model.layers.48.post_attention_layernorm",
1183
+ "model.language_model.layers.48.mlp.gate",
1184
+ "model.language_model.layers.48.linear_attn.A_log",
1185
+ "model.language_model.layers.48.linear_attn.conv1d",
1186
+ "model.language_model.layers.48.linear_attn.dt_bias",
1187
+ "model.language_model.layers.48.linear_attn.in_proj_ba",
1188
+ "model.language_model.layers.48.linear_attn.in_proj_b",
1189
+ "model.language_model.layers.48.linear_attn.in_proj_a",
1190
+ "model.language_model.layers.48.linear_attn.norm",
1191
+ "model.language_model.layers.49.input_layernorm",
1192
+ "model.language_model.layers.49.mlp.shared_expert_gate",
1193
+ "model.language_model.layers.49.post_attention_layernorm",
1194
+ "model.language_model.layers.49.mlp.gate",
1195
+ "model.language_model.layers.49.linear_attn.A_log",
1196
+ "model.language_model.layers.49.linear_attn.conv1d",
1197
+ "model.language_model.layers.49.linear_attn.dt_bias",
1198
+ "model.language_model.layers.49.linear_attn.in_proj_ba",
1199
+ "model.language_model.layers.49.linear_attn.in_proj_b",
1200
+ "model.language_model.layers.49.linear_attn.in_proj_a",
1201
+ "model.language_model.layers.49.linear_attn.norm",
1202
+ "model.language_model.layers.50.input_layernorm",
1203
+ "model.language_model.layers.50.mlp.shared_expert_gate",
1204
+ "model.language_model.layers.50.post_attention_layernorm",
1205
+ "model.language_model.layers.50.mlp.gate",
1206
+ "model.language_model.layers.50.linear_attn.A_log",
1207
+ "model.language_model.layers.50.linear_attn.conv1d",
1208
+ "model.language_model.layers.50.linear_attn.dt_bias",
1209
+ "model.language_model.layers.50.linear_attn.in_proj_ba",
1210
+ "model.language_model.layers.50.linear_attn.in_proj_b",
1211
+ "model.language_model.layers.50.linear_attn.in_proj_a",
1212
+ "model.language_model.layers.50.linear_attn.norm",
1213
+ "model.language_model.layers.51.input_layernorm",
1214
+ "model.language_model.layers.51.mlp.shared_expert_gate",
1215
+ "model.language_model.layers.51.post_attention_layernorm",
1216
+ "model.language_model.layers.51.mlp.gate",
1217
+ "model.language_model.layers.51.self_attn.k_norm",
1218
+ "model.language_model.layers.51.self_attn.q_norm",
1219
+ "model.language_model.layers.52.input_layernorm",
1220
+ "model.language_model.layers.52.mlp.shared_expert_gate",
1221
+ "model.language_model.layers.52.post_attention_layernorm",
1222
+ "model.language_model.layers.52.mlp.gate",
1223
+ "model.language_model.layers.52.linear_attn.A_log",
1224
+ "model.language_model.layers.52.linear_attn.conv1d",
1225
+ "model.language_model.layers.52.linear_attn.dt_bias",
1226
+ "model.language_model.layers.52.linear_attn.in_proj_ba",
1227
+ "model.language_model.layers.52.linear_attn.in_proj_b",
1228
+ "model.language_model.layers.52.linear_attn.in_proj_a",
1229
+ "model.language_model.layers.52.linear_attn.norm",
1230
+ "model.language_model.layers.53.input_layernorm",
1231
+ "model.language_model.layers.53.mlp.shared_expert_gate",
1232
+ "model.language_model.layers.53.post_attention_layernorm",
1233
+ "model.language_model.layers.53.mlp.gate",
1234
+ "model.language_model.layers.53.linear_attn.A_log",
1235
+ "model.language_model.layers.53.linear_attn.conv1d",
1236
+ "model.language_model.layers.53.linear_attn.dt_bias",
1237
+ "model.language_model.layers.53.linear_attn.in_proj_ba",
1238
+ "model.language_model.layers.53.linear_attn.in_proj_b",
1239
+ "model.language_model.layers.53.linear_attn.in_proj_a",
1240
+ "model.language_model.layers.53.linear_attn.norm",
1241
+ "model.language_model.layers.54.input_layernorm",
1242
+ "model.language_model.layers.54.mlp.shared_expert_gate",
1243
+ "model.language_model.layers.54.post_attention_layernorm",
1244
+ "model.language_model.layers.54.mlp.gate",
1245
+ "model.language_model.layers.54.linear_attn.A_log",
1246
+ "model.language_model.layers.54.linear_attn.conv1d",
1247
+ "model.language_model.layers.54.linear_attn.dt_bias",
1248
+ "model.language_model.layers.54.linear_attn.in_proj_ba",
1249
+ "model.language_model.layers.54.linear_attn.in_proj_b",
1250
+ "model.language_model.layers.54.linear_attn.in_proj_a",
1251
+ "model.language_model.layers.54.linear_attn.norm",
1252
+ "model.language_model.layers.55.input_layernorm",
1253
+ "model.language_model.layers.55.mlp.shared_expert_gate",
1254
+ "model.language_model.layers.55.post_attention_layernorm",
1255
+ "model.language_model.layers.55.mlp.gate",
1256
+ "model.language_model.layers.55.self_attn.k_norm",
1257
+ "model.language_model.layers.55.self_attn.q_norm",
1258
+ "model.language_model.layers.56.input_layernorm",
1259
+ "model.language_model.layers.56.mlp.shared_expert_gate",
1260
+ "model.language_model.layers.56.post_attention_layernorm",
1261
+ "model.language_model.layers.56.mlp.gate",
1262
+ "model.language_model.layers.56.linear_attn.A_log",
1263
+ "model.language_model.layers.56.linear_attn.conv1d",
1264
+ "model.language_model.layers.56.linear_attn.dt_bias",
1265
+ "model.language_model.layers.56.linear_attn.in_proj_ba",
1266
+ "model.language_model.layers.56.linear_attn.in_proj_b",
1267
+ "model.language_model.layers.56.linear_attn.in_proj_a",
1268
+ "model.language_model.layers.56.linear_attn.norm",
1269
+ "model.language_model.layers.57.input_layernorm",
1270
+ "model.language_model.layers.57.mlp.shared_expert_gate",
1271
+ "model.language_model.layers.57.post_attention_layernorm",
1272
+ "model.language_model.layers.57.mlp.gate",
1273
+ "model.language_model.layers.57.linear_attn.A_log",
1274
+ "model.language_model.layers.57.linear_attn.conv1d",
1275
+ "model.language_model.layers.57.linear_attn.dt_bias",
1276
+ "model.language_model.layers.57.linear_attn.in_proj_ba",
1277
+ "model.language_model.layers.57.linear_attn.in_proj_b",
1278
+ "model.language_model.layers.57.linear_attn.in_proj_a",
1279
+ "model.language_model.layers.57.linear_attn.norm",
1280
+ "model.language_model.layers.58.input_layernorm",
1281
+ "model.language_model.layers.58.mlp.shared_expert_gate",
1282
+ "model.language_model.layers.58.post_attention_layernorm",
1283
+ "model.language_model.layers.58.mlp.gate",
1284
+ "model.language_model.layers.58.linear_attn.A_log",
1285
+ "model.language_model.layers.58.linear_attn.conv1d",
1286
+ "model.language_model.layers.58.linear_attn.dt_bias",
1287
+ "model.language_model.layers.58.linear_attn.in_proj_ba",
1288
+ "model.language_model.layers.58.linear_attn.in_proj_b",
1289
+ "model.language_model.layers.58.linear_attn.in_proj_a",
1290
+ "model.language_model.layers.58.linear_attn.norm",
1291
+ "model.language_model.layers.59.input_layernorm",
1292
+ "model.language_model.layers.59.mlp.shared_expert_gate",
1293
+ "model.language_model.layers.59.post_attention_layernorm",
1294
+ "model.language_model.layers.59.mlp.gate",
1295
+ "model.language_model.layers.59.self_attn.k_norm",
1296
+ "model.language_model.layers.59.self_attn.q_norm",
1297
+ "model.language_model.layers.60.input_layernorm",
1298
+ "model.language_model.layers.60.mlp.shared_expert_gate",
1299
+ "model.language_model.layers.60.post_attention_layernorm",
1300
+ "model.language_model.layers.60.mlp.gate",
1301
+ "model.language_model.layers.60.linear_attn.A_log",
1302
+ "model.language_model.layers.60.linear_attn.conv1d",
1303
+ "model.language_model.layers.60.linear_attn.dt_bias",
1304
+ "model.language_model.layers.60.linear_attn.in_proj_ba",
1305
+ "model.language_model.layers.60.linear_attn.in_proj_b",
1306
+ "model.language_model.layers.60.linear_attn.in_proj_a",
1307
+ "model.language_model.layers.60.linear_attn.norm",
1308
+ "model.language_model.layers.61.input_layernorm",
1309
+ "model.language_model.layers.61.mlp.shared_expert_gate",
1310
+ "model.language_model.layers.61.post_attention_layernorm",
1311
+ "model.language_model.layers.61.mlp.gate",
1312
+ "model.language_model.layers.61.linear_attn.A_log",
1313
+ "model.language_model.layers.61.linear_attn.conv1d",
1314
+ "model.language_model.layers.61.linear_attn.dt_bias",
1315
+ "model.language_model.layers.61.linear_attn.in_proj_ba",
1316
+ "model.language_model.layers.61.linear_attn.in_proj_b",
1317
+ "model.language_model.layers.61.linear_attn.in_proj_a",
1318
+ "model.language_model.layers.61.linear_attn.norm",
1319
+ "model.language_model.layers.62.input_layernorm",
1320
+ "model.language_model.layers.62.mlp.shared_expert_gate",
1321
+ "model.language_model.layers.62.post_attention_layernorm",
1322
+ "model.language_model.layers.62.mlp.gate",
1323
+ "model.language_model.layers.62.linear_attn.A_log",
1324
+ "model.language_model.layers.62.linear_attn.conv1d",
1325
+ "model.language_model.layers.62.linear_attn.dt_bias",
1326
+ "model.language_model.layers.62.linear_attn.in_proj_ba",
1327
+ "model.language_model.layers.62.linear_attn.in_proj_b",
1328
+ "model.language_model.layers.62.linear_attn.in_proj_a",
1329
+ "model.language_model.layers.62.linear_attn.norm",
1330
+ "model.language_model.layers.63.input_layernorm",
1331
+ "model.language_model.layers.63.mlp.shared_expert_gate",
1332
+ "model.language_model.layers.63.post_attention_layernorm",
1333
+ "model.language_model.layers.63.mlp.gate",
1334
+ "model.language_model.layers.63.self_attn.k_norm",
1335
+ "model.language_model.layers.63.self_attn.q_norm",
1336
+ "mtp.layers.0.input_layernorm",
1337
+ "mtp.layers.0.mlp.gate",
1338
+ "mtp.layers.0.mlp.shared_expert_gate",
1339
+ "mtp.layers.0.post_attention_layernorm",
1340
+ "mtp.layers.0.self_attn.k_norm",
1341
+ "mtp.layers.0.self_attn.q_norm",
1342
+ "mtp.fc",
1343
+ "mtp.norm",
1344
+ "mtp.pre_fc_norm_embedding",
1345
+ "mtp.pre_fc_norm_hidden"
1346
+ ],
1347
+ "weight_block_size": [
1348
+ 128,
1349
+ 128
1350
+ ]
1351
+ }
1352
+ },
1353
+ "small_files": [
1354
+ "config.json",
1355
+ "generation_config.json",
1356
+ "chat_template.jinja",
1357
+ "tokenizer.json",
1358
+ "tokenizer_config.json",
1359
+ "vocab.json",
1360
+ "merges.txt",
1361
+ "preprocessor_config.json",
1362
+ "video_preprocessor_config.json"
1363
+ ],
1364
+ "lora_merges": []
1365
+ }
fp32_common.py ADDED
@@ -0,0 +1,585 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Shared code of the FP32 master-weights tools (masters_to_bf16.py, to_fp8.py, merge_lora.py and the checks).
2
+
3
+ Needs python >= 3.9 and torch (a CPU build is enough). Nothing else: the weight files are read and written here,
4
+ so the bytes of an output do not depend on the version of any serialization library. Tested with python 3.14.4 and
5
+ torch 2.14.0 on x86-64 Linux.
6
+
7
+ WEIGHT FILE LAYOUT (what write_shard writes: the usual layout of .safetensors files, readable by any loader of them)
8
+ 8 bytes little-endian unsigned length N of the header
9
+ N bytes the header: compact JSON (separators "," and ":"), first key "__metadata__" = {"format":"pt"}, then one
10
+ key per tensor {"dtype","shape","data_offsets":[begin,end]}, padded with spaces to a multiple of 8 bytes
11
+ the rest the tensors' little-endian bytes, back to back, in header order
12
+ Header order: by dtype (F32, then BF16, then F8_E4M3), then by name (byte order).
13
+
14
+ ROUNDING RULES (every tool uses these and nothing else)
15
+ FP32 -> BF16 round to nearest, ties to even: with u the 32 bits of the FP32 value as an unsigned integer,
16
+ bf16 = (u + 0x7FFF + ((u >> 16) & 1)) >> 16. [bf16_bits_exact]
17
+ FP32 -> FP8 e4m3 (after the caller's division and saturation at +-448) round to nearest, ties to the even
18
+ code: for a = |y|, e = exponent of a (a = m * 2^e, m in [0.5, 1)), e taken as -5 for
19
+ a < 2^-6; n = round_half_even(a * 2^(4 - e)); code = 8 * (e + 5) + n; sign bit 0x80.
20
+ [e4m3_bytes_exact]
21
+ The tools use the torch casts (x.to(torch.bfloat16), y.to(torch.float8_e4m3fn)), which implement the same rules,
22
+ and check that at start-up on a set of tie and boundary values (self_test); --exact-rounding uses the integer
23
+ formulas above for every element instead.
24
+ """
25
+ import ctypes
26
+ import hashlib
27
+ import json
28
+ import os
29
+ import re
30
+ import shutil
31
+ import struct
32
+ import sys
33
+ import time
34
+ from concurrent.futures import ThreadPoolExecutor
35
+
36
+ import torch
37
+
38
+ NL = chr(10)
39
+ INDEX = "model.safetensors.index.json"
40
+ MANIFEST = "fp32-release.json"
41
+ SUMS = "SHA256SUMS"
42
+ MTP_FILE = "mtp.safetensors"
43
+ MTP_NOTE = "mtp.json"
44
+ MANIFEST_FORMAT = "fp32-masters-v1"
45
+ # The linear-attention decay parameters: FP32 in the BF16 and FP8 folders too, as trained.
46
+ A_LOG = re.compile("model[.]language_model[.]layers[.][0-9]+[.]linear_attn[.]A_log")
47
+ BLOCK = 128
48
+ FP8_MAX = 448.0
49
+ TORCH_DTYPE = {"F32": torch.float32, "BF16": torch.bfloat16, "F8_E4M3": torch.uint8} # FP8 payloads are raw bytes
50
+ ITEM = {"F32": 4, "BF16": 2, "F8_E4M3": 1}
51
+ HEADER_RANK = {"F32": 0, "BF16": 1, "F8_E4M3": 2}
52
+ FP8_NATIVE = getattr(torch, "float8_e4m3fn", None)
53
+
54
+
55
+ def fail(message):
56
+ raise SystemExit("refusing: " + message)
57
+
58
+
59
+ def say(*parts):
60
+ print(*parts, flush=True)
61
+
62
+
63
+ # ------------------------------------------------------------------------------------------------ weight files
64
+
65
+ def _buffer(tensor):
66
+ """The tensor's memory as a ctypes byte array (the tensor must be contiguous and stay alive)."""
67
+ return (ctypes.c_char * (tensor.numel() * tensor.element_size())).from_address(tensor.data_ptr())
68
+
69
+
70
+ def count_of(shape):
71
+ n = 1
72
+ for d in shape:
73
+ n *= d
74
+ return n
75
+
76
+
77
+ class TensorFile:
78
+ """One weight file: its header, and reads of single tensors."""
79
+
80
+ def __init__(self, path):
81
+ self.path = str(path)
82
+ size = os.path.getsize(self.path)
83
+ with open(self.path, "rb") as f:
84
+ raw = f.read(8)
85
+ if len(raw) != 8:
86
+ fail("%s is too short to be a weight file" % self.path)
87
+ n = struct.unpack("<Q", raw)[0]
88
+ if n > min(size, 1 << 28):
89
+ fail("%s: header length %d is not plausible" % (self.path, n))
90
+ header = json.loads(f.read(n).decode("utf-8"))
91
+ self.metadata = header.pop("__metadata__", None)
92
+ self.entries = header
93
+ self.base = 8 + n
94
+ end = 0
95
+ for name, entry in header.items():
96
+ if entry["dtype"] not in ITEM:
97
+ fail("%s: tensor %s has dtype %s; only F32, BF16 and F8_E4M3 are handled" % (self.path, name, entry["dtype"]))
98
+ a, b = entry["data_offsets"]
99
+ if b - a != count_of(entry["shape"]) * ITEM[entry["dtype"]]:
100
+ fail("%s: tensor %s has a size that does not fit its shape" % (self.path, name))
101
+ end = max(end, b)
102
+ if size != self.base + end:
103
+ fail("%s: file size %d differs from the header's %d" % (self.path, size, self.base + end))
104
+
105
+ def names(self):
106
+ return list(self.entries)
107
+
108
+ def dtype(self, name):
109
+ return self.entries[name]["dtype"]
110
+
111
+ def shape(self, name):
112
+ return list(self.entries[name]["shape"])
113
+
114
+ def read(self, name, first=None):
115
+ """The tensor (F32 as float32, BF16 as bfloat16, F8_E4M3 as uint8 codes). FIRST: only the first FIRST
116
+ elements, flat."""
117
+ entry = self.entries[name]
118
+ count = count_of(entry["shape"])
119
+ if first is not None:
120
+ count = min(count, first)
121
+ tensor = torch.empty([count] if first is not None else entry["shape"], dtype=TORCH_DTYPE[entry["dtype"]])
122
+ if count:
123
+ view = memoryview(_buffer(tensor)).cast("B")
124
+ with open(self.path, "rb", buffering=0) as f:
125
+ f.seek(self.base + entry["data_offsets"][0])
126
+ got = 0
127
+ while got < len(view):
128
+ k = f.readinto(view[got:got + (1 << 28)])
129
+ if not k:
130
+ fail("%s: short read in tensor %s" % (self.path, name))
131
+ got += k
132
+ return tensor
133
+
134
+
135
+ class Folder:
136
+ """A model folder: model.safetensors.index.json and the weight files it names."""
137
+
138
+ def __init__(self, path):
139
+ self.path = str(path)
140
+ index_path = os.path.join(self.path, INDEX)
141
+ if not os.path.isfile(index_path):
142
+ fail("%s has no %s" % (self.path, INDEX))
143
+ with open(index_path) as f:
144
+ index = json.load(f)
145
+ self.weight_map = index["weight_map"] # in the file's order
146
+ self.total_size = (index.get("metadata") or {}).get("total_size")
147
+ self.files = {}
148
+ seen = {}
149
+ for shard in sorted(set(self.weight_map.values())):
150
+ self.files[shard] = TensorFile(os.path.join(self.path, shard))
151
+ for name in self.files[shard].names():
152
+ if name in seen or self.weight_map.get(name) != shard:
153
+ fail("%s: tensor %s is in %s but the index says %s" % (self.path, name, shard, self.weight_map.get(name)))
154
+ seen[name] = shard
155
+ if set(seen) != set(self.weight_map):
156
+ fail("%s: the index and the weight files name different tensors" % self.path)
157
+
158
+ def names(self):
159
+ return list(self.weight_map)
160
+
161
+ def shards(self):
162
+ return sorted(self.files)
163
+
164
+ def names_in(self, shard):
165
+ return [n for n, s in self.weight_map.items() if s == shard]
166
+
167
+ def dtype(self, name):
168
+ return self.files[self.weight_map[name]].dtype(name)
169
+
170
+ def shape(self, name):
171
+ return self.files[self.weight_map[name]].shape(name)
172
+
173
+ def read(self, name, first=None):
174
+ return self.files[self.weight_map[name]].read(name, first)
175
+
176
+
177
+ def write_shard(path, tensors):
178
+ """Write {name: (dtype name, tensor)} as one weight file in the layout of the module text.
179
+ Returns (sha256 of the file, its size in bytes)."""
180
+ names = sorted(tensors, key=lambda n: (HEADER_RANK[tensors[n][0]], n))
181
+ header = {"__metadata__": {"format": "pt"}}
182
+ offset = 0
183
+ for name in names:
184
+ kind, tensor = tensors[name]
185
+ if tensor.dtype != TORCH_DTYPE[kind]:
186
+ raise ValueError("%s: a %s tensor was handed over as %s" % (name, kind, tensor.dtype))
187
+ size = tensor.numel() * ITEM[kind]
188
+ header[name] = {"dtype": kind, "shape": list(tensor.shape), "data_offsets": [offset, offset + size]}
189
+ offset += size
190
+ blob = json.dumps(header, separators=(",", ":"), ensure_ascii=False).encode("utf-8")
191
+ blob += b" " * (-len(blob) % 8)
192
+ digest = hashlib.sha256()
193
+ head = struct.pack("<Q", len(blob)) + blob
194
+ temporary = str(path) + ".tmp"
195
+ with open(temporary, "wb") as f:
196
+ f.write(head)
197
+ digest.update(head)
198
+ for name in names:
199
+ tensor = tensors[name][1].contiguous()
200
+ if tensor.numel():
201
+ view = memoryview(_buffer(tensor)).cast("B")
202
+ for a in range(0, len(view), 1 << 26):
203
+ f.write(view[a:a + (1 << 26)])
204
+ digest.update(view[a:a + (1 << 26)])
205
+ os.replace(temporary, str(path))
206
+ return digest.hexdigest(), len(head) + offset
207
+
208
+
209
+ def tensor_bytes(kind, tensor):
210
+ return tensor.numel() * ITEM[kind]
211
+
212
+
213
+ # ------------------------------------------------------------------------------------------------ checksums
214
+
215
+ def sha256_file(path):
216
+ digest = hashlib.sha256()
217
+ with open(path, "rb", buffering=0) as f:
218
+ buffer = bytearray(1 << 24)
219
+ view = memoryview(buffer)
220
+ while True:
221
+ k = f.readinto(buffer)
222
+ if not k:
223
+ break
224
+ digest.update(view[:k])
225
+ return digest.hexdigest()
226
+
227
+
228
+ def sha256_bytes(data):
229
+ return hashlib.sha256(data).hexdigest()
230
+
231
+
232
+ def tensor_sha256(tensor):
233
+ tensor = tensor.contiguous()
234
+ digest = hashlib.sha256()
235
+ if tensor.numel():
236
+ digest.update(memoryview(_buffer(tensor)).cast("B"))
237
+ return digest.hexdigest()
238
+
239
+
240
+ def folder_files(folder):
241
+ return sorted(n for n in os.listdir(folder) if os.path.isfile(os.path.join(folder, n)) and n != SUMS)
242
+
243
+
244
+ def write_sums(folder, known=None, workers=8):
245
+ """Write FOLDER/SHA256SUMS over every file of the folder (not its sub-folders, not SHA256SUMS itself), in the
246
+ format of the sha256sum tool, names sorted. KNOWN: digests already computed while writing."""
247
+ known = dict(known or {})
248
+ names = folder_files(folder)
249
+ todo = [n for n in names if n not in known]
250
+ with ThreadPoolExecutor(max_workers=max(1, workers)) as pool:
251
+ for name, digest in zip(todo, pool.map(lambda n: sha256_file(os.path.join(folder, n)), todo)):
252
+ known[name] = digest
253
+ text = "".join("%s %s%s" % (known[n], n, NL) for n in names)
254
+ with open(os.path.join(folder, SUMS), "w") as f:
255
+ f.write(text)
256
+ return {n: known[n] for n in names}
257
+
258
+
259
+ def read_sums(path):
260
+ out = {}
261
+ with open(path) as f:
262
+ for line in f.read().split(NL):
263
+ if not line.strip():
264
+ continue
265
+ digest, _, name = line.partition(" ")
266
+ name = name.strip()
267
+ if name.startswith("*"):
268
+ name = name[1:]
269
+ if len(digest) != 64 or not name or name in out:
270
+ fail("%s: not a SHA256SUMS line: %r" % (path, line))
271
+ out[name] = digest.lower()
272
+ if not out:
273
+ fail("%s lists no files" % path)
274
+ return out
275
+
276
+
277
+ def check_sums(folder, published, workers=8):
278
+ """Compare every file of FOLDER with the PUBLISHED SHA256SUMS. True when the two name the same files with the
279
+ same digests; prints what differs otherwise."""
280
+ expected = read_sums(published)
281
+ own = os.path.join(folder, SUMS)
282
+ actual = read_sums(own) if os.path.isfile(own) else {}
283
+ names = folder_files(folder)
284
+ if set(actual) != set(names):
285
+ with ThreadPoolExecutor(max_workers=max(1, workers)) as pool:
286
+ actual = dict(zip(names, pool.map(lambda n: sha256_file(os.path.join(folder, n)), names)))
287
+ missing = sorted(set(expected) - set(actual))
288
+ extra = sorted(set(actual) - set(expected))
289
+ differ = sorted(n for n in expected if n in actual and expected[n] != actual[n])
290
+ same = len(expected) - len(missing) - len(differ)
291
+ say("CHECK against %s: %d files identical, %d differ, %d listed but absent, %d present but not listed" % (
292
+ published, same, len(differ), len(missing), len(extra)))
293
+ for label, group in (("differs", differ), ("absent", missing), ("not listed", extra)):
294
+ for name in group[:10]:
295
+ say(" %s: %s" % (label, name))
296
+ ok = not (missing or extra or differ)
297
+ say("CHECK", "OK" if ok else "FAILED")
298
+ return ok
299
+
300
+
301
+ # ------------------------------------------------------------------------------------------------ rounding
302
+
303
+ def bf16_bits_exact(x):
304
+ """FP32 -> the BF16 bit patterns (int16, same shape), round to nearest, ties to even, by integer arithmetic."""
305
+ u = x.contiguous().reshape(-1).view(torch.int32).to(torch.int64) & 0xFFFFFFFF
306
+ r = (u + 0x7FFF + ((u >> 16) & 1)) >> 16
307
+ r = torch.where(r >= 0x8000, r - 0x10000, r)
308
+ return r.to(torch.int16).reshape(x.shape)
309
+
310
+
311
+ def to_bf16(x, exact=False):
312
+ """FP32 -> BF16, round to nearest, ties to even."""
313
+ if x.dtype != torch.float32:
314
+ raise ValueError("to_bf16 takes FP32")
315
+ if exact:
316
+ return bf16_bits_exact(x).reshape(-1).view(torch.bfloat16).reshape(x.shape)
317
+ return x.to(torch.bfloat16)
318
+
319
+
320
+ def bits16(x):
321
+ return x.contiguous().reshape(-1).view(torch.int16)
322
+
323
+
324
+ def bits32(x):
325
+ return x.contiguous().reshape(-1).view(torch.int32)
326
+
327
+
328
+ def e4m3_bytes_exact(y):
329
+ """FP32 values with |y| <= 448 -> e4m3 codes (uint8, same shape), round to nearest, ties to the even code."""
330
+ a = y.abs()
331
+ _, e = torch.frexp(a)
332
+ e = torch.where(a < 2.0 ** -6, torch.full_like(e, -5), e)
333
+ n = torch.round(torch.ldexp(a, 4 - e)).to(torch.int32)
334
+ code = 8 * (e + 5) + n
335
+ code = code + torch.signbit(y).to(torch.int32) * 128
336
+ return code.to(torch.uint8)
337
+
338
+
339
+ def to_e4m3(y, exact=False):
340
+ if y.dtype != torch.float32:
341
+ raise ValueError("to_e4m3 takes FP32")
342
+ if exact:
343
+ return e4m3_bytes_exact(y)
344
+ return y.to(FP8_NATIVE).view(torch.uint8)
345
+
346
+
347
+ def e4m3_values():
348
+ """The value of each of the 256 e4m3 codes as FP32 (code 127 and 255, the NaNs, as NaN)."""
349
+ values = []
350
+ for code in range(256):
351
+ e, m = (code >> 3) & 15, code & 7
352
+ v = m * 2.0 ** -9 if e == 0 else (1 + m / 8) * 2.0 ** (e - 7)
353
+ if code & 127 == 127:
354
+ v = float("nan")
355
+ values.append(-v if code & 128 else v)
356
+ return torch.tensor(values, dtype=torch.float32)
357
+
358
+
359
+ def e4m3_decode(codes):
360
+ """uint8 codes -> FP32 values."""
361
+ return e4m3_values()[codes.reshape(-1).to(torch.int64)].reshape(codes.shape)
362
+
363
+
364
+ def self_test(fp8=False):
365
+ """Check this torch build's casts against the integer rules on tie and boundary values. Refuses on a
366
+ difference (use --exact-rounding then)."""
367
+ generator = torch.Generator().manual_seed(20261125)
368
+ bits = torch.randint(-2 ** 31, 2 ** 31 - 1, (1 << 18,), generator=generator, dtype=torch.int64)
369
+ low = torch.tensor([0x7FFF, 0x8000, 0x8001, 0x0000, 0xFFFF], dtype=torch.int64)
370
+ ties = (bits[: 1 << 16, None] & ~0xFFFF) | low[None, :]
371
+ every = torch.cat([bits, ties.reshape(-1)])
372
+ every = every[((every >> 23) & 0xFF) != 0xFF] # finite values only
373
+ every = torch.where(every >= 2 ** 31, every - 2 ** 32, every).to(torch.int32)
374
+ x = every.view(torch.float32)
375
+ if not torch.equal(bits16(x.to(torch.bfloat16)), bf16_bits_exact(x)):
376
+ fail("this torch build's FP32 -> BF16 cast is not round-to-nearest-even on the test values; "
377
+ "run with --exact-rounding")
378
+ if not fp8:
379
+ return
380
+ if FP8_NATIVE is None:
381
+ fail("this torch build has no float8_e4m3fn; run with --exact-rounding")
382
+ values = e4m3_values()[:127].double()
383
+ mids = (values[:-1] + values[1:]) / 2
384
+ points = torch.cat([values, mids]).float()
385
+ points = torch.cat([points, torch.nextafter(points, torch.full_like(points, 1000.0)),
386
+ torch.nextafter(points, torch.full_like(points, -1000.0))])
387
+ points = points[points.abs() <= FP8_MAX]
388
+ spread = (torch.rand(1 << 18, generator=generator) * 2 - 1) * FP8_MAX
389
+ small = torch.exp(torch.rand(1 << 16, generator=generator) * -30.0)
390
+ y = torch.cat([points, -points, spread, small, -small, torch.tensor([0.0, -0.0, FP8_MAX, -FP8_MAX])])
391
+ if not torch.equal(y.to(FP8_NATIVE).view(torch.uint8), e4m3_bytes_exact(y)):
392
+ fail("this torch build's FP32 -> FP8 e4m3 cast is not round-to-nearest-even on the test values; "
393
+ "run with --exact-rounding")
394
+ back = e4m3_decode(e4m3_bytes_exact(y))
395
+ if not bool(((back - y).abs() <= (y.abs() / 16).clamp_min(2.0 ** -10)).all()):
396
+ raise RuntimeError("the e4m3 rule and its value table disagree")
397
+
398
+
399
+ def fp8_quantize(x, scale_rule="stored", exact=False):
400
+ """FP8 e4m3 quantization of a matrix in 128 x 128 blocks.
401
+
402
+ x FP32 [R, C]
403
+ scale per block, FP32: max(|x|) / 448 (FP32 division); stored as weight_scale_inv = bf16(scale)
404
+ codes e4m3(saturate(x / divisor, -448, 448)), with an FP32 division, where
405
+ divisor = fp32(bf16(scale)) for scale_rule "stored" (the value a loader multiplies by)
406
+ divisor = scale for scale_rule "unrounded" (how our first FP8 conversion was made)
407
+ and divisor = 1 for an all-zero block.
408
+ Returns (codes uint8 [R, C], weight_scale_inv bfloat16 [ceil(R/128), ceil(C/128)])."""
409
+ if x.dtype != torch.float32 or x.dim() != 2:
410
+ raise ValueError("fp8_quantize takes an FP32 matrix")
411
+ if scale_rule not in ("stored", "unrounded"):
412
+ raise ValueError("unknown scale rule")
413
+ rows, cols = x.shape
414
+ rb, cb = -(-rows // BLOCK), -(-cols // BLOCK)
415
+ if rows % BLOCK or cols % BLOCK:
416
+ padded = torch.zeros(rb * BLOCK, cb * BLOCK, dtype=torch.float32)
417
+ padded[:rows, :cols] = x
418
+ x = padded
419
+ blocks = x.reshape(rb, BLOCK, cb, BLOCK).permute(0, 2, 1, 3)
420
+ scale = blocks.abs().amax(dim=(-1, -2), keepdim=True) / FP8_MAX
421
+ stored = to_bf16(scale, exact)
422
+ divisor = stored.float() if scale_rule == "stored" else scale
423
+ if bool(((divisor == 0) & (scale > 0)).any()):
424
+ fail("a block's scale rounds to zero in BF16")
425
+ divisor = torch.where(divisor > 0, divisor, torch.ones_like(divisor))
426
+ y = (blocks / divisor).clamp_(-FP8_MAX, FP8_MAX)
427
+ codes = to_e4m3(y, exact)
428
+ codes = codes.permute(0, 2, 1, 3).reshape(rb * BLOCK, cb * BLOCK)[:rows, :cols].contiguous()
429
+ return codes, stored[..., 0, 0].contiguous()
430
+
431
+
432
+ def fp8_dequantize(codes, scale_inv):
433
+ """The FP32 values a loader computes: value(code) * fp32(weight_scale_inv) per block."""
434
+ rows, cols = codes.shape
435
+ rb, cb = scale_inv.shape
436
+ values = e4m3_decode(codes)
437
+ scale = scale_inv.float().repeat_interleave(BLOCK, dim=0)[:rows].repeat_interleave(BLOCK, dim=1)[:, :cols]
438
+ return values * scale
439
+
440
+
441
+ def finite(name, x):
442
+ if not bool(torch.isfinite(x).all()):
443
+ fail("%s holds a NaN or an infinity" % name)
444
+
445
+
446
+ # ------------------------------------------------------------------------------------------------ release folders
447
+
448
+ def load_manifest(masters):
449
+ path = os.path.join(masters, MANIFEST)
450
+ if not os.path.isfile(path):
451
+ fail("%s has no %s; it is not an FP32 master-weights folder" % (masters, MANIFEST))
452
+ with open(path) as f:
453
+ manifest = json.load(f)
454
+ if manifest.get("format") != MANIFEST_FORMAT:
455
+ fail("%s: format %r, expected %s" % (path, manifest.get("format"), MANIFEST_FORMAT))
456
+ return manifest
457
+
458
+
459
+ def open_masters(path):
460
+ """(Folder, manifest) of an FP32 master-weights folder; refuses anything that is not all FP32 or lists the
461
+ draft head."""
462
+ manifest = load_manifest(path)
463
+ folder = Folder(path)
464
+ wrong = [n for n in folder.names() if folder.dtype(n) != "F32"]
465
+ if wrong:
466
+ fail("%s: %d tensors are not FP32 (first: %s)" % (path, len(wrong), wrong[0]))
467
+ listed = [n for n in folder.names() if n.startswith("mtp.")]
468
+ if listed:
469
+ fail("%s: the index lists draft-head tensors (%s); they belong in %s" % (path, listed[0], MTP_FILE))
470
+ return folder, manifest
471
+
472
+
473
+ def open_mtp(masters, manifest, mtp, no_mtp):
474
+ """The draft (MTP) head's file, or None for --no-mtp. Default: MASTERS/mtp.safetensors."""
475
+ if no_mtp:
476
+ if mtp:
477
+ fail("--mtp and --no-mtp exclude each other")
478
+ return None
479
+ path = mtp or os.path.join(masters, MTP_FILE)
480
+ if not os.path.isfile(path):
481
+ fail("no draft head at %s; name one with --mtp FILE, or pass --no-mtp to write a folder without it" % path)
482
+ head = TensorFile(path)
483
+ expected = manifest["mtp"]["bf16_shards"]
484
+ if set(head.names()) != set(expected):
485
+ fail("%s holds other tensors than the release's draft head (%d against %d names)" % (
486
+ path, len(head.names()), len(expected)))
487
+ wrong = [n for n in head.names() if head.dtype(n) != "F32"]
488
+ if wrong:
489
+ fail("%s: %s is not FP32" % (path, wrong[0]))
490
+ return head
491
+
492
+
493
+ def export_plan(folder, manifest, head):
494
+ """[(shard file, [(tensor name, source)])] of an export, and its tensor order: the masters' tensors in index
495
+ order, then the draft head's by name, each in the shard the BF16 release has it in."""
496
+ order = [(name, folder) for name in folder.names()]
497
+ shard_of = dict(folder.weight_map)
498
+ if head is not None:
499
+ for name in sorted(head.names()):
500
+ order.append((name, head))
501
+ shard_of[name] = manifest["mtp"]["bf16_shards"][name]
502
+ plan = {}
503
+ for name, source in order:
504
+ plan.setdefault(shard_of[name], []).append((name, source))
505
+ return sorted(plan.items()), [name for name, _ in order], shard_of
506
+
507
+
508
+ def start_output(out):
509
+ out = os.path.abspath(out)
510
+ partial = out + ".partial"
511
+ if os.path.exists(out) or os.path.exists(partial):
512
+ fail("%s (or its .partial) exists; choose a new name" % out)
513
+ if not os.path.isdir(os.path.dirname(out)):
514
+ fail("%s is not a folder" % os.path.dirname(out))
515
+ os.mkdir(partial)
516
+ return out, partial
517
+
518
+
519
+ def copy_small_files(source, names, destination, skip=()):
520
+ for name in names:
521
+ if name in skip:
522
+ continue
523
+ path = os.path.join(source, name)
524
+ if not os.path.isfile(path):
525
+ fail("%s lacks %s, which the release's file list names" % (source, name))
526
+ shutil.copyfile(path, os.path.join(destination, name))
527
+
528
+
529
+ def run_shards(jobs, work, workers):
530
+ """work(job) for every job on WORKERS threads; results in job order. The first failure stops the run."""
531
+ started = time.time()
532
+ results = []
533
+ with ThreadPoolExecutor(max_workers=max(1, workers)) as pool:
534
+ futures = [pool.submit(work, job) for job in jobs]
535
+ try:
536
+ for number, future in enumerate(futures, 1):
537
+ results.append(future.result())
538
+ if number % 8 == 0 or number == len(futures):
539
+ say(" %d of %d weight files done, %.0f s" % (number, len(futures), time.time() - started))
540
+ except BaseException:
541
+ for future in futures:
542
+ future.cancel()
543
+ raise
544
+ return results
545
+
546
+
547
+ def finish(partial, out, digests, sums, workers):
548
+ """Write SHA256SUMS, move the folder into place, and compare it with the published list SUMS when one is
549
+ given. Exit status 1 on a failed comparison (the folder stays, for inspection)."""
550
+ write_sums(partial, digests, workers)
551
+ os.rename(partial, out)
552
+ if sums:
553
+ if not check_sums(out, sums, workers):
554
+ sys.exit(1)
555
+
556
+
557
+ def published_sums(args, default):
558
+ """The list --check compares with: --sums FILE, or DEFAULT (a file of the source folder). None without
559
+ --check. Refuses before any work when the list is missing."""
560
+ if not (args.check or args.check_only):
561
+ if args.sums:
562
+ fail("--sums is the list for --check; pass --check too")
563
+ return None
564
+ path = args.sums or default
565
+ if not path:
566
+ fail("--check needs --sums FILE here")
567
+ if not os.path.isfile(path):
568
+ fail("--check: no list at %s" % path)
569
+ return path
570
+
571
+
572
+ def add_common_arguments(parser):
573
+ parser.add_argument("--workers", type=int, default=8, help="weight files converted at a time (default 8)")
574
+ parser.add_argument("--threads", type=int, default=4, help="torch threads per worker (default 4)")
575
+ parser.add_argument("--exact-rounding", action="store_true",
576
+ help="round every element with the integer formulas instead of the torch casts")
577
+ parser.add_argument("--check", action="store_true",
578
+ help="after writing, compare every output file with the published list; exit 1 on a difference")
579
+ parser.add_argument("--sums", metavar="FILE", help="the list --check compares with, when not the source folder's")
580
+ parser.add_argument("--check-only", action="store_true",
581
+ help="write nothing: compare the existing output folder with the published list")
582
+
583
+
584
+ def versions():
585
+ return "python %s, torch %s" % (sys.version.split()[0], torch.__version__)
generation_config.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 248044,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 248046,
6
+ 248044
7
+ ],
8
+ "pad_token_id": 248044,
9
+ "temperature": 1.0,
10
+ "top_k": 20,
11
+ "top_p": 0.95
12
+ }
masters_to_bf16.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FP32 master weights -> the BF16 model folder.
2
+
3
+ Every tensor is rounded FP32 -> BF16, to nearest with ties to even (fp32_common.py states the rule), except the 48
4
+ linear-attention decay tensors (...linear_attn.A_log), which stay FP32 as they are in the BF16 release. The vision
5
+ tower, which was never trained here, is an exact FP32 copy of its BF16 values, so rounding returns them. Tensor
6
+ names, the split into weight files and the index are those of the BF16 release; config, tokenizer and chat template
7
+ are copied. The output carries its own SHA256SUMS.
8
+
9
+ usage: masters_to_bf16.py SRC DST [--check] [--no-mtp] [--mtp FILE]
10
+ [--sums FILE] [--check-only] [--workers 8] [--threads 4] [--exact-rounding]
11
+
12
+ SRC the FP32 master-weights folder (the release folder)
13
+ DST the BF16 folder to write (must not exist)
14
+
15
+ --mtp FILE the draft head's FP32 weights (default SRC/mtp.safetensors). It is written into the weight files
16
+ the BF16 release has it in, so the output equals the full BF16 release byte for byte.
17
+ --no-mtp write a folder without the draft head (for serving with a separate head, or without drafting).
18
+ config.json still says mtp_num_hidden_layers = 1; such a folder does not match the published list.
19
+ --check compare DST, file by file, with SRC/SHA256SUMS.bf16 (or --sums FILE); exit status 1 on any
20
+ difference. --check-only does only that, on an existing DST.
21
+
22
+ Needs python >= 3.9 and torch (CPU). About 110 GB is read and 56 GB written; peak memory is about
23
+ workers x 8 GB.
24
+ """
25
+ import argparse
26
+ import json
27
+ import os
28
+ import sys
29
+
30
+ import torch
31
+
32
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # the tools find each other in any python mode
33
+ import fp32_common as c
34
+
35
+
36
+ def convert_shard(job):
37
+ shard, items, partial, exact = job
38
+ tensors = {}
39
+ for name, source in items:
40
+ x = source.read(name)
41
+ c.finite(name, x)
42
+ if c.A_LOG.fullmatch(name):
43
+ tensors[name] = ("F32", x)
44
+ else:
45
+ tensors[name] = ("BF16", c.to_bf16(x, exact))
46
+ digest, size = c.write_shard(os.path.join(partial, shard), tensors)
47
+ return shard, digest, sum(c.tensor_bytes(kind, t) for kind, t in tensors.values())
48
+
49
+
50
+ def main():
51
+ parser = argparse.ArgumentParser(description=__doc__.split(c.NL)[0], allow_abbrev=False)
52
+ parser.add_argument("masters")
53
+ parser.add_argument("output")
54
+ parser.add_argument("--mtp", metavar="FILE")
55
+ parser.add_argument("--no-mtp", action="store_true")
56
+ c.add_common_arguments(parser)
57
+ args = parser.parse_args()
58
+ sums = c.published_sums(args, os.path.join(args.masters, "SHA256SUMS.bf16"))
59
+ if args.check_only:
60
+ sys.exit(0 if c.check_sums(args.output, sums, args.workers) else 1)
61
+ if args.no_mtp and sums:
62
+ c.fail("a folder without the draft head cannot match the published list; drop --check or --no-mtp")
63
+ torch.set_grad_enabled(False)
64
+ torch.set_num_threads(args.threads)
65
+ c.say("masters_to_bf16:", c.versions())
66
+ if not args.exact_rounding:
67
+ c.self_test()
68
+ folder, manifest = c.open_masters(args.masters)
69
+ head = c.open_mtp(args.masters, manifest, args.mtp, args.no_mtp)
70
+ plan, order, shard_of = c.export_plan(folder, manifest, head)
71
+ out, partial = c.start_output(args.output)
72
+ results = c.run_shards([(shard, items, partial, args.exact_rounding) for shard, items in plan],
73
+ convert_shard, args.workers)
74
+ digests = {shard: digest for shard, digest, _ in results}
75
+ index = {"metadata": {"total_size": sum(size for _, _, size in results)},
76
+ "weight_map": {name: shard_of[name] for name in order}}
77
+ with open(os.path.join(partial, c.INDEX), "w") as f:
78
+ f.write(json.dumps(index, indent=2) + c.NL)
79
+ c.copy_small_files(args.masters, manifest["small_files"], partial)
80
+ c.finish(partial, out, digests, sums, args.workers)
81
+ c.say("BF16 DONE %s: %d tensors in %d weight files, %.2f GB%s" % (
82
+ out, len(order), len(results), index["metadata"]["total_size"] / 1e9,
83
+ "" if head is not None else "; NO DRAFT (MTP) HEAD in this folder: add one before serving with drafting"))
84
+
85
+
86
+ if __name__ == "__main__":
87
+ main()
merge_lora.py ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Merge a LoRA adapter (an adapter folder in the usual layout) into the FP32 master weights, then export.
2
+
3
+ A small low-rank update added to BF16 weights is mostly lost: each element moves by a fraction of a BF16 step and
4
+ rounds back. Added to the FP32 masters and rounded once, it survives. This script writes a new FP32
5
+ master-weights folder; masters_to_bf16.py and to_fp8.py then turn it into servable folders (--bf16, --fp8 run
6
+ them for you).
7
+
8
+ THE ARITHMETIC, exactly (so that the same adapter gives the same bytes everywhere):
9
+ For a target matrix W [out, in] (FP32) with adapter matrices A [r, in] and B [out, r]:
10
+ s = lora_alpha / r (lora_alpha / sqrt(r) with use_rslora), an IEEE double
11
+ acc[i, j] = sum over k = 0 .. r-1, in this order, of double(B[i, k]) * double(A[k, j])
12
+ (each product is exact in double; each addition is one IEEE double addition, starting from 0.0)
13
+ W'[i, j] = fp32( double(W[i, j]) + s * acc[i, j] )
14
+ (one double multiplication, one double addition, one rounding to FP32; all round to nearest even)
15
+ No matrix-multiply routine is used, because those sum in an order that depends on the machine.
16
+ Every tensor that is not a target is copied byte for byte.
17
+
18
+ --round-bf16: each merged matrix is then rounded to BF16 (to nearest, ties to even) and stored as FP32:
19
+ W''[i, j] = fp32( bf16( W'[i, j] ) )
20
+ Those values are exactly representable in BF16, so masters_to_bf16.py on the result changes nothing in them and
21
+ to_fp8.py quantizes the BF16-rounded merge directly. This is the merge for adapters that were trained against
22
+ BF16-rounded weights, round_bf16(master + update), with a straight-through estimator. Tensors that are not
23
+ targets stay as in SRC (FP32 masters) in this mode too.
24
+
25
+ ADAPTER
26
+ ADAPTER/adapter_config.json "peft_type": "LORA"; r, lora_alpha, use_rslora are read. Refused: use_dora, fan_in_fan_out,
27
+ rank_pattern / alpha_pattern, bias other than "none", modules_to_save, lora_bias.
28
+ ADAPTER/adapter_model.safetensors
29
+ keys base_model.model.<MODULE>.lora_A.weight [r, in] and .lora_B.weight [out, r],
30
+ FP32 or BF16; <MODULE>.weight must be a matrix [out, in] in the masters folder.
31
+ The draft head (a separate file) cannot be a target.
32
+
33
+ usage: merge_lora.py SRC ADAPTER_DIR DST [--round-bf16] [--bf16 DIR] [--fp8 DIR] [--mtp FILE | --no-mtp]
34
+ [--check --sums FILE] [--sums-bf16 FILE] [--sums-fp8 FILE]
35
+ [--workers 8] [--threads 4] [--exact-rounding]
36
+
37
+ SRC the FP32 master-weights folder (the release folder)
38
+ DST the merged FP32 master-weights folder to write: the same layout, mtp.safetensors copied unchanged,
39
+ its own SHA256SUMS, the merge recorded in lora-merge.json (mode, the adapter's sha256, scaling,
40
+ targets) and in fp32-release.json. The exports' lists of SRC (SHA256SUMS.bf16, SHA256SUMS.fp8)
41
+ do not apply to merged weights and are not copied.
42
+ --bf16 DIR then run masters_to_bf16.py DST DIR --fp8 DIR then run to_fp8.py DST DIR
43
+ --check --sums FILE compare DST with a list published for this merge
44
+ --sums-bf16 / --sums-fp8 FILE compare the BF16 / FP8 folder with a list published for this merge
45
+
46
+ Needs python >= 3.9 and torch (CPU).
47
+ """
48
+ import argparse
49
+ import json
50
+ import math
51
+ import os
52
+ import shutil
53
+ import subprocess
54
+ import sys
55
+
56
+ import torch
57
+
58
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # the tools find each other in any python mode
59
+ import fp32_common as c
60
+
61
+ PREFIX = "base_model.model."
62
+ MERGE_NOTE = "lora-merge.json"
63
+ ROWS_AT_A_TIME = 1 << 24 # elements per row block of the double-precision work
64
+
65
+
66
+ def read_adapter(folder):
67
+ """({target tensor name: (A, B)}, scaling, a record of the adapter for the manifest)."""
68
+ config_path = os.path.join(folder, "adapter_config.json")
69
+ weights_path = os.path.join(folder, "adapter_model.safetensors")
70
+ for path in (config_path, weights_path):
71
+ if not os.path.isfile(path):
72
+ c.fail("the adapter folder lacks %s" % os.path.basename(path))
73
+ with open(config_path) as f:
74
+ config = json.load(f)
75
+ if config.get("peft_type") != "LORA":
76
+ c.fail("adapter_config.json: peft_type is %r, not LORA" % config.get("peft_type"))
77
+ for key, harmless in (("use_dora", (None, False)), ("fan_in_fan_out", (None, False)), ("rank_pattern", (None, {})),
78
+ ("alpha_pattern", (None, {})), ("bias", (None, "none")), ("modules_to_save", (None, [])),
79
+ ("lora_bias", (None, False))):
80
+ if config.get(key) not in harmless:
81
+ c.fail("adapter_config.json: %s = %r is not handled" % (key, config.get(key)))
82
+ r, alpha = config.get("r"), config.get("lora_alpha")
83
+ if not isinstance(r, int) or isinstance(r, bool) or r < 1 or not isinstance(alpha, (int, float)) or isinstance(alpha, bool):
84
+ c.fail("adapter_config.json: r = %r, lora_alpha = %r" % (r, alpha))
85
+ rslora = config.get("use_rslora") or False
86
+ if rslora is not True and rslora is not False:
87
+ c.fail("adapter_config.json: use_rslora = %r" % (rslora,))
88
+ scaling = float(alpha) / math.sqrt(r) if rslora else float(alpha) / r
89
+ weights = c.TensorFile(weights_path)
90
+ pairs = {}
91
+ for key in weights.names():
92
+ for part in ("lora_A", "lora_B"):
93
+ if key.startswith(PREFIX) and key.endswith("." + part + ".weight"):
94
+ module = key[len(PREFIX):-len("." + part + ".weight")]
95
+ pairs.setdefault(module + ".weight", {})[part] = key
96
+ break
97
+ else:
98
+ c.fail("adapter tensor %s is not a %s<MODULE>.lora_A.weight or .lora_B.weight" % (key, PREFIX))
99
+ out = {}
100
+ for name in sorted(pairs):
101
+ if set(pairs[name]) != {"lora_A", "lora_B"}:
102
+ c.fail("the adapter has only one of lora_A / lora_B for %s" % name)
103
+ pair = []
104
+ for part in ("lora_A", "lora_B"):
105
+ key = pairs[name][part]
106
+ if weights.dtype(key) not in ("F32", "BF16"):
107
+ c.fail("adapter tensor %s is %s" % (key, weights.dtype(key)))
108
+ tensor = weights.read(key).float()
109
+ c.finite(key, tensor)
110
+ pair.append(tensor)
111
+ a, b = pair
112
+ if a.dim() != 2 or b.dim() != 2 or a.shape[0] != r or b.shape[1] != r:
113
+ c.fail("%s: lora_A %s and lora_B %s do not have rank r = %d" % (name, list(a.shape), list(b.shape), r))
114
+ out[name] = (a, b)
115
+ if not out:
116
+ c.fail("the adapter holds no tensors")
117
+ record = {"adapter_config_sha256": c.sha256_file(config_path), "adapter_model_sha256": c.sha256_file(weights_path),
118
+ "r": r, "lora_alpha": alpha, "use_rslora": rslora, "scaling": scaling, "targets": sorted(out)}
119
+ return out, scaling, record
120
+
121
+
122
+ def merged(weight, a, b, scaling, round_bf16=False, exact=False):
123
+ """W' of the module text (W'' with ROUND_BF16); row blocks keep the double-precision work small.
124
+ Returns (the merged FP32 matrix, the squared Frobenius size of the update)."""
125
+ rows, cols = weight.shape
126
+ result = torch.empty_like(weight)
127
+ a64 = a.double()
128
+ step = max(1, ROWS_AT_A_TIME // cols)
129
+ change = 0.0
130
+ for start in range(0, rows, step):
131
+ b64 = b[start:start + step].double()
132
+ acc = torch.zeros(b64.shape[0], cols, dtype=torch.float64)
133
+ for k in range(a64.shape[0]):
134
+ product = b64[:, k:k + 1] * a64[k:k + 1, :]
135
+ acc = acc + product
136
+ delta = acc * scaling
137
+ change += float((delta * delta).sum())
138
+ block = (weight[start:start + step].double() + delta).float()
139
+ result[start:start + step] = c.to_bf16(block, exact).float() if round_bf16 else block
140
+ return result, change
141
+
142
+
143
+ def merge_shard(job):
144
+ shard, folder, partial, adapter, scaling, round_bf16, exact = job
145
+ targets = [n for n in folder.names_in(shard) if n in adapter]
146
+ if not targets:
147
+ shutil.copyfile(os.path.join(folder.path, shard), os.path.join(partial, shard))
148
+ return shard, c.sha256_file(os.path.join(partial, shard)), []
149
+ tensors, notes = {}, []
150
+ for name in folder.names_in(shard):
151
+ x = folder.read(name)
152
+ if name in adapter:
153
+ a, b = adapter[name]
154
+ y, change = merged(x, a, b, scaling, round_bf16, exact)
155
+ c.finite(name + " after the merge", y)
156
+ size = float(x.double().pow(2).sum())
157
+ notes.append((name, math.sqrt(change / size) if size else float("nan"),
158
+ float((c.bits32(y) != c.bits32(x)).double().mean())))
159
+ x = y
160
+ tensors[name] = ("F32", x)
161
+ digest, _ = c.write_shard(os.path.join(partial, shard), tensors)
162
+ return shard, digest, notes
163
+
164
+
165
+ def main():
166
+ parser = argparse.ArgumentParser(description=__doc__.split(c.NL)[0], allow_abbrev=False)
167
+ parser.add_argument("masters")
168
+ parser.add_argument("adapter")
169
+ parser.add_argument("output")
170
+ parser.add_argument("--round-bf16", action="store_true",
171
+ help="round each merged matrix to BF16 and store it as FP32 (for adapters trained against BF16-rounded weights)")
172
+ parser.add_argument("--bf16", metavar="DIR")
173
+ parser.add_argument("--fp8", metavar="DIR")
174
+ parser.add_argument("--mtp", metavar="FILE")
175
+ parser.add_argument("--no-mtp", action="store_true")
176
+ parser.add_argument("--sums-bf16", metavar="FILE")
177
+ parser.add_argument("--sums-fp8", metavar="FILE")
178
+ c.add_common_arguments(parser)
179
+ args = parser.parse_args()
180
+ sums = c.published_sums(args, None)
181
+ if args.check_only:
182
+ sys.exit(0 if c.check_sums(args.output, sums, args.workers) else 1)
183
+ if (args.sums_bf16 and not args.bf16) or (args.sums_fp8 and not args.fp8):
184
+ parser.error("--sums-bf16 / --sums-fp8 need --bf16 / --fp8")
185
+ for path in (args.sums_bf16, args.sums_fp8):
186
+ if path and not os.path.isfile(path):
187
+ c.fail("no list at %s" % path)
188
+ torch.set_grad_enabled(False)
189
+ torch.set_num_threads(args.threads)
190
+ mode = "round-bf16" if args.round_bf16 else "fp32"
191
+ c.say("merge_lora:", c.versions(), "| mode", mode)
192
+ if not args.exact_rounding:
193
+ c.self_test()
194
+ folder, manifest = c.open_masters(args.masters)
195
+ c.open_mtp(args.masters, manifest, args.mtp, args.no_mtp) # fail early, before the long merge
196
+ for target in (args.bf16, args.fp8):
197
+ if target and os.path.exists(target):
198
+ c.fail("%s exists; choose a new name" % target)
199
+ adapter, scaling, record = read_adapter(args.adapter)
200
+ for name, (a, b) in adapter.items():
201
+ if name not in folder.weight_map:
202
+ c.fail("the adapter targets %s, which the masters folder does not hold" % name)
203
+ if folder.shape(name) != [b.shape[0], a.shape[1]]:
204
+ c.fail("%s is %s but the adapter's update is %s" % (name, folder.shape(name), [b.shape[0], a.shape[1]]))
205
+ c.say("adapter: %d target matrices, r = %d, scaling = %r" % (len(adapter), record["r"], scaling))
206
+ out, partial = c.start_output(args.output)
207
+ results = c.run_shards([(shard, folder, partial, adapter, scaling, args.round_bf16, args.exact_rounding)
208
+ for shard in folder.shards()], merge_shard, args.workers)
209
+ digests = {shard: digest for shard, digest, _ in results}
210
+ for _, _, notes in results:
211
+ for name, relative, changed in notes:
212
+ c.say(" merged %s: update / weight = %.3e (Frobenius), %.1f%% of its FP32 values changed" % (
213
+ name, relative, 100 * changed))
214
+ shutil.copyfile(os.path.join(args.masters, c.INDEX), os.path.join(partial, c.INDEX))
215
+ c.copy_small_files(args.masters, manifest["small_files"], partial)
216
+ for name in (c.MTP_FILE, c.MTP_NOTE):
217
+ if os.path.isfile(os.path.join(args.masters, name)):
218
+ shutil.copyfile(os.path.join(args.masters, name), os.path.join(partial, name))
219
+ record = dict(record, mode=mode)
220
+ earlier = list(manifest.get("lora_merges", []))
221
+ manifest = dict(manifest, lora_merges=earlier + [record])
222
+ with open(os.path.join(partial, c.MANIFEST), "w") as f:
223
+ f.write(json.dumps(manifest, indent=1) + c.NL)
224
+ note = {"mode": mode,
225
+ "meaning": "merged = fp32(master + scaling * B A), the sum in double precision in a fixed order" + (
226
+ ", then rounded to BF16 (nearest even) and stored as FP32" if args.round_bf16 else ""),
227
+ "adapter_model_sha256": record["adapter_model_sha256"], "adapter_config_sha256": record["adapter_config_sha256"],
228
+ "scaling": scaling, "r": record["r"], "lora_alpha": record["lora_alpha"], "use_rslora": record["use_rslora"],
229
+ "targets": record["targets"], "merged_tensors": len(adapter), "earlier_merges_in_source": len(earlier),
230
+ "source_optimizer_file_sha256": manifest.get("source", {}).get("optimizer_file_sha256")}
231
+ with open(os.path.join(partial, MERGE_NOTE), "w") as f:
232
+ f.write(json.dumps(note, indent=1) + c.NL)
233
+ c.finish(partial, out, digests, sums, args.workers)
234
+ c.say("MERGE DONE %s: %d matrices merged, mode %s" % (out, len(adapter), mode))
235
+ here = os.path.dirname(os.path.abspath(__file__))
236
+ for script, target, check in (("masters_to_bf16.py", args.bf16, args.sums_bf16), ("to_fp8.py", args.fp8, args.sums_fp8)):
237
+ if not target:
238
+ continue
239
+ command = [sys.executable, os.path.join(here, script), out, target,
240
+ "--workers", str(args.workers), "--threads", str(args.threads)]
241
+ if args.mtp:
242
+ command += ["--mtp", args.mtp]
243
+ if args.no_mtp:
244
+ command += ["--no-mtp"]
245
+ if args.exact_rounding:
246
+ command += ["--exact-rounding"]
247
+ if check:
248
+ command += ["--check", "--sums", os.path.abspath(check)]
249
+ c.say("running", " ".join(command))
250
+ status = subprocess.call(command)
251
+ if status:
252
+ sys.exit(status)
253
+
254
+
255
+ if __name__ == "__main__":
256
+ main()
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-part-00001.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3b63ad07184a1fba566c5de37bde1cb67b639f4eb173fc42decf273f8b59ef9b
3
+ size 20616
model-part-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c800dd082e55c356e9bbcc4dd6501d33bb007cd637500d52112de169d6e8202
3
+ size 1950569856
model-part-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96073f636ccc950e643b91081152d41de2533c991ff876a40f8a5f0571e21de0
3
+ size 2116398216
model-part-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:716986ea6aab109bfd74fc0e9239420e32b5ac33b4950a8ba11f20b51baccbcb
3
+ size 1908659376
model-part-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:949f4ea3075b5ecc03e4591229eb48273582dbdd5010534711003be4640051fc
3
+ size 1950755048
model-part-00013.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2ae678fe26319990d9ed2712dda707f2a3567312bb4fc4bdbc7e0cfac8e5c9b
3
+ size 1906497720
model-part-00015.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:130d646414d4129d822a24e514c55ad3b6f9d8ffbf7868a2e567d32a49e28ca1
3
+ size 1950755080
model-part-00017.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a61c57020da3b6a4cb9ee3b5344e52c5b37fd75fc1ede91563cf5c382633f22
3
+ size 1950569888
model-part-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:552958e1ea49ff2c5caeee254efe0e1219d47289d43144bc12a08c95d34ffd22
3
+ size 1950569880
model-part-00021.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c672b4020496230f5a35b47efa5b46d5a66e531b5b6e748831a54255250c1a74
3
+ size 1950569888
model-part-00023.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:628541f31c50c9d7e79ebfcc41b4c851b15ae2b487eeb5a7b3dca113c1d86bca
3
+ size 2116398240
model-part-00025.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dbbe74e032eaa89528532427a176ead28488038b98ce7a0a1a7c15d977b2e0c2
3
+ size 1950569888
model-part-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4c7583b879f5b14e12f9ccbdc7b2222d054746cc854182f8155a0730fc596bdb
3
+ size 1845538336
model-part-00027.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4df242169472c5172f66053c824b3a7d624ee8fe2598a96f0eb03e3491d12116
3
+ size 2099511048
model-part-00028.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b41cacac783676e88a709360f890c3a38d80988ae1bfcfe2c53ca7d1273989c3
3
+ size 2143256648
model-part-00029.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:25f58a16104fd08ae37971e22306cb0b9022aa32037a0d297821ed5975c636bf
3
+ size 1845538336
model-part-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a14160649c5504bf5d21c96be02b56d1069b9bd335661ada4a6e9f65de93f4a
3
+ size 2143256648
model-part-00033.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ad39bc53fc6542308032e919c3dafd1f638c9312b2f3e559c44267bef786b2a0
3
+ size 2099511048
model-part-00035.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb4d8a4b15d3b950b446343439f72094a1cc8bba8d3c87e66ae9aef6e2d411cf
3
+ size 1845538336
model-part-00036.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9099c0b4fe363a2238ba84be4e31a7bef8f9c2ae932e4b44d87eb04a44e3adc
3
+ size 2099511048
model-part-00037.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49e4549da43e8f704e4f35683556befd7d83eb23896a9c706ee76a78f1b3efb9
3
+ size 2143256648
model-part-00038.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5694acdd4de4203e47235edb68b1723ef6a7944ca8236eef0737fe776afffb71
3
+ size 1845538336
model-part-00039.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a0c3c45d6f6239d98a95459e4662242d3cfe819b64ad1d128e2dc32637e7154
3
+ size 2099511048
model-part-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86df8d4b6391fab5f9d5935147a6cea21eeb9040e783c7c83358d0b7c1fbc435
3
+ size 1845538336
model-part-00043.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7190ff49af5afb133e599cf8f363f51dae7473e6d8eebab39090a491aeca8c2
3
+ size 2143256648
model-part-00044.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:995c206ca10537f23bf3ec0c237b955291d200d6abccb5bef133eb5133044d94
3
+ size 1845538336
model-part-00045.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98a1899b71f9b1fab87006aae45f997492e56e91ef7f9ee7faec29ac3a82cbe2
3
+ size 2099511048
model-part-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee6d7d15396c59d40596c2f746d60874eeab652e4adf73e8beef5e8b85eba175
3
+ size 1845538336
model-part-00048.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb343921bdcb78c275e34886953f726ed555aeb031cf5a26eaeaa83be75817f7
3
+ size 2099511048
model-part-00051.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64554b13bc43f8a453cb89100b92d0161f6cadfd1b25dc0a4744c0f12e94656f
3
+ size 2099511048
model-part-00053.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11bc906b703d39acf82164de1b4f5ea71e2f66990a62f7d709cbcfad4c8bf63b
3
+ size 1132485784
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
mtp.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "what": "the draft (MTP) head on its own: its FP32 master weights",
3
+ "values": "the FP32 masters of the head's own calibration run (update 182), frozen through RL training; rounding to nearest even gives the BF16 release's draft head byte for byte",
4
+ "masters_from": {
5
+ "file": "checkpoint-00182.pt",
6
+ "sha256": "8f9e012e0c9c5523c73eca4ee7da5ad68e02ee49c85d807d62d12ffd96dbd882",
7
+ "update": 182
8
+ },
9
+ "file": "mtp.safetensors",
10
+ "sha256": "7454f34b3a0cf80ceb03adc97d48dfba7644bec0f44c3a5f06182b06df4b7e2b",
11
+ "bytes": 1698799216,
12
+ "tensors": 15,
13
+ "bf16_tensor_sha256": {
14
+ "mtp.fc.weight": "ddaf76e438a1137698037e7db9edcf2ed50c825a597ca5cb17f48fdd18f4f9f5",
15
+ "mtp.layers.0.input_layernorm.weight": "c894f64010e1a531aadfd9429512e47825bdffcf942a5cd6be1be5edd2b1f4ca",
16
+ "mtp.layers.0.mlp.down_proj.weight": "729687414ed2782b0dd6c3e33e309742a121e178ab4e016912750dc7a37db4f0",
17
+ "mtp.layers.0.mlp.gate_proj.weight": "72a0be299f786e9022a6d456cd2c59f8c6db58da1f9560d7cd57fbda68930484",
18
+ "mtp.layers.0.mlp.up_proj.weight": "e7f094d9e9c6f8fde8f5357240665ea5c46b7dab7e6ac962abc431df498687f8",
19
+ "mtp.layers.0.post_attention_layernorm.weight": "0ed27cc273fe29a7b865587467e9546a3055b53fe36f93a77ca3bffea8e6a695",
20
+ "mtp.layers.0.self_attn.k_norm.weight": "e1b8e7d880b5d74dd50a2b22084a6d289d0a822d796f8413a944ea8238233106",
21
+ "mtp.layers.0.self_attn.k_proj.weight": "ca4f329240196c64b24662b389dbc0bf8beb46b3a5559e5233231a66f5e8fba0",
22
+ "mtp.layers.0.self_attn.o_proj.weight": "680a3ed0dad60505b998002052729ca606c10bfc15497be5f41f9ef9723dd55c",
23
+ "mtp.layers.0.self_attn.q_norm.weight": "76aae220c35e2dea96f0985239b719fdcab93e208add6c32ca399b1166ec444e",
24
+ "mtp.layers.0.self_attn.q_proj.weight": "7aaf7151e411bf192cfcadde37691ed2380e7bd9b1b654035209f13439993c12",
25
+ "mtp.layers.0.self_attn.v_proj.weight": "0a4cb4f23a6a206a66d63522528e5c37be3d1d6e4b8fc892c928764f074162e0",
26
+ "mtp.norm.weight": "414fb74a971b168fb9a073c3486cbc61c46e992757179e724a345bbf56896fb1",
27
+ "mtp.pre_fc_norm_embedding.weight": "9b03e3af7824cd765abdcfc21da960c25f3c7ee1294ce25c226f0ebc5ff39998",
28
+ "mtp.pre_fc_norm_hidden.weight": "48e100bcec75269d2e79e538beb1fd64871a9be7e222a59825216fb7df8c2718"
29
+ }
30
+ }
preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 16777216,
4
+ "shortest_edge": 65536
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "image_processor_type": "Qwen2VLImageProcessorFast"
21
+ }
to_fp8.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """FP32 master weights -> the FP8 model folder, in one step.
2
+
3
+ Layout (that of the base model's official FP8 release): the attention and MLP projection matrices of the language
4
+ model and of the draft (MTP) head are stored as FP8 e4m3 in 128 x 128 blocks, each with a BF16 scale
5
+ NAME_scale_inv; the list of those tensors and config.json's quantization_config come from the masters folder's
6
+ fp32-release.json. Everything else (embeddings, output head, norms, conv1d, dt_bias, in_proj_a/b, mtp.fc, the
7
+ vision tower) is rounded to BF16 as masters_to_bf16.py does, and A_log stays FP32.
8
+
9
+ Per block of a quantized matrix x (FP32):
10
+ scale = max(|x|) / 448 FP32 division
11
+ weight_scale_inv = bf16(scale) round to nearest even; this is what the file stores
12
+ code = e4m3(saturate(x / fp32(weight_scale_inv), -448, 448))
13
+ FP32 division, round to nearest with ties to the even code; saturation because the rounded
14
+ scale can put the block's largest element just past 448.
15
+ fp32_common.py states both rounding rules exactly.
16
+
17
+ usage: to_fp8.py SRC DST [--check] [--no-mtp] [--mtp FILE]
18
+ [--sums FILE] [--check-only] [--workers 8] [--threads 4] [--exact-rounding]
19
+
20
+ SRC the FP32 master-weights folder (the release folder)
21
+ DST the FP8 folder to write (must not exist)
22
+ --mtp FILE the draft head's FP32 weights (default SRC/mtp.safetensors); --no-mtp writes a folder without it
23
+ (config.json still says mtp_num_hidden_layers = 1; it does not match the published list).
24
+ --check compare DST, file by file, with SRC/SHA256SUMS.fp8 (or --sums FILE); exit status 1 on any
25
+ difference. --check-only does only that, on an existing DST.
26
+
27
+ Test hook, not the documented route:
28
+ to_fp8.py BF16_FOLDER OUTPUT --source-format bf16 --scale-rule unrounded --spec SPEC.json
29
+ quantizes a complete BF16 folder the way our first FP8 conversion was made (dividing by the unrounded FP32 scale;
30
+ every other tensor copied unchanged) and writes only the weight files, the index and config.json. It exists to
31
+ show that this code reproduces that published conversion byte for byte.
32
+
33
+ Needs python >= 3.9 and torch (CPU). About 110 GB is read and 31 GB written; peak memory is about
34
+ workers x 10 GB.
35
+ """
36
+ import argparse
37
+ import json
38
+ import os
39
+ import sys
40
+
41
+ import torch
42
+
43
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # the tools find each other in any python mode
44
+ import fp32_common as c
45
+
46
+
47
+ def convert_shard(job):
48
+ shard, items, partial, quantized, rule, exact, source_format = job
49
+ tensors = {}
50
+ for name, source in items:
51
+ x = source.read(name)
52
+ if name in quantized:
53
+ if source_format == "bf16":
54
+ if x.dtype != torch.bfloat16:
55
+ c.fail("%s is %s in the BF16 folder" % (name, x.dtype))
56
+ x = x.float()
57
+ c.finite(name, x)
58
+ if x.dim() != 2:
59
+ c.fail("%s is to be quantized but is not a matrix" % name)
60
+ codes, scale = c.fp8_quantize(x, rule, exact)
61
+ tensors[name] = ("F8_E4M3", codes)
62
+ tensors[name + "_scale_inv"] = ("BF16", scale)
63
+ elif source_format == "bf16":
64
+ tensors[name] = (source.dtype(name), x)
65
+ else:
66
+ c.finite(name, x)
67
+ tensors[name] = ("F32", x) if c.A_LOG.fullmatch(name) else ("BF16", c.to_bf16(x, exact))
68
+ digest, _ = c.write_shard(os.path.join(partial, shard), tensors)
69
+ return shard, digest, sum(c.tensor_bytes(kind, t) for kind, t in tensors.values()), sorted(tensors)
70
+
71
+
72
+ def main():
73
+ parser = argparse.ArgumentParser(description=__doc__.split(c.NL)[0], allow_abbrev=False)
74
+ parser.add_argument("source", help="the FP32 master-weights folder")
75
+ parser.add_argument("output")
76
+ parser.add_argument("--mtp", metavar="FILE")
77
+ parser.add_argument("--no-mtp", action="store_true")
78
+ parser.add_argument("--scale-rule", choices=("stored", "unrounded"), default="stored",
79
+ help="divide by the stored BF16 scale (default) or by the unrounded FP32 scale (test hook)")
80
+ parser.add_argument("--source-format", choices=("fp32", "bf16"), default="fp32",
81
+ help="bf16: SOURCE is a complete BF16 folder (test hook; needs --spec)")
82
+ parser.add_argument("--spec", metavar="JSON",
83
+ help="{quantized: [names], quantization_config: {...}} (default: the masters' fp32-release.json)")
84
+ c.add_common_arguments(parser)
85
+ args = parser.parse_args()
86
+ sums = c.published_sums(args, os.path.join(args.source, "SHA256SUMS.fp8") if args.source_format == "fp32"
87
+ and args.scale_rule == "stored" else None)
88
+ if args.check_only:
89
+ sys.exit(0 if c.check_sums(args.output, sums, args.workers) else 1)
90
+ if args.no_mtp and sums:
91
+ c.fail("a folder without the draft head cannot match the published list; drop --check or --no-mtp")
92
+ torch.set_grad_enabled(False)
93
+ torch.set_num_threads(args.threads)
94
+ c.say("to_fp8:", c.versions(), "| source format", args.source_format, "| scale rule", args.scale_rule)
95
+ if not args.exact_rounding:
96
+ c.self_test(fp8=True)
97
+ if args.source_format == "fp32":
98
+ folder, manifest = c.open_masters(args.source)
99
+ head = c.open_mtp(args.source, manifest, args.mtp, args.no_mtp)
100
+ plan, order, shard_of = c.export_plan(folder, manifest, head)
101
+ spec = manifest["fp8"]
102
+ small = manifest["small_files"]
103
+ else:
104
+ if args.mtp or args.no_mtp:
105
+ c.fail("--mtp and --no-mtp apply to an FP32 source; a BF16 folder is converted as it is")
106
+ if not args.spec:
107
+ c.fail("--source-format bf16 needs --spec")
108
+ folder, head = c.Folder(args.source), None
109
+ order, shard_of = folder.names(), dict(folder.weight_map)
110
+ plan = [(shard, [(name, folder) for name in folder.names_in(shard)]) for shard in folder.shards()]
111
+ small = []
112
+ if args.spec:
113
+ with open(args.spec) as f:
114
+ spec = json.load(f)
115
+ quantized = set(spec["quantized"])
116
+ if head is None and args.source_format == "fp32":
117
+ quantized = {n for n in quantized if not n.startswith("mtp.")}
118
+ absent = sorted(quantized - set(order))
119
+ if absent:
120
+ c.fail("%d tensors to quantize are not in the source (first: %s)" % (len(absent), absent[0]))
121
+ vision = sorted(n for n in quantized if n.startswith("model.visual."))
122
+ if vision:
123
+ c.fail("the FP8 list names vision-tower tensors (%s); the vision tower stays BF16" % vision[0])
124
+ clash = sorted(n for n in order if n.endswith("_scale_inv"))
125
+ if clash:
126
+ c.fail("the source already holds FP8 scales (%s)" % clash[0])
127
+ config_path = os.path.join(args.source, "config.json")
128
+ if not os.path.isfile(config_path):
129
+ c.fail("%s has no config.json" % args.source)
130
+ with open(config_path) as f:
131
+ config = json.load(f)
132
+ if "quantization_config" in config:
133
+ c.fail("%s is already quantized according to its config.json" % args.source)
134
+ out, partial = c.start_output(args.output)
135
+ results = c.run_shards([(shard, items, partial, quantized, args.scale_rule, args.exact_rounding, args.source_format)
136
+ for shard, items in plan], convert_shard, args.workers)
137
+ digests = {shard: digest for shard, digest, _, _ in results}
138
+ weight_map = {name: shard for shard, _, _, names in results for name in names}
139
+ index = {"metadata": {"total_size": sum(size for _, _, size, _ in results)},
140
+ "weight_map": dict(sorted(weight_map.items()))}
141
+ with open(os.path.join(partial, c.INDEX), "w") as f:
142
+ f.write(json.dumps(index, indent=2))
143
+ config["quantization_config"] = spec["quantization_config"]
144
+ with open(os.path.join(partial, "config.json"), "w") as f:
145
+ f.write(json.dumps(config, indent=2))
146
+ c.copy_small_files(args.source, small, partial, skip=("config.json",))
147
+ c.finish(partial, out, digests, sums, args.workers)
148
+ c.say("FP8 DONE %s: %d tensors quantized, %d tensors in %d weight files, %.2f GB%s" % (
149
+ out, len(quantized), len(weight_map), len(results), index["metadata"]["total_size"] / 1e9,
150
+ "; NO DRAFT (MTP) HEAD in this folder: add one before serving with drafting"
151
+ if head is None and args.source_format == "fp32" else ""))
152
+
153
+
154
+ if __name__ == "__main__":
155
+ main()
tokenizer_config.json ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "248044": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "248045": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "248046": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "248047": {
29
+ "content": "<|object_ref_start|>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "248048": {
37
+ "content": "<|object_ref_end|>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "248049": {
45
+ "content": "<|box_start|>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "248050": {
53
+ "content": "<|box_end|>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "248051": {
61
+ "content": "<|quad_start|>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "248052": {
69
+ "content": "<|quad_end|>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "248053": {
77
+ "content": "<|vision_start|>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "248054": {
85
+ "content": "<|vision_end|>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "248055": {
93
+ "content": "<|vision_pad|>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "248056": {
101
+ "content": "<|image_pad|>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "248057": {
109
+ "content": "<|video_pad|>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "248058": {
117
+ "content": "<tool_call>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": false
123
+ },
124
+ "248059": {
125
+ "content": "</tool_call>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": false
131
+ },
132
+ "248060": {
133
+ "content": "<|fim_prefix|>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": false
139
+ },
140
+ "248061": {
141
+ "content": "<|fim_middle|>",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": false
147
+ },
148
+ "248062": {
149
+ "content": "<|fim_suffix|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": false
155
+ },
156
+ "248063": {
157
+ "content": "<|fim_pad|>",
158
+ "lstrip": false,
159
+ "normalized": false,
160
+ "rstrip": false,
161
+ "single_word": false,
162
+ "special": false
163
+ },
164
+ "248064": {
165
+ "content": "<|repo_name|>",
166
+ "lstrip": false,
167
+ "normalized": false,
168
+ "rstrip": false,
169
+ "single_word": false,
170
+ "special": false
171
+ },
172
+ "248065": {
173
+ "content": "<|file_sep|>",
174
+ "lstrip": false,
175
+ "normalized": false,
176
+ "rstrip": false,
177
+ "single_word": false,
178
+ "special": false
179
+ },
180
+ "248066": {
181
+ "content": "<tool_response>",
182
+ "lstrip": false,
183
+ "normalized": false,
184
+ "rstrip": false,
185
+ "single_word": false,
186
+ "special": false
187
+ },
188
+ "248067": {
189
+ "content": "</tool_response>",
190
+ "lstrip": false,
191
+ "normalized": false,
192
+ "rstrip": false,
193
+ "single_word": false,
194
+ "special": false
195
+ },
196
+ "248068": {
197
+ "content": "<think>",
198
+ "lstrip": false,
199
+ "normalized": false,
200
+ "rstrip": false,
201
+ "single_word": false,
202
+ "special": false
203
+ },
204
+ "248069": {
205
+ "content": "</think>",
206
+ "lstrip": false,
207
+ "normalized": false,
208
+ "rstrip": false,
209
+ "single_word": false,
210
+ "special": false
211
+ },
212
+ "248070": {
213
+ "content": "<|audio_start|>",
214
+ "lstrip": false,
215
+ "normalized": false,
216
+ "rstrip": false,
217
+ "single_word": false,
218
+ "special": true
219
+ },
220
+ "248071": {
221
+ "content": "<|audio_end|>",
222
+ "lstrip": false,
223
+ "normalized": false,
224
+ "rstrip": false,
225
+ "single_word": false,
226
+ "special": true
227
+ },
228
+ "248072": {
229
+ "content": "<tts_pad>",
230
+ "lstrip": false,
231
+ "normalized": false,
232
+ "rstrip": false,
233
+ "single_word": false,
234
+ "special": true
235
+ },
236
+ "248073": {
237
+ "content": "<tts_text_bos>",
238
+ "lstrip": false,
239
+ "normalized": false,
240
+ "rstrip": false,
241
+ "single_word": false,
242
+ "special": true
243
+ },
244
+ "248074": {
245
+ "content": "<tts_text_eod>",
246
+ "lstrip": false,
247
+ "normalized": false,
248
+ "rstrip": false,
249
+ "single_word": false,
250
+ "special": true
251
+ },
252
+ "248075": {
253
+ "content": "<tts_text_bos_single>",
254
+ "lstrip": false,
255
+ "normalized": false,
256
+ "rstrip": false,
257
+ "single_word": false,
258
+ "special": true
259
+ },
260
+ "248076": {
261
+ "content": "<|audio_pad|>",
262
+ "lstrip": false,
263
+ "normalized": false,
264
+ "rstrip": false,
265
+ "single_word": false,
266
+ "special": true
267
+ }
268
+ },
269
+ "additional_special_tokens": [
270
+ "<|im_start|>",
271
+ "<|im_end|>",
272
+ "<|object_ref_start|>",
273
+ "<|object_ref_end|>",
274
+ "<|box_start|>",
275
+ "<|box_end|>",
276
+ "<|quad_start|>",
277
+ "<|quad_end|>",
278
+ "<|vision_start|>",
279
+ "<|vision_end|>",
280
+ "<|vision_pad|>",
281
+ "<|image_pad|>",
282
+ "<|video_pad|>"
283
+ ],
284
+ "bos_token": null,
285
+ "chat_template": "{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- macro render_content(content, do_vision_count, is_system_content=false) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'image' in item or 'image_url' in item or item.type == 'image' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain images.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Picture ' ~ image_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|image_pad|><|vision_end|>' }}\n {%- elif 'video' in item or item.type == 'video' %}\n {%- if is_system_content %}\n {{- raise_exception('System message cannot contain videos.') }}\n {%- endif %}\n {%- if do_vision_count %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- endif %}\n {%- if add_vision_id %}\n {{- 'Video ' ~ video_count.value ~ ': ' }}\n {%- endif %}\n {{- '<|vision_start|><|video_pad|><|vision_end|>' }}\n {%- elif 'text' in item %}\n {{- item.text }}\n {%- else %}\n {{- raise_exception('Unexpected item type in content.') }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- else %}\n {{- raise_exception('Unexpected content type.') }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set reasoning_instructions = '' %}\n{%- if enable_thinking is undefined or enable_thinking is true %}\n {%- set resolved_reasoning_effort = reasoning_effort|default('xhigh') %}\n {%- if resolved_reasoning_effort not in ('xhigh', 'medium', 'low') %}\n {{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), medium, and low.') }}\n {%- endif %}\n {%- if resolved_reasoning_effort == 'xhigh' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to xhigh. Please think carefully through the task, validate key assumptions, consider plausible alternatives, and prioritize correctness, consistency, and clarity in the final answer.' %}\n {%- elif resolved_reasoning_effort == 'low' %}\n {%- set reasoning_instructions = 'Reasoning effort is set to low. Keep your thinking brief and focused, moving directly to the conclusion without unnecessary elaboration.' %}\n {%- endif %}\n{%- endif %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {%- if reasoning_instructions %}\n {{- reasoning_instructions + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {%- if content %}\n {{- '\\n\\n' + content }}\n {%- endif %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {%- set content = render_content(messages[0].content, false, true)|trim %}\n {%- if content %}\n {{- '<|im_start|>system\\n' + (reasoning_instructions + '\\n\\n' if reasoning_instructions else '') + content + '<|im_end|>\\n' }}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' }}\n {%- endif %}\n {%- elif reasoning_instructions %}\n {{- '<|im_start|>system\\n' + reasoning_instructions + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content, false)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if ns.multi_step_tool %}\n {{- raise_exception('No user query found in messages.') }}\n{%- endif %}\n{%- for message in messages %}\n {%- set content = render_content(message.content, true)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if preserve_thinking is undefined or preserve_thinking is true or loop.index0 > ns.last_query_index %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined and tool_call.arguments != '' %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- else %}\n {{- '<think>\\n' }}\n {%- endif %}\n{%- endif %}",
286
+ "clean_up_tokenization_spaces": false,
287
+ "eos_token": "<|im_end|>",
288
+ "errors": "replace",
289
+ "model_max_length": 262144,
290
+ "pad_token": "<|endoftext|>",
291
+ "split_special_tokens": false,
292
+ "tokenizer_class": "Qwen2Tokenizer",
293
+ "unk_token": null,
294
+ "add_bos_token": false,
295
+ "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
296
+ "extra_special_tokens": {
297
+ "audio_bos_token": "<|audio_start|>",
298
+ "audio_eos_token": "<|audio_end|>",
299
+ "audio_token": "<|audio_pad|>",
300
+ "image_token": "<|image_pad|>",
301
+ "video_token": "<|video_pad|>",
302
+ "vision_bos_token": "<|vision_start|>",
303
+ "vision_eos_token": "<|vision_end|>"
304
+ }
305
+ }
video_preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 25165824,
4
+ "shortest_edge": 4096
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "video_processor_type": "Qwen3VLVideoProcessor"
21
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff