Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Resolve #3060, preload_module_classes is lost for nested modules #3248

Merged
merged 7 commits into from
Dec 3, 2024

Conversation

wejoncy
Copy link
Contributor

@wejoncy wejoncy commented Nov 22, 2024

What does this PR do?

We ran into this issue when try to load VPTQ models by multiple devices, the VQLinear layer has embending as its sub-module. This function should move all constant buffers/parameters to the corresponding devices from Meta device.
So add_hook_to_module should pass preload_module_classes to the next recursive calling for the nested modules.

https://github.com/microsoft/VPTQ/blob/ac7258f461e214ca705f5895513f314576750528/vptq/layers/vqlinear.py#L160C18-L160C18

This PR is to fix #3060

@wejoncy wejoncy changed the title resolve 3060 Fix: Resolve #3060 Nov 22, 2024
Copy link
Member

@SunMarc SunMarc left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks for fixing ! Could you share which specific issue you where having ? Also if you can implement a test, it would be nice but not needed to merged this PR. You can fix the CI with make style

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

agreed with Marc, some more details to this issue and adding a test is needed.

@wejoncy wejoncy changed the title Fix: Resolve #3060 Fix: Resolve #3060, pre is lost for nested modules Nov 26, 2024
@wejoncy wejoncy changed the title Fix: Resolve #3060, pre is lost for nested modules Fix: Resolve #3060, preload_module_classes is lost for nested modules Nov 26, 2024
@wejoncy wejoncy changed the title Fix: Resolve #3060, preload_module_classes is lost for nested modules Fix: Resolve #3060, preload_module_classes is lost for nested modules Nov 26, 2024
@wejoncy
Copy link
Contributor Author

wejoncy commented Nov 26, 2024

Hi @muellerzr and @SunMarc Thanks for your review. I have briefly described the issue in overview of this PR.
And I will try to construct such a test case.

tests/test_accelerator.py Outdated Show resolved Hide resolved
@muellerzr
Copy link
Collaborator

@wejoncy can you do make style; make quality? It'll fix the quality failure

Copy link
Collaborator

@muellerzr muellerzr left a comment

Choose a reason for hiding this comment

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

Looks great to me, and fantastic test. Let's just fixup that quality then good to merge!

@SunMarc SunMarc merged commit 60461ff into huggingface:main Dec 3, 2024
25 checks passed
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.

preload_module_classes is lost in attach_execution_device_hook.
4 participants