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

Bdellabe/awq modifier v3 #1177

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

brian-dellabetta
Copy link
Collaborator

SUMMARY:
Draft of AWQModifier, replaces #181 and #824 (hence v3)

TEST PLAN:
"please outline how the changes were tested"

Copy link

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

)
with align_module_device(fc):
fc.weight.mul_(scales_view)
fc.weight.data = (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you're updating a parameter, so you'll have to use update_offload_parameter

Copy link
Collaborator Author

@brian-dellabetta brian-dellabetta Feb 19, 2025

Choose a reason for hiding this comment

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

updated

if module in balance_layers:
module.weight.mul_(scales.view(1, -1).to(module.weight.device))
elif module == smooth_layer:
if module.weight.ndim == 1:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you're updating a weight and bias, so you'll have to use update_offload_parameter

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we have to use update_offload_parameter for weights and biases too?

Copy link
Collaborator

Choose a reason for hiding this comment

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

weights and biases are parameters, so yes

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can keep your inplace modification and just call

update_offload_parameter(module, "weight")
update_offload_parameter(module, "bias")

Signed-off-by: Brian Dellabetta <[email protected]>

samples = [batch["input_ids"] for batch in dataloader]

samples = torch.cat(samples, dim=0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you putting all samples into the same batch. This is likely the source of your memory issues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks for pointing that out! will toggle this and see if it affects anything

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