From 63f7d8395e4ce6bf9da980b1231ffe24fea0e2f9 Mon Sep 17 00:00:00 2001 From: Jinhang Choi Date: Mon, 13 Jul 2026 22:00:14 -0700 Subject: [PATCH] Missing moe_router_dtype causes unexpected downcast Signed-off-by: Jinhang Choi --- examples/post_training/modelopt/quantize.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/post_training/modelopt/quantize.py b/examples/post_training/modelopt/quantize.py index 8c68399dfe6..b4ae90b7b70 100644 --- a/examples/post_training/modelopt/quantize.py +++ b/examples/post_training/modelopt/quantize.py @@ -518,6 +518,11 @@ def forward_backward_step(model, batch): import_kwargs = {"dtype": import_dtype} if "trust_remote_code" in inspect.signature(import_mcore_gpt_from_hf).parameters: import_kwargs.update({"trust_remote_code": args.trust_remote_code}) + if ( + "moe_router_dtype" in inspect.signature(import_mcore_gpt_from_hf).parameters + and getattr(args, "moe_router_dtype", None) + ): + import_kwargs.update({"moe_router_dtype": args.moe_router_dtype}) import_mcore_gpt_from_hf( unwrapped_model, args.pretrained_model_path, workspace_dir, **import_kwargs )