File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
modelopt/torch/export/plugins Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1717"""Custom mapping from Nemotron Hugging Face models to Megatron Core models."""
1818
1919from .mcore_custom import (
20+ COL_ETP ,
2021 COL_TP ,
22+ ROW_ETP ,
2123 REPLICATE ,
2224 ROW_TP ,
2325 CustomModuleMapping ,
2426 NameRemapping ,
2527 QKVMerging ,
2628 QKVSlicing ,
29+ GatedMLPSlicing ,
30+ GatedMLPMerging ,
2731)
2832
2933# Example on adding a new CausalLM.
3943 "linear_fc2" : NameRemapping ("model.layers.{}.mlp.down_proj." ),
4044 "final_layernorm" : NameRemapping ("model.norm." ),
4145 "output_layer" : NameRemapping ("lm_head." ),
46+ # MoE
47+ "router" : NameRemapping ("model.layers.{}.mlp.gate." ),
48+ "local_experts.linear_fc1" : GatedMLPSlicing ("model.layers.{}.mlp.experts.{}." ),
49+ "local_experts.linear_fc2" : NameRemapping ("model.layers.{}.mlp.experts.{}.down_proj." ),
4250}
4351
4452
6371 "pre_mlp_layernorm" : NameRemapping ("backbone.layers.{}.norm." , REPLICATE ),
6472 "linear_fc1" : NameRemapping ("backbone.layers.{}.mixer.up_proj." , COL_TP ),
6573 "linear_fc2" : NameRemapping ("backbone.layers.{}.mixer.down_proj." , ROW_TP ),
74+ # MoE
75+ "router" : NameRemapping ("model.layers.{}.mlp.gate." , REPLICATE ),
76+ "local_experts.linear_fc1" : GatedMLPMerging ("model.layers.{}.mlp.experts.{}." , COL_ETP ),
77+ "local_experts.linear_fc2" : NameRemapping ("model.layers.{}.mlp.experts.{}.down_proj." , ROW_ETP ),
78+
79+
6680}
6781
6882
You can’t perform that action at this time.
0 commit comments