-
Notifications
You must be signed in to change notification settings - Fork 75
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
Replace LayerCompressor with HooksMixin #1038
Open
kylesayrs
wants to merge
10
commits into
main
Choose a base branch
from
kylesayrs/remove-layer-compressor
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.
Open
Conversation
This file contains 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
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. |
kylesayrs
force-pushed
the
kylesayrs/remove-layer-compressor
branch
from
January 13, 2025 21:41
d8c3261
to
08d700c
Compare
Signed-off-by: Kyle Sayers <[email protected]>
kylesayrs
force-pushed
the
kylesayrs/remove-layer-compressor
branch
from
January 23, 2025 17:56
71067ad
to
59bdb66
Compare
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Something super weird is happening with that failing test
I've observed two things
In the meantime, this PR is reviewable |
Signed-off-by: Kyle Sayers <[email protected]>
Looks like adding this change fixed the test weights = torch.rand(10, 4)
if is_24:
weights = _make_24_sparse(weights)
else:
weights[0, :] = torch.ones(4, ) # guarantee not 24 sparse The most likely explanation is that this test randomly fails, and that this PR happened to be unlucky |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
Prerequisites
remove_hooks
to remove subsets #1021disable_hooks
to keep subsets #1023Changes
Interface/ Features
sequential_targets
to match GPTQ and madetargets
an aliasSparseGPT
_LinAlgError
forSparseGPT
Implementations
SparseGPTModifier
andWandaPruningModifier
to matchGPTQModifier
LayerCompressor
,ModuleCompressionWrapper
,SparseGptWrapper
, andWandaWrapper
SparsityModifierMixin
allow_tf32
Tests
test_sgpt_defaults.py
since this test doesn't test anything new or novel about this modifierTesting
grep -r "LayerCompressor\|ModuleCompressionWrapper\|SparseGptWrapper\|WandaWrapper" src/ examples/ tests/
test_invalid_layerwise_recipes_raise_exceptions
andtest_successful_layerwise_recipe
passllama3_8b_2of4.py
passes and was evaluated with both SparseGPT and WandaPotential Follow ups
targets
andignore
to SparseGPT and WandaRegression Testing
The hessian, row scalar, and compressed weight values were confirmed to be unchanged in the case that of one calibration sample. The final evaluations are different, which is likely due to numerical imprecision (dividing by int vs torch.int), different pipelines (different subgraph partitions => different imprecision from cpu offloading, potentially different module arguments).
Evaluation
Models were compressed using
examples/sparse_2of4_quantization_fp8/llama3_8b_2of4.py
sparsegpt
Main
Branch
To test wanda, the
SparseGPTModifier
was replaced with theWandaPruningModifier
wanda
Main
Branch