Skip to content

Add support for handling aliased parameters - #21

Closed
suyoggupta wants to merge 4 commits into
feat/ad_coverage_week1from
user/sg/aliasing
Closed

suyoggupta wants to merge 4 commits into
feat/ad_coverage_week1from
user/sg/aliasing

Conversation

@suyoggupta

@suyoggupta suyoggupta commented May 21, 2025 •

Copy link
Copy Markdown

This PR adds support for handling aliased parameters during model export by introducing a new load hook to ensure that all aliases receive the same parameter value when loading state dictionaries.

Introduced the function add_load_hook_for_aliased_params to manage aliased parameters.
Updated torch_export_to_gm to invoke the new load hook.

Copilot AI review requested due to automatic review settings May 21, 2025 20:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for handling aliased parameters during model export by introducing a new load hook to ensure that all aliases receive the same parameter value when loading state dictionaries. It also removes an extra blank line in an existing function and integrates the new hook into the export pipeline.

  • Introduced the function add_load_hook_for_aliased_params to manage aliased parameters.
  • Updated torch_export_to_gm to invoke the new load hook.
  • Minor formatting cleanup in the deduplication helper.

@Fridah-nv

Copy link
Copy Markdown

I think this commit is breaking tests/unittest/_torch/auto_deploy/unit/singlegpu/transformations/test_export.py

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

Copy link
Copy Markdown
Author

all tests in tests/unittest/_torch/auto_deploy/unit/singlegpu pass

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

4 participants