@@ -868,6 +868,17 @@ def load_single_module(name, module):
868868 return
869869
870870 names = name .split ('.' )
871+
872+ # Special case: ConfigurableMoE.backend (TRTLLMGenFusedMoE)
873+ # Currently saved MoE weights don't include 'backend' in their names.
874+ # After MoE refactoring, ConfigurableMoE now has a backend submodule,
875+ # and weights loading is done in the backend, so module name includes '.backend'.
876+ # We need to use parent module name (without .backend) to match saved weight names.
877+ # After MoE refactoring is fully complete, all paths will follow this branch.
878+ if names [- 1 ] == "backend" and isinstance (module , MoE ):
879+ name = '.' .join (names [:- 1 ])
880+ names = name .split ('.' )
881+
871882 # WAR: better solution is that llama has its own load_weights function.
872883 if names [- 1 ] == 'next_layer_layernorm' :
873884 return
@@ -968,6 +979,17 @@ def load_single_module(name, module):
968979 return
969980
970981 names = name .split ('.' )
982+
983+ # Special case: ConfigurableMoE.backend (TRTLLMGenFusedMoE)
984+ # Currently saved MoE weights don't include 'backend' in their names.
985+ # After MoE refactoring, ConfigurableMoE now has a backend submodule,
986+ # and weights loading is done in the backend, so module name includes '.backend'.
987+ # We need to use parent module name (without .backend) to match saved weight names.
988+ # After MoE refactoring is fully complete, all paths will follow this branch.
989+ if names [- 1 ] == "backend" and isinstance (module , MoE ):
990+ name = '.' .join (names [:- 1 ])
991+ names = name .split ('.' )
992+
971993 module_names_breakdown , module_name = names [:- 1 ], names [- 1 ]
972994
973995 if weight_mapper .does_require_special_handling (module_name ):
0 commit comments