Skip to content

feat:[AutoDeploy] Add support for Phi3/4 Model Family - #17

Closed
Fridah-nv wants to merge 5 commits into
feat/ad_coverage_week1from
user/fridah/phi_sprint
Closed

Fridah-nv wants to merge 5 commits into
feat/ad_coverage_week1from
user/fridah/phi_sprint

Conversation

@Fridah-nv

@Fridah-nv Fridah-nv commented May 20, 2025 •

Copy link
Copy Markdown

Moving from #3079

Unfuse_weight transformation and Phi-3 Model init patch is removed, mainly updating some utility functions.

Support Matrix

Model compile_backend / runtime / atten_backend world_size
microsoft/phi-4
microsoft/Phi-4-reasoning
microsoft/Phi-4-reasoning-plus
{torch-simple,torch-opt}, {trtllm,demollm}, {TritonWithFlattenedInputs,FlashInfer} 1,2,4
microsoft/Phi-3-mini-4k-instruct
microsoft/Phi-3-medium-4k-instruct
{torch-simple,torch-opt}, {trtllm,demollm}, {TritonWithFlattenedInputs} 1,2,4
microsoft/Phi-3-mini-128k-instruct
microsoft/Phi-3-medium-128k-instruct
{torch-simple}, {trtllm,demollm}, {TritonWithFlattenedInputs} 1,2,4

microsoft/Phi-4-mini-instruct and microsoft/Phi-4-mini-reasoning pending #21

TODO

  • Update README

Description

Please explain the issue and the solution in short.

Test Coverage

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".

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip 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-pipeline

Reuse 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.

@lucaslie

Copy link
Copy Markdown

What's the issue with using FlashInfer for some of the models? Float32?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remind me again why we want different submodules here? some issue about clean-up/canonicalize_graph right?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really hoping we can just instead add a pass to our canonicalize_graph pass that will delete unused buffers/parameters even if the submodule has users

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, registering as submodule ensures it to be handled by gm.delete_all_unused_submodules().

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an issue when unfuse_weight and fuse_gemm are applied in a pipeline, not the necessary update for supporting Phi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just write a utility in canonicalize_graph to remove unused weights/buffers based on gm.delete_all_unused_submodules()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just seems we should address this issue at its "core"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember in updating #3079 we had a similar function that manually deletes all the unused weights, I don't fully remember why we switched to adding submodule. Maybe in the process of debugging the memory leakage issue, I fear that manually deleting the weights can leave some stray reference to the weight and caused the leakage. But the leakage turned out to be sth irrelevent.
Maybe we can skip modifying fusion.py for the remove unused weights/buffers in this update, the issue won't arise since we removed unfuse_weight transformation.

@Fridah-nv

Fridah-nv commented May 21, 2025 •

Copy link
Copy Markdown
Author

What's the issue with using FlashInfer for some of the models? Float32?

HeadDim not multiple of 64, also skipping flashinfer RoPE for this

@Fridah-nv
Fridah-nv force-pushed the user/fridah/phi_sprint branch from 7dfda0a to 7e83c10 Compare May 21, 2025 22:42
@suyoggupta suyoggupta mentioned this pull request May 22, 2025
lucaslie added a commit that referenced this pull request May 22, 2025
Includes #17 , #18, #21 , #23

* move Phi PR for sprint

Signed-off-by: Ubuntu <[email protected]>

* remove Phi3 patch and unfuse_weight transformation

Signed-off-by: Ubuntu <[email protected]>

* update Phi3/4 patches

Signed-off-by: Ubuntu <[email protected]>

* minor

Signed-off-by: Ubuntu <[email protected]>

* minor

Signed-off-by: Ubuntu <[email protected]>

* Update the position id to int64

Signed-off-by: Chenghao Zhang <[email protected]>

* Add support for handling aliased parameters

Signed-off-by: Suyog Gupta <[email protected]>

* update tests

Signed-off-by: Suyog Gupta <[email protected]>

* lint

Signed-off-by: Suyog Gupta <[email protected]>

* lint

Signed-off-by: Suyog Gupta <[email protected]>

* removed load state dict with assign context manager

Signed-off-by: Suguna Velury <[email protected]>

* formatting fix

Signed-off-by: Suguna Velury <[email protected]>

* Removed related unit tests

Signed-off-by: Suguna Velury <[email protected]>

* [AutoDeploy] correctly identifying how to load HF checkpoint weights

Signed-off-by: Lucas Liebenwein <[email protected]>

* [AutoDeploy] correctly load sharded weights

Signed-off-by: Lucas Liebenwein <[email protected]>

* skip sharding if num_users>1

Signed-off-by: Suyog Gupta <[email protected]>

---------

Signed-off-by: Ubuntu <[email protected]>
Signed-off-by: Chenghao Zhang <[email protected]>
Signed-off-by: Suyog Gupta <[email protected]>
Signed-off-by: Suguna Velury <[email protected]>
Signed-off-by: Lucas Liebenwein <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Chenghao Zhang <[email protected]>
Co-authored-by: Suguna Velury <[email protected]>
Co-authored-by: Lucas Liebenwein <[email protected]>
@lucaslie

Copy link
Copy Markdown

merged in #25

@lucaslie lucaslie closed this May 22, 2025
lucaslie added a commit that referenced this pull request May 27, 2025
Includes #17 , #18, #21 , #23

* move Phi PR for sprint

Signed-off-by: Ubuntu <[email protected]>

* remove Phi3 patch and unfuse_weight transformation

Signed-off-by: Ubuntu <[email protected]>

* update Phi3/4 patches

Signed-off-by: Ubuntu <[email protected]>

* minor

Signed-off-by: Ubuntu <[email protected]>

* minor

Signed-off-by: Ubuntu <[email protected]>

* Update the position id to int64

Signed-off-by: Chenghao Zhang <[email protected]>

* Add support for handling aliased parameters

Signed-off-by: Suyog Gupta <[email protected]>

* update tests

Signed-off-by: Suyog Gupta <[email protected]>

* lint

Signed-off-by: Suyog Gupta <[email protected]>

* lint

Signed-off-by: Suyog Gupta <[email protected]>

* removed load state dict with assign context manager

Signed-off-by: Suguna Velury <[email protected]>

* formatting fix

Signed-off-by: Suguna Velury <[email protected]>

* Removed related unit tests

Signed-off-by: Suguna Velury <[email protected]>

* [AutoDeploy] correctly identifying how to load HF checkpoint weights

Signed-off-by: Lucas Liebenwein <[email protected]>

* [AutoDeploy] correctly load sharded weights

Signed-off-by: Lucas Liebenwein <[email protected]>

* skip sharding if num_users>1

Signed-off-by: Suyog Gupta <[email protected]>

---------

Signed-off-by: Ubuntu <[email protected]>
Signed-off-by: Chenghao Zhang <[email protected]>
Signed-off-by: Suyog Gupta <[email protected]>
Signed-off-by: Suguna Velury <[email protected]>
Signed-off-by: Lucas Liebenwein <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Chenghao Zhang <[email protected]>
Co-authored-by: Suguna Velury <[email protected]>
Co-authored-by: Lucas Liebenwein <[email protected]>
Signed-off-by: Lucas Liebenwein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants