-
Notifications
You must be signed in to change notification settings - Fork 453
[DDP][GPTQ] Fixes for big models #2400
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
Open
HDCharles
wants to merge
12
commits into
main
Choose a base branch
from
92_ddp_fixes_and_testing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+114
−2
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ae20046
test code
HDCharles 154405b
fixing the nvfp4 bug
HDCharles 64b83c9
testing
HDCharles 5828e0f
more testing
HDCharles 75fc964
tests
HDCharles 5580efb
fix
HDCharles d1c25ce
trying to fix big model stuff
HDCharles a1d20bb
finalizing fixes
HDCharles dec4b61
cleaning up extra tests
HDCharles a1f1335
ruff praise be to you
HDCharles c541dff
add tests
HDCharles 81fa5dc
Merge branch 'main' into 92_ddp_fixes_and_testing
HDCharles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| from unittest.mock import patch | ||
|
|
||
| import torch | ||
| from compressed_tensors.offload.cache import OffloadCache | ||
|
|
||
| from llmcompressor.modeling.moe_context import ( | ||
| _apply_offloading_to_replacement, | ||
| _find_ancestor_with_offload_cache, | ||
| ) | ||
|
|
||
|
|
||
| def test_find_ancestor_with_offload_cache(): | ||
| """Test finding ancestor modules with OffloadCache.""" | ||
| # Module without offload cache | ||
| module_no_cache = torch.nn.Linear(10, 10) | ||
| assert _find_ancestor_with_offload_cache(module_no_cache) is None | ||
|
|
||
| # Module with offload cache | ||
| module_with_cache = torch.nn.Linear(10, 10) | ||
| module_with_cache._parameters = OffloadCache() | ||
| assert _find_ancestor_with_offload_cache(module_with_cache) is module_with_cache | ||
|
|
||
| # Parent with child that has cache | ||
| parent = torch.nn.Sequential(module_with_cache) | ||
| assert _find_ancestor_with_offload_cache(parent) is module_with_cache | ||
|
|
||
|
|
||
| @patch("llmcompressor.modeling.moe_context.get_cache_init_kwargs") | ||
| @patch("llmcompressor.modeling.moe_context.offload_module") | ||
| def test_apply_offloading_to_replacement(mock_offload, mock_get_kwargs): | ||
| """Test offloading is applied from original to replacement.""" | ||
| mock_get_kwargs.return_value = {"device": "cpu"} | ||
|
|
||
| # Original with offload cache | ||
| original = torch.nn.Sequential(torch.nn.Linear(10, 10)) | ||
| original[0]._parameters = OffloadCache() | ||
|
|
||
| # Replacement without cache | ||
| replacement = torch.nn.Sequential(torch.nn.Linear(10, 10)) | ||
|
|
||
| _apply_offloading_to_replacement(original, replacement) | ||
|
|
||
| # Should call offload_module for the child linear layer | ||
| assert mock_offload.called | ||
| assert mock_get_kwargs.called | ||
|
|
||
|
|
||
| def test_apply_offloading_no_cache(): | ||
| """Test no offloading applied when original has no cache.""" | ||
| original = torch.nn.Linear(10, 10) | ||
| replacement = torch.nn.Linear(10, 10) | ||
|
|
||
| # Should not raise, just return early | ||
| _apply_offloading_to_replacement(original, replacement) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.