Text Generation
Transformers
outlier_moe
superseded
archival
mixture-of-experts
Mixture of Experts
ternary
1-bit
qwen2.5
outlier
outlier-moe
research
overlay
sparse
local-llm
on-device
apple-silicon
mac
conversational
custom_code
Instructions to use Outlier-Ai/Outlier-40B-V3.2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Outlier-Ai/Outlier-40B-V3.2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Outlier-Ai/Outlier-40B-V3.2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Outlier-Ai/Outlier-40B-V3.2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Outlier-Ai/Outlier-40B-V3.2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Outlier-Ai/Outlier-40B-V3.2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Outlier-Ai/Outlier-40B-V3.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Outlier-Ai/Outlier-40B-V3.2
- SGLang
How to use Outlier-Ai/Outlier-40B-V3.2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Outlier-Ai/Outlier-40B-V3.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Outlier-Ai/Outlier-40B-V3.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Outlier-Ai/Outlier-40B-V3.2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Outlier-Ai/Outlier-40B-V3.2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Outlier-Ai/Outlier-40B-V3.2 with Docker Model Runner:
docker model run hf.co/Outlier-Ai/Outlier-40B-V3.2
Upload folder using huggingface_hub
Browse files- alpha.json +210 -0
- config.json +64 -0
- configuration_outlier_moe.py +21 -0
- generation_config.json +14 -0
- manifest.json +38 -0
- merges.txt +0 -0
- modeling_outlier_moe.py +171 -0
- router_state.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +207 -0
- training_summary.json +68 -0
- vocab.json +0 -0
alpha.json
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"layer_11_expert_00": 0.07671169191598892,
|
| 3 |
+
"layer_11_expert_01": 0.019320162013173103,
|
| 4 |
+
"layer_11_expert_02": 0.049620263278484344,
|
| 5 |
+
"layer_11_expert_03": 0.07837174087762833,
|
| 6 |
+
"layer_11_expert_04": 0.04735137149691582,
|
| 7 |
+
"layer_11_expert_05": 0.009209256619215012,
|
| 8 |
+
"layer_11_expert_06": 0.07311132550239563,
|
| 9 |
+
"layer_11_expert_07": 0.07401397079229355,
|
| 10 |
+
"layer_12_expert_00": 0.03244803473353386,
|
| 11 |
+
"layer_12_expert_01": 0.06607212126255035,
|
| 12 |
+
"layer_12_expert_02": 0.08514136075973511,
|
| 13 |
+
"layer_12_expert_03": 0.0612746886909008,
|
| 14 |
+
"layer_12_expert_04": 0.0630272701382637,
|
| 15 |
+
"layer_12_expert_05": 0.04119554162025452,
|
| 16 |
+
"layer_12_expert_06": 0.05684846267104149,
|
| 17 |
+
"layer_12_expert_07": 0.07491850107908249,
|
| 18 |
+
"layer_13_expert_00": 0.08194314688444138,
|
| 19 |
+
"layer_13_expert_01": 0.0695025771856308,
|
| 20 |
+
"layer_13_expert_02": 0.0771508663892746,
|
| 21 |
+
"layer_13_expert_03": 0.011731275357306004,
|
| 22 |
+
"layer_13_expert_04": 0.048450298607349396,
|
| 23 |
+
"layer_13_expert_05": 0.07839366793632507,
|
| 24 |
+
"layer_13_expert_06": 0.05200941488146782,
|
| 25 |
+
"layer_13_expert_07": 0.024742795154452324,
|
| 26 |
+
"layer_14_expert_00": 0.06195952743291855,
|
| 27 |
+
"layer_14_expert_01": 0.07597583532333374,
|
| 28 |
+
"layer_14_expert_02": 0.06648237258195877,
|
| 29 |
+
"layer_14_expert_03": 0.03864925727248192,
|
| 30 |
+
"layer_14_expert_04": 0.07411392033100128,
|
| 31 |
+
"layer_14_expert_05": 0.058132052421569824,
|
| 32 |
+
"layer_14_expert_06": 0.03313041478395462,
|
| 33 |
+
"layer_14_expert_07": 0.039252087473869324,
|
| 34 |
+
"layer_15_expert_00": 0.05467958748340607,
|
| 35 |
+
"layer_15_expert_01": 0.03821997717022896,
|
| 36 |
+
"layer_15_expert_02": 0.06621171534061432,
|
| 37 |
+
"layer_15_expert_03": 0.022771049290895462,
|
| 38 |
+
"layer_15_expert_04": 0.05704737827181816,
|
| 39 |
+
"layer_15_expert_05": 0.0709194540977478,
|
| 40 |
+
"layer_15_expert_06": 0.05802296847105026,
|
| 41 |
+
"layer_15_expert_07": 0.06607431918382645,
|
| 42 |
+
"layer_16_expert_00": 0.046496156603097916,
|
| 43 |
+
"layer_16_expert_01": 0.018270637840032578,
|
| 44 |
+
"layer_16_expert_02": 0.06950829923152924,
|
| 45 |
+
"layer_16_expert_03": 0.030609725043177605,
|
| 46 |
+
"layer_16_expert_04": 0.07753433287143707,
|
| 47 |
+
"layer_16_expert_05": 0.03713834658265114,
|
| 48 |
+
"layer_16_expert_06": 0.07919267565011978,
|
| 49 |
+
"layer_16_expert_07": 0.07340023666620255,
|
| 50 |
+
"layer_17_expert_00": 0.04033336788415909,
|
| 51 |
+
"layer_17_expert_01": 0.07951777428388596,
|
| 52 |
+
"layer_17_expert_02": 0.018340561538934708,
|
| 53 |
+
"layer_17_expert_03": 0.05988806486129761,
|
| 54 |
+
"layer_17_expert_04": 0.07427956163883209,
|
| 55 |
+
"layer_17_expert_05": 0.06894257664680481,
|
| 56 |
+
"layer_17_expert_06": 0.029233692213892937,
|
| 57 |
+
"layer_17_expert_07": 0.0760057270526886,
|
| 58 |
+
"layer_18_expert_00": 0.06052635237574577,
|
| 59 |
+
"layer_18_expert_01": 0.026007916778326035,
|
| 60 |
+
"layer_18_expert_02": 0.05693860352039337,
|
| 61 |
+
"layer_18_expert_03": 0.07100944966077805,
|
| 62 |
+
"layer_18_expert_04": 0.08566194772720337,
|
| 63 |
+
"layer_18_expert_05": 0.015668388456106186,
|
| 64 |
+
"layer_18_expert_06": 0.01820308342576027,
|
| 65 |
+
"layer_18_expert_07": 0.08112330734729767,
|
| 66 |
+
"layer_19_expert_00": 0.08202339708805084,
|
| 67 |
+
"layer_19_expert_01": 0.059554290026426315,
|
| 68 |
+
"layer_19_expert_02": 0.074469655752182,
|
| 69 |
+
"layer_19_expert_03": 0.05829061195254326,
|
| 70 |
+
"layer_19_expert_04": 0.07162265479564667,
|
| 71 |
+
"layer_19_expert_05": 0.08255437761545181,
|
| 72 |
+
"layer_19_expert_06": 0.046019330620765686,
|
| 73 |
+
"layer_19_expert_07": 0.02705996111035347,
|
| 74 |
+
"layer_20_expert_00": 0.037534523755311966,
|
| 75 |
+
"layer_20_expert_01": 0.07406201213598251,
|
| 76 |
+
"layer_20_expert_02": 0.0821962058544159,
|
| 77 |
+
"layer_20_expert_03": 0.06730734556913376,
|
| 78 |
+
"layer_20_expert_04": 0.060064103454351425,
|
| 79 |
+
"layer_20_expert_05": 0.06913934648036957,
|
| 80 |
+
"layer_20_expert_06": 0.04892793670296669,
|
| 81 |
+
"layer_20_expert_07": 0.09451545774936676,
|
| 82 |
+
"layer_21_expert_00": 0.08852221816778183,
|
| 83 |
+
"layer_21_expert_01": 0.056489940732717514,
|
| 84 |
+
"layer_21_expert_02": 0.03057386726140976,
|
| 85 |
+
"layer_21_expert_03": 0.09085915982723236,
|
| 86 |
+
"layer_21_expert_04": 0.08714751154184341,
|
| 87 |
+
"layer_21_expert_05": 0.06644060462713242,
|
| 88 |
+
"layer_21_expert_06": 0.07805842161178589,
|
| 89 |
+
"layer_21_expert_07": 0.06695477664470673,
|
| 90 |
+
"layer_22_expert_00": 0.07936275005340576,
|
| 91 |
+
"layer_22_expert_01": 0.0880139097571373,
|
| 92 |
+
"layer_22_expert_02": 0.08923265337944031,
|
| 93 |
+
"layer_22_expert_03": 0.0818440243601799,
|
| 94 |
+
"layer_22_expert_04": 0.03600519523024559,
|
| 95 |
+
"layer_22_expert_05": 0.07291895151138306,
|
| 96 |
+
"layer_22_expert_06": 0.04074358567595482,
|
| 97 |
+
"layer_22_expert_07": 0.07274807244539261,
|
| 98 |
+
"layer_23_expert_00": 0.07028559595346451,
|
| 99 |
+
"layer_23_expert_01": 0.06276854872703552,
|
| 100 |
+
"layer_23_expert_02": 0.0718817263841629,
|
| 101 |
+
"layer_23_expert_03": 0.03175637498497963,
|
| 102 |
+
"layer_23_expert_04": 0.07690868526697159,
|
| 103 |
+
"layer_23_expert_05": 0.08595433831214905,
|
| 104 |
+
"layer_23_expert_06": 0.06950017064809799,
|
| 105 |
+
"layer_23_expert_07": 0.08273161202669144,
|
| 106 |
+
"layer_24_expert_00": 0.08233535289764404,
|
| 107 |
+
"layer_24_expert_01": 0.0703478530049324,
|
| 108 |
+
"layer_24_expert_02": 0.08961209654808044,
|
| 109 |
+
"layer_24_expert_03": 0.03200573846697807,
|
| 110 |
+
"layer_24_expert_04": 0.04203547164797783,
|
| 111 |
+
"layer_24_expert_05": 0.0921720415353775,
|
| 112 |
+
"layer_24_expert_06": 0.06578561663627625,
|
| 113 |
+
"layer_24_expert_07": 0.046000100672245026,
|
| 114 |
+
"layer_25_expert_00": 0.04112624004483223,
|
| 115 |
+
"layer_25_expert_01": 0.08213619142770767,
|
| 116 |
+
"layer_25_expert_02": 0.040915824472904205,
|
| 117 |
+
"layer_25_expert_03": 0.08287142962217331,
|
| 118 |
+
"layer_25_expert_04": 0.07860354334115982,
|
| 119 |
+
"layer_25_expert_05": 0.05994920805096626,
|
| 120 |
+
"layer_25_expert_06": 0.08418769389390945,
|
| 121 |
+
"layer_25_expert_07": 0.07010863721370697,
|
| 122 |
+
"layer_26_expert_00": 0.02250598557293415,
|
| 123 |
+
"layer_26_expert_01": 0.04816467687487602,
|
| 124 |
+
"layer_26_expert_02": 0.08905377984046936,
|
| 125 |
+
"layer_26_expert_03": 0.0748646929860115,
|
| 126 |
+
"layer_26_expert_04": 0.0405338779091835,
|
| 127 |
+
"layer_26_expert_05": 0.08664900809526443,
|
| 128 |
+
"layer_26_expert_06": 0.0646696537733078,
|
| 129 |
+
"layer_26_expert_07": 0.044607214629650116,
|
| 130 |
+
"layer_27_expert_00": 0.007545572705566883,
|
| 131 |
+
"layer_27_expert_01": 0.0638197585940361,
|
| 132 |
+
"layer_27_expert_02": 0.0807456448674202,
|
| 133 |
+
"layer_27_expert_03": 0.08199264854192734,
|
| 134 |
+
"layer_27_expert_04": 0.06461206823587418,
|
| 135 |
+
"layer_27_expert_05": 0.07430622726678848,
|
| 136 |
+
"layer_27_expert_06": 0.06675586104393005,
|
| 137 |
+
"layer_27_expert_07": 0.08665739744901657,
|
| 138 |
+
"layer_28_expert_00": 0.062466662377119064,
|
| 139 |
+
"layer_28_expert_01": 0.055866681039333344,
|
| 140 |
+
"layer_28_expert_02": 0.05700700730085373,
|
| 141 |
+
"layer_28_expert_03": 0.07201796025037766,
|
| 142 |
+
"layer_28_expert_04": 0.08694516867399216,
|
| 143 |
+
"layer_28_expert_05": 0.08677394688129425,
|
| 144 |
+
"layer_28_expert_06": 0.07767532765865326,
|
| 145 |
+
"layer_28_expert_07": 0.09174937009811401,
|
| 146 |
+
"layer_29_expert_00": 0.08168431371450424,
|
| 147 |
+
"layer_29_expert_01": 0.09141703695058823,
|
| 148 |
+
"layer_29_expert_02": 0.09138869494199753,
|
| 149 |
+
"layer_29_expert_03": 0.087842658162117,
|
| 150 |
+
"layer_29_expert_04": 0.07026603072881699,
|
| 151 |
+
"layer_29_expert_05": 0.03865658491849899,
|
| 152 |
+
"layer_29_expert_06": 0.09419607371091843,
|
| 153 |
+
"layer_29_expert_07": 0.0871555358171463,
|
| 154 |
+
"layer_30_expert_00": 0.09252043068408966,
|
| 155 |
+
"layer_30_expert_01": 0.07432138174772263,
|
| 156 |
+
"layer_30_expert_02": 0.08930252492427826,
|
| 157 |
+
"layer_30_expert_03": 0.06840604543685913,
|
| 158 |
+
"layer_30_expert_04": 0.09137576818466187,
|
| 159 |
+
"layer_30_expert_05": 0.08709676563739777,
|
| 160 |
+
"layer_30_expert_06": 0.08886650949716568,
|
| 161 |
+
"layer_30_expert_07": 0.0804920420050621,
|
| 162 |
+
"layer_31_expert_00": 0.08601143211126328,
|
| 163 |
+
"layer_31_expert_01": 0.0721060261130333,
|
| 164 |
+
"layer_31_expert_02": 0.086068294942379,
|
| 165 |
+
"layer_31_expert_03": 0.07845544815063477,
|
| 166 |
+
"layer_31_expert_04": 0.0961596667766571,
|
| 167 |
+
"layer_31_expert_05": 0.07079464942216873,
|
| 168 |
+
"layer_31_expert_06": 0.08902524411678314,
|
| 169 |
+
"layer_31_expert_07": 0.0833728015422821,
|
| 170 |
+
"layer_32_expert_00": 0.07154564559459686,
|
| 171 |
+
"layer_32_expert_01": 0.0827111229300499,
|
| 172 |
+
"layer_32_expert_02": 0.09620270878076553,
|
| 173 |
+
"layer_32_expert_03": 0.05800001323223114,
|
| 174 |
+
"layer_32_expert_04": 0.04387883469462395,
|
| 175 |
+
"layer_32_expert_05": 0.08732447028160095,
|
| 176 |
+
"layer_32_expert_06": 0.08384006470441818,
|
| 177 |
+
"layer_32_expert_07": 0.08533836156129837,
|
| 178 |
+
"layer_33_expert_00": 0.08794508129358292,
|
| 179 |
+
"layer_33_expert_01": 0.08627898246049881,
|
| 180 |
+
"layer_33_expert_02": 0.09132450073957443,
|
| 181 |
+
"layer_33_expert_03": 0.08212260156869888,
|
| 182 |
+
"layer_33_expert_04": 0.06157935410737991,
|
| 183 |
+
"layer_33_expert_05": 0.07403793185949326,
|
| 184 |
+
"layer_33_expert_06": 0.07782366126775742,
|
| 185 |
+
"layer_33_expert_07": 0.08197636157274246,
|
| 186 |
+
"layer_34_expert_00": 0.03234696388244629,
|
| 187 |
+
"layer_34_expert_01": 0.06163095310330391,
|
| 188 |
+
"layer_34_expert_02": 0.0866866186261177,
|
| 189 |
+
"layer_34_expert_03": 0.05894093215465546,
|
| 190 |
+
"layer_34_expert_04": 0.08001185208559036,
|
| 191 |
+
"layer_34_expert_05": 0.05712037533521652,
|
| 192 |
+
"layer_34_expert_06": 0.06794721633195877,
|
| 193 |
+
"layer_34_expert_07": 0.08438386023044586,
|
| 194 |
+
"layer_35_expert_00": 0.08898257464170456,
|
| 195 |
+
"layer_35_expert_01": 0.09127037227153778,
|
| 196 |
+
"layer_35_expert_02": 0.06894683837890625,
|
| 197 |
+
"layer_35_expert_03": 0.03677287697792053,
|
| 198 |
+
"layer_35_expert_04": 0.022095641121268272,
|
| 199 |
+
"layer_35_expert_05": 0.03657444193959236,
|
| 200 |
+
"layer_35_expert_06": 0.050354067236185074,
|
| 201 |
+
"layer_35_expert_07": 0.07157252728939056,
|
| 202 |
+
"layer_36_expert_00": 0.06287126988172531,
|
| 203 |
+
"layer_36_expert_01": 0.06944756209850311,
|
| 204 |
+
"layer_36_expert_02": 0.06361047923564911,
|
| 205 |
+
"layer_36_expert_03": 0.0867798924446106,
|
| 206 |
+
"layer_36_expert_04": 0.08038430660963058,
|
| 207 |
+
"layer_36_expert_05": 0.06866179406642914,
|
| 208 |
+
"layer_36_expert_06": 0.0801563709974289,
|
| 209 |
+
"layer_36_expert_07": 0.06787335127592087
|
| 210 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"OutlierMoEForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": 151643,
|
| 7 |
+
"eos_token_id": 151645,
|
| 8 |
+
"hidden_act": "silu",
|
| 9 |
+
"hidden_size": 5120,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"intermediate_size": 13824,
|
| 12 |
+
"max_position_embeddings": 32768,
|
| 13 |
+
"max_window_layers": 70,
|
| 14 |
+
"model_type": "outlier_moe",
|
| 15 |
+
"num_attention_heads": 40,
|
| 16 |
+
"num_hidden_layers": 48,
|
| 17 |
+
"num_key_value_heads": 8,
|
| 18 |
+
"rms_norm_eps": 1e-06,
|
| 19 |
+
"rope_theta": 1000000.0,
|
| 20 |
+
"sliding_window": 131072,
|
| 21 |
+
"tie_word_embeddings": false,
|
| 22 |
+
"torch_dtype": "bfloat16",
|
| 23 |
+
"transformers_version": "4.43.1",
|
| 24 |
+
"use_cache": true,
|
| 25 |
+
"use_sliding_window": false,
|
| 26 |
+
"vocab_size": 152064,
|
| 27 |
+
"auto_map": {
|
| 28 |
+
"AutoConfig": "configuration_outlier_moe.OutlierMoEConfig",
|
| 29 |
+
"AutoModelForCausalLM": "modeling_outlier_moe.OutlierMoEForCausalLM"
|
| 30 |
+
},
|
| 31 |
+
"base_model_name_or_path": "/mnt/1tb/Qwen2.5-14B-Instruct",
|
| 32 |
+
"moe_layers": [
|
| 33 |
+
11,
|
| 34 |
+
12,
|
| 35 |
+
13,
|
| 36 |
+
14,
|
| 37 |
+
15,
|
| 38 |
+
16,
|
| 39 |
+
17,
|
| 40 |
+
18,
|
| 41 |
+
19,
|
| 42 |
+
20,
|
| 43 |
+
21,
|
| 44 |
+
22,
|
| 45 |
+
23,
|
| 46 |
+
24,
|
| 47 |
+
25,
|
| 48 |
+
26,
|
| 49 |
+
27,
|
| 50 |
+
28,
|
| 51 |
+
29,
|
| 52 |
+
30,
|
| 53 |
+
31,
|
| 54 |
+
32,
|
| 55 |
+
33,
|
| 56 |
+
34,
|
| 57 |
+
35,
|
| 58 |
+
36
|
| 59 |
+
],
|
| 60 |
+
"n_experts": 8,
|
| 61 |
+
"top_k": 2,
|
| 62 |
+
"outlier_num_experts": 8,
|
| 63 |
+
"outlier_num_experts_per_tok": 2
|
| 64 |
+
}
|
configuration_outlier_moe.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class OutlierMoEConfig(PretrainedConfig):
|
| 5 |
+
model_type = "outlier_moe"
|
| 6 |
+
|
| 7 |
+
def __init__(
|
| 8 |
+
self,
|
| 9 |
+
base_model_name_or_path=None,
|
| 10 |
+
moe_layers=None,
|
| 11 |
+
n_experts=0,
|
| 12 |
+
top_k=2,
|
| 13 |
+
**kwargs,
|
| 14 |
+
):
|
| 15 |
+
super().__init__(**kwargs)
|
| 16 |
+
self.base_model_name_or_path = base_model_name_or_path
|
| 17 |
+
self.moe_layers = list(moe_layers or [])
|
| 18 |
+
self.n_experts = int(n_experts)
|
| 19 |
+
self.top_k = int(top_k)
|
| 20 |
+
self.outlier_num_experts = int(kwargs.get("outlier_num_experts", self.n_experts))
|
| 21 |
+
self.outlier_num_experts_per_tok = int(kwargs.get("outlier_num_experts_per_tok", self.top_k))
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"pad_token_id": 151643,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
151645,
|
| 7 |
+
151643
|
| 8 |
+
],
|
| 9 |
+
"repetition_penalty": 1.05,
|
| 10 |
+
"temperature": 0.7,
|
| 11 |
+
"top_p": 0.8,
|
| 12 |
+
"top_k": 20,
|
| 13 |
+
"transformers_version": "4.37.0"
|
| 14 |
+
}
|
manifest.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model": "/mnt/1tb/Qwen2.5-14B-Instruct",
|
| 3 |
+
"model_name": "Outlier V3.2",
|
| 4 |
+
"num_layers": 48,
|
| 5 |
+
"hidden_size": 5120,
|
| 6 |
+
"intermediate_size": 13824,
|
| 7 |
+
"moe_layers": [
|
| 8 |
+
11,
|
| 9 |
+
12,
|
| 10 |
+
13,
|
| 11 |
+
14,
|
| 12 |
+
15,
|
| 13 |
+
16,
|
| 14 |
+
17,
|
| 15 |
+
18,
|
| 16 |
+
19,
|
| 17 |
+
20,
|
| 18 |
+
21,
|
| 19 |
+
22,
|
| 20 |
+
23,
|
| 21 |
+
24,
|
| 22 |
+
25,
|
| 23 |
+
26,
|
| 24 |
+
27,
|
| 25 |
+
28,
|
| 26 |
+
29,
|
| 27 |
+
30,
|
| 28 |
+
31,
|
| 29 |
+
32,
|
| 30 |
+
33,
|
| 31 |
+
34,
|
| 32 |
+
35,
|
| 33 |
+
36
|
| 34 |
+
],
|
| 35 |
+
"experts_per_layer": 8,
|
| 36 |
+
"top_k": 2,
|
| 37 |
+
"representation": "zero-delta ternary expert overlays over dense Qwen2.5 shared MLPs"
|
| 38 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
modeling_outlier_moe.py
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import json
|
| 4 |
+
import re
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
+
import torch
|
| 8 |
+
import torch.nn as nn
|
| 9 |
+
import torch.nn.functional as F
|
| 10 |
+
from safetensors import safe_open
|
| 11 |
+
from transformers import AutoModelForCausalLM, PreTrainedModel
|
| 12 |
+
|
| 13 |
+
from .configuration_outlier_moe import OutlierMoEConfig
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def _parse_dtype(value):
|
| 17 |
+
if value is None or value == "auto":
|
| 18 |
+
return value
|
| 19 |
+
if isinstance(value, torch.dtype):
|
| 20 |
+
return value
|
| 21 |
+
if isinstance(value, str):
|
| 22 |
+
table = {
|
| 23 |
+
"bfloat16": torch.bfloat16,
|
| 24 |
+
"bf16": torch.bfloat16,
|
| 25 |
+
"float16": torch.float16,
|
| 26 |
+
"fp16": torch.float16,
|
| 27 |
+
"float32": torch.float32,
|
| 28 |
+
"fp32": torch.float32,
|
| 29 |
+
}
|
| 30 |
+
return table.get(value.lower(), value)
|
| 31 |
+
return value
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def _load_alpha_map(model_dir: Path) -> dict[int, dict[int, float]]:
|
| 35 |
+
path = model_dir / "alpha.json"
|
| 36 |
+
raw = json.loads(path.read_text(encoding="utf-8"))
|
| 37 |
+
out: dict[int, dict[int, float]] = {}
|
| 38 |
+
for key, value in raw.items():
|
| 39 |
+
match = re.match(r"layer_(\d+)_expert_(\d+)", key)
|
| 40 |
+
if not match:
|
| 41 |
+
continue
|
| 42 |
+
layer_idx = int(match.group(1))
|
| 43 |
+
expert_idx = int(match.group(2))
|
| 44 |
+
out.setdefault(layer_idx, {})[expert_idx] = float(value)
|
| 45 |
+
return out
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def _load_router_map(model_dir: Path) -> dict[int, torch.Tensor]:
|
| 49 |
+
path = model_dir / "router_state.safetensors"
|
| 50 |
+
if not path.exists():
|
| 51 |
+
raise FileNotFoundError(f"Missing router state: {path}")
|
| 52 |
+
out: dict[int, torch.Tensor] = {}
|
| 53 |
+
with safe_open(str(path), framework="pt", device="cpu") as handle:
|
| 54 |
+
for key in handle.keys():
|
| 55 |
+
match = re.match(r"layer_(\d+)_router_weight", key)
|
| 56 |
+
if match:
|
| 57 |
+
out[int(match.group(1))] = handle.get_tensor(key).float()
|
| 58 |
+
if not out:
|
| 59 |
+
raise RuntimeError(f"No router weights found in {path}")
|
| 60 |
+
return out
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class CPUQuantizedExpert:
|
| 64 |
+
def __init__(self, tensors: dict[str, torch.Tensor], alpha: float) -> None:
|
| 65 |
+
self.gate_ternary = tensors["gate_ternary"].to(torch.int8).cpu()
|
| 66 |
+
self.gate_scale = tensors["gate_scale"].to(torch.float16).cpu()
|
| 67 |
+
self.up_ternary = tensors["up_ternary"].to(torch.int8).cpu()
|
| 68 |
+
self.up_scale = tensors["up_scale"].to(torch.float16).cpu()
|
| 69 |
+
self.down_ternary = tensors["down_ternary"].to(torch.int8).cpu()
|
| 70 |
+
self.down_scale = tensors["down_scale"].to(torch.float16).cpu()
|
| 71 |
+
self.alpha = float(alpha)
|
| 72 |
+
|
| 73 |
+
def materialize(self, device: torch.device, dtype: torch.dtype) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
|
| 74 |
+
gate = self.gate_ternary.to(device=device, dtype=dtype) * self.gate_scale.to(device=device, dtype=dtype).unsqueeze(-1)
|
| 75 |
+
up = self.up_ternary.to(device=device, dtype=dtype) * self.up_scale.to(device=device, dtype=dtype).unsqueeze(-1)
|
| 76 |
+
down = self.down_ternary.to(device=device, dtype=dtype) * self.down_scale.to(device=device, dtype=dtype).unsqueeze(-1)
|
| 77 |
+
return gate, up, down
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
class EvalRoutedQuantizedMoE(nn.Module):
|
| 81 |
+
def __init__(self, shared_mlp: nn.Module, experts: dict[int, CPUQuantizedExpert], router_weight: torch.Tensor, *, top_k: int) -> None:
|
| 82 |
+
super().__init__()
|
| 83 |
+
self.shared_mlp = shared_mlp
|
| 84 |
+
self.experts = experts
|
| 85 |
+
self.register_buffer("router_weight", router_weight.float().contiguous(), persistent=False)
|
| 86 |
+
self.top_k = int(top_k)
|
| 87 |
+
|
| 88 |
+
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
| 89 |
+
shared_out = self.shared_mlp(x)
|
| 90 |
+
batch, seq_len, hidden = x.shape
|
| 91 |
+
x_flat = x.reshape(-1, hidden)
|
| 92 |
+
shared_flat = shared_out.reshape(-1, hidden)
|
| 93 |
+
router_weight = self.router_weight.to(device=x.device, dtype=torch.float32)
|
| 94 |
+
logits = F.linear(x_flat.float(), router_weight)
|
| 95 |
+
vals, idx = torch.topk(logits, k=min(self.top_k, router_weight.shape[0]), dim=-1)
|
| 96 |
+
weights = F.softmax(vals, dim=-1)
|
| 97 |
+
mixed = shared_flat.float()
|
| 98 |
+
target_dtype = x.dtype if x.dtype in (torch.float16, torch.bfloat16) else torch.float32
|
| 99 |
+
|
| 100 |
+
for expert_idx, expert in self.experts.items():
|
| 101 |
+
token_idx, choice_idx = torch.where(idx == expert_idx)
|
| 102 |
+
if token_idx.numel() == 0:
|
| 103 |
+
continue
|
| 104 |
+
gate_w, up_w, down_w = expert.materialize(x.device, target_dtype)
|
| 105 |
+
x_tok = x_flat[token_idx].to(dtype=target_dtype)
|
| 106 |
+
gate = F.linear(x_tok, gate_w)
|
| 107 |
+
up = F.linear(x_tok, up_w)
|
| 108 |
+
out = F.linear(F.silu(gate) * up, down_w)
|
| 109 |
+
delta = out.float() - shared_flat[token_idx].float()
|
| 110 |
+
mixed[token_idx] += weights[token_idx, choice_idx].unsqueeze(-1) * expert.alpha * delta
|
| 111 |
+
del gate_w, up_w, down_w, x_tok, gate, up, out, delta
|
| 112 |
+
|
| 113 |
+
return mixed.to(dtype=shared_out.dtype).reshape(batch, seq_len, hidden)
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
def _load_layer_experts(model_dir: Path, layer_idx: int, experts_per_layer: int, alpha_map: dict[int, dict[int, float]]) -> dict[int, CPUQuantizedExpert]:
|
| 117 |
+
expert_dir = model_dir / "experts"
|
| 118 |
+
layer_alphas = alpha_map.get(layer_idx, {})
|
| 119 |
+
experts: dict[int, CPUQuantizedExpert] = {}
|
| 120 |
+
for expert_idx in range(experts_per_layer):
|
| 121 |
+
path = expert_dir / f"layer_{layer_idx:02d}_expert_{expert_idx:02d}.safetensors"
|
| 122 |
+
if not path.exists():
|
| 123 |
+
continue
|
| 124 |
+
with safe_open(str(path), framework="pt", device="cpu") as handle:
|
| 125 |
+
tensors = {key: handle.get_tensor(key) for key in handle.keys()}
|
| 126 |
+
experts[expert_idx] = CPUQuantizedExpert(tensors, layer_alphas.get(expert_idx, 0.0))
|
| 127 |
+
return experts
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
class OutlierMoEForCausalLM(PreTrainedModel):
|
| 131 |
+
config_class = OutlierMoEConfig
|
| 132 |
+
|
| 133 |
+
def __init__(self, config: OutlierMoEConfig) -> None:
|
| 134 |
+
super().__init__(config)
|
| 135 |
+
|
| 136 |
+
@classmethod
|
| 137 |
+
def from_pretrained(cls, pretrained_model_name_or_path, *model_args, config=None, **kwargs):
|
| 138 |
+
model_dir = Path(pretrained_model_name_or_path)
|
| 139 |
+
if config is None:
|
| 140 |
+
config = OutlierMoEConfig.from_pretrained(model_dir)
|
| 141 |
+
|
| 142 |
+
base_kwargs = {}
|
| 143 |
+
for key in ("trust_remote_code", "device_map", "low_cpu_mem_usage", "attn_implementation"):
|
| 144 |
+
if key in kwargs:
|
| 145 |
+
base_kwargs[key] = kwargs.pop(key)
|
| 146 |
+
|
| 147 |
+
torch_dtype = kwargs.pop("torch_dtype", None)
|
| 148 |
+
if torch_dtype is None and "dtype" in kwargs:
|
| 149 |
+
torch_dtype = kwargs.pop("dtype")
|
| 150 |
+
if torch_dtype is not None:
|
| 151 |
+
base_kwargs["torch_dtype"] = _parse_dtype(torch_dtype)
|
| 152 |
+
|
| 153 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 154 |
+
config.base_model_name_or_path,
|
| 155 |
+
**base_kwargs,
|
| 156 |
+
)
|
| 157 |
+
|
| 158 |
+
alpha_map = _load_alpha_map(model_dir)
|
| 159 |
+
router_map = _load_router_map(model_dir)
|
| 160 |
+
layers = list(getattr(config, "moe_layers", []))
|
| 161 |
+
experts_per_layer = int(getattr(config, "n_experts", 0))
|
| 162 |
+
top_k = int(getattr(config, "top_k", 2))
|
| 163 |
+
|
| 164 |
+
for layer_idx in layers:
|
| 165 |
+
layer = model.model.layers[layer_idx]
|
| 166 |
+
experts = _load_layer_experts(model_dir, layer_idx, experts_per_layer, alpha_map)
|
| 167 |
+
router_weight = router_map[layer_idx]
|
| 168 |
+
layer.mlp = EvalRoutedQuantizedMoE(layer.mlp, experts, router_weight, top_k=top_k)
|
| 169 |
+
|
| 170 |
+
model.config = config
|
| 171 |
+
return model
|
router_state.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d1ecc6089f24fce21acaebe83a52bfa9ca3122e4b0f66044d7968b6a542da44
|
| 3 |
+
size 4262200
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
"additional_special_tokens": [
|
| 183 |
+
"<|im_start|>",
|
| 184 |
+
"<|im_end|>",
|
| 185 |
+
"<|object_ref_start|>",
|
| 186 |
+
"<|object_ref_end|>",
|
| 187 |
+
"<|box_start|>",
|
| 188 |
+
"<|box_end|>",
|
| 189 |
+
"<|quad_start|>",
|
| 190 |
+
"<|quad_end|>",
|
| 191 |
+
"<|vision_start|>",
|
| 192 |
+
"<|vision_end|>",
|
| 193 |
+
"<|vision_pad|>",
|
| 194 |
+
"<|image_pad|>",
|
| 195 |
+
"<|video_pad|>"
|
| 196 |
+
],
|
| 197 |
+
"bos_token": null,
|
| 198 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\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 {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
|
| 199 |
+
"clean_up_tokenization_spaces": false,
|
| 200 |
+
"eos_token": "<|im_end|>",
|
| 201 |
+
"errors": "replace",
|
| 202 |
+
"model_max_length": 131072,
|
| 203 |
+
"pad_token": "<|endoftext|>",
|
| 204 |
+
"split_special_tokens": false,
|
| 205 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 206 |
+
"unk_token": null
|
| 207 |
+
}
|
training_summary.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"status": "complete",
|
| 3 |
+
"base_model": "/mnt/1tb/Qwen2.5-14B-Instruct",
|
| 4 |
+
"output_dir": "/mnt/1tb/outlier-40b-v3_2",
|
| 5 |
+
"moe_layers": [
|
| 6 |
+
11,
|
| 7 |
+
12,
|
| 8 |
+
13,
|
| 9 |
+
14,
|
| 10 |
+
15,
|
| 11 |
+
16,
|
| 12 |
+
17,
|
| 13 |
+
18,
|
| 14 |
+
19,
|
| 15 |
+
20,
|
| 16 |
+
21,
|
| 17 |
+
22,
|
| 18 |
+
23,
|
| 19 |
+
24,
|
| 20 |
+
25,
|
| 21 |
+
26,
|
| 22 |
+
27,
|
| 23 |
+
28,
|
| 24 |
+
29,
|
| 25 |
+
30,
|
| 26 |
+
31,
|
| 27 |
+
32,
|
| 28 |
+
33,
|
| 29 |
+
34,
|
| 30 |
+
35,
|
| 31 |
+
36
|
| 32 |
+
],
|
| 33 |
+
"experts_per_layer": 8,
|
| 34 |
+
"parallel_experts": 8,
|
| 35 |
+
"steps_per_expert": 1500,
|
| 36 |
+
"batch_size": 4,
|
| 37 |
+
"lr": 0.001,
|
| 38 |
+
"router_steps": 100,
|
| 39 |
+
"router_lr": 0.001,
|
| 40 |
+
"top_k_logits": 128,
|
| 41 |
+
"topk_experts": 2,
|
| 42 |
+
"corpus_examples": 5000,
|
| 43 |
+
"elapsed_min": 368.89529099485,
|
| 44 |
+
"peak_gpu_gb": 98.52585554122925,
|
| 45 |
+
"router_summary": {
|
| 46 |
+
"router_loss": 0.050282299518585205,
|
| 47 |
+
"router_time_s": 443.438959875999,
|
| 48 |
+
"peak_gpu_gb": 98.52585554122925,
|
| 49 |
+
"chunks": 7
|
| 50 |
+
},
|
| 51 |
+
"diversity": {
|
| 52 |
+
"avg_pairwise_cosine": 0.9031525016813488,
|
| 53 |
+
"min_pairwise_cosine": 0.6628175973892212,
|
| 54 |
+
"avg_ternary_zero_rate": 0.3134468748019292
|
| 55 |
+
},
|
| 56 |
+
"alpha_stats": {
|
| 57 |
+
"min": 0.007545572705566883,
|
| 58 |
+
"max": 0.09620270878076553,
|
| 59 |
+
"mean": 0.06583456943133989
|
| 60 |
+
},
|
| 61 |
+
"memory_estimate": {
|
| 62 |
+
"expert_state_gb": 3.1640625,
|
| 63 |
+
"rough_base_gb": 28.0,
|
| 64 |
+
"rough_overhead_gb": 45.0,
|
| 65 |
+
"rough_total_gb": 98.3125
|
| 66 |
+
},
|
| 67 |
+
"training_records": 39000
|
| 68 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|