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

Add initial support for compressed-tensors checkpoints #2732

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

danieldk
Copy link
Member

@danieldk danieldk commented Nov 7, 2024

What does this PR do?

compressed-tensors is a safetensors extension for sparse, quantized tensors. The format is more powerful than earlier AWQ/GPTQ/FP8 quantization, because

  • Different quantizer configurations can be used for different targets.
  • The format can specify input/output quantizers in addition to weight quantizers.
  • Configurable exclusions for quantization.

This change adds a dependency on the compressed-tensors package for its configuration parsing and layer matching functionality.

The following types of quantization are supported in this PR:

  • W8A16 and W4A16 INT using GPTQ-Marlin kernels.
  • W8A8 and W8A16 FP using FP8-Marlin and cutlass kernels.

Support for other quantization types will be added in subsequent PRs.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@danieldk danieldk force-pushed the feature/compressed-tensors branch from f4fd8d1 to cd4f20e Compare November 7, 2024 13:54
@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.

@danieldk danieldk force-pushed the feature/compressed-tensors branch 2 times, most recently from 8311452 to ff9868b Compare November 8, 2024 10:25
compressed-tensors is a safetensors extension for sparse, quantized
tensors. The format is more powerful than earlier AWQ/GPTQ/FP8
quantization, because

- Different quantizer configurations can be used for different targets.
- The format can specify input/output quantizers in addition to weight
  quantizers.
- Configurable exclusions for quantization.

This change adds a dependency on the `compressed-tensors` package for
its configuration parsing and layer matching functionality.

The following types of quantization are supported in this PR:

- W8A16 and W4A16 INT using GPTQ-Marlin kernels.
- W8A8 and W8A16 FP using FP8-Marlin and cutlass kernels.

Support for other quantization types will be added in subsequent PRs.
@danieldk danieldk force-pushed the feature/compressed-tensors branch from fc229c5 to 575af7e Compare November 8, 2024 12:23
@danieldk danieldk marked this pull request as ready for review November 8, 2024 14:47
Copy link
Collaborator

@Narsil Narsil left a comment

Choose a reason for hiding this comment

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

LGTM.

The loader logic looks quite complicated (yet again) and seems quite close to existing code.
However I do not have a good solution and the current code is probably close to best in kind (I guess I'm just complaining about the apparently absurd complexity of quantization schemes).

@danieldk danieldk merged commit a785000 into main Nov 10, 2024
12 of 13 checks passed
@danieldk danieldk deleted the feature/compressed-tensors branch November 10, 2024 12:54
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.

3 participants