feat:[AutoDeploy] Support Quantized MoE matcher - Step1 - #68
Conversation
d3eceb0 to
3715a45
Compare
|
@Fridah-nv re. |
|
dcbb1fe to
2bfd86a
Compare
…nit tests Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
…cc issue and e2e mixtral fp4 has kernel error wo moe matching Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
… exclude_modules in hf_quant_config Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
… refinements Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
606ff78 to
e20dccc
Compare
| # model.load_state_dict. | ||
| # This sync step can interfere with load_hooks by mixing raw checkpoint weights and | ||
| # model-transformed weights,leading to unexpected key mismatches or format issues. | ||
| load_checkpoint_in_model(model, checkpoint=ckpt_file, full_state_dict=False) |
There was a problem hiding this comment.
Hi @Fridah-nv , I think this is breaking support for models where some of the weights are aliased. Before this changes, models in which lm_head.weight and embed.weight are aliased worked fine, but they raise the following error after this change:https://gitlab-master.nvidia.com/dl/jet/ci/-/jobs/187865431/raw
* add torch_fp8_moe and fp8 linear support in pattern matcher, update unit tests Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add torch-fp4-moe and fp4 support in pattern matcher, unit test has acc issue and e2e mixtral fp4 has kernel error wo moe matching Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add pre-commit hook Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * hacky fix for e2e run of mixtral FP4 and fp4 op unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * EP support for torch_fp4_moe and torch_fp8_moe Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix rebase: op rename, shard_load_hook bug in FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix pre-commit Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix weight loading-load_hook issue for FP4, update function to handle exclude_modules in hf_quant_config Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * addressing feedback, add moe op template, update op names,other minor refinements Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * move common functionality to utility Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix FP4QuantizationImpl register from rebase Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add quantize_moe pass for patched torch_moe op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add transformation unit tests for FP8 and FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update should_skip_quantization to fix bmm unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel and utils to extract weight for dynamic BMM case Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel to drop linear op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * minor Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> --------- Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
* add torch_fp8_moe and fp8 linear support in pattern matcher, update unit tests Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add torch-fp4-moe and fp4 support in pattern matcher, unit test has acc issue and e2e mixtral fp4 has kernel error wo moe matching Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add pre-commit hook Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * hacky fix for e2e run of mixtral FP4 and fp4 op unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * EP support for torch_fp4_moe and torch_fp8_moe Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix rebase: op rename, shard_load_hook bug in FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix pre-commit Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix weight loading-load_hook issue for FP4, update function to handle exclude_modules in hf_quant_config Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * addressing feedback, add moe op template, update op names,other minor refinements Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * move common functionality to utility Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * fix FP4QuantizationImpl register from rebase Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add quantize_moe pass for patched torch_moe op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * add transformation unit tests for FP8 and FP4 Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update should_skip_quantization to fix bmm unit test Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel and utils to extract weight for dynamic BMM case Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * update BMMDynamicModel to drop linear op Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> * minor Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com> --------- Signed-off-by: Frida Hou <201670829+Fridah-nv@users.noreply.github.com>
Description
Separate from NVIDIA#4361
TODO:
Precision SupportsectionTest Coverage
Tested e2e with
nvidia/Mixtral-8x7B-Instruct-v0.1-FP8andnvidia/Mixtral-8x7B-Instruct-v0.1-FP4on B100, works with both world_size=1 and world_size=2Note that the Mixtral models are now in patched moe path after the patch in qwen3.py
nvidia/DeepSeek-R1-FP4only work withfull_state_dictset to true inload_checkpoint_in_model(see #5892 ), but it also suffers from long execution time (I loaded the full model on 1 node and it took 3 hours to went through the pipeline and start loading weights). Verified that 4 layers can run e2e.GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--disable-fail-fast --skip-test --stage-list "A10-1, xxx" --gpu-type "A30, H100_PCIe" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-[Post-Merge]-1, xxx"]Launch build/test pipelines. All previously running jobs will be killed.
--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests. Will also run L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-[Post-Merge]-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-[Post-Merge]-1, xxx".For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.md.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.