Skip to content

support 5,6,7 bits on cuda and add humming backend - #2281

Merged
wenhuach21 merged 15 commits into
mainfrom
support_567_bits
Sep 7, 2026
Merged

support 5,6,7 bits on cuda and add humming backend#2281
wenhuach21 merged 15 commits into
mainfrom
support_567_bits

Conversation

@wenhuach21

Copy link
Copy Markdown
Contributor

Description

Please briefly describe your main changes, the motivation.

Type of Change

Bug fix

Related Issues

Fixes or relates to #

Checklist Before Submitting

  • My code has been tested locally.
  • Documentation has been updated as needed.
  • New or updated tests are included where applicable.
  • The CUDA CI has passed. You can trigger it by commenting /azp run Unit-Test-CUDA-AutoRound.

@wenhuach21

Copy link
Copy Markdown
Contributor Author

@wenhuach21

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	auto_round/schemes.py
#	docs/step_by_step.md
#	docs/step_by_step_CN.md

Co-authored-by: wenhuach21 <108330088+wenhuach21@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts by merging main in commit 53d4571.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

There are correctness/docs issues (corrupted docs snippet, backend constraint mismatch), misleading format support reporting, missing targeted CUDA test coverage for 5/6/7-bit paths, and unrelated dataset-scope changes bundled into the same PR.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends AutoRound’s CUDA path to support 5/6/7-bit weight-only quantization by introducing a generic bit-stream packing layout and adding a new optional CUDA inference backend backed by the external humming kernels, alongside documentation and format-matrix updates.

Changes:

  • Add generic little-endian bit-stream pack/unpack utilities and wire them into GPTQ/AWQ-style torch fallback packing for 5/6/7 bits.
  • Register new CUDA backend variants (auto_round:humming*) and add post-init handling to repack/JIT kernels when humming is selected.
  • Update docs/tests and export-format scheme lists to reflect 5/6/7-bit support in the auto_round family.
File summaries
File Description
test/unit/test_cpu/export/test_export.py Updates expected error message for AWQ scheme support text.
docs/step_by_step.md Documents 5/6/7-bit packing and humming usage; updates scheme/format tables.
docs/step_by_step_CN.md Chinese translation updates for the new 5/6/7-bit and humming documentation.
auto_round/utils/bit_packing.py New generic bit-stream packing implementation (1–8 bits) plus AWQ reorder helpers.
auto_round/inference/convert_model.py Adds humming QuantLinear construction and humming post-init repack pass.
auto_round/inference/backend.py Expands torch backend bit support; registers humming backends; adds callable requirement handling.
auto_round/export/formats/backends/autoround.py Adds W5A16/W6A16/W7A16 to AutoRound format support list.
auto_round/export/formats/backends/auto_gptq.py Allows W5/6/7 schemes but restricts them to auto_round* formats.
auto_round/export/formats/backends/auto_awq.py Allows W5/6/7 schemes but restricts them to auto_round* formats; adjusts alignment checks.
auto_round/export/export_to_awq/utils.py Implements 5/6/7-bit AWQ pack/unpack via generic bit-stream packing and updates alignment rules.
auto_round/compressors/mllm/dataset.py Refactors LLaVA dataset download logic (hf_hub_download preferred; retries; better errors).
auto_round_extension/torch/qlinear_torch.py Adds generic 5/6/7-bit pack/unpack path for torch fallback QuantLinear.
auto_round_extension/torch/qlinear_torch_zp.py Mirrors generic 5/6/7-bit support for the GPTQ zp-1 variant.
auto_round_extension/humming/qlinear_humming.py New inference-only humming QuantLinear implementations (GPTQ/AWQ variants).
auto_round_extension/humming/init.py Exposes humming QuantLinear classes and availability helper.
Review details

Suppressed comments (1)

auto_round/export/formats/backends/auto_awq.py:50

  • support_schemes/check_scheme_args now include W5A16/W6A16/W7A16 for the auto_awq format, but check_and_reset_format rejects 5/6/7 bits unless the format starts with auto_round. This can mislead users (and auto_round list format) into thinking the plain auto_awq export supports 5/6/7-bit when it doesn't.
    support_schemes = ["W4A16", "W5A16", "W6A16", "W7A16"]
    format_name = "auto_awq"

    # See AutoGPTQFormat.EXTENDED_BITS -- 5/6/7-bit uses the generic bit-stream
    # layout, which upstream AutoAWQ kernels cannot read.
    EXTENDED_BITS = (5, 6, 7)

    @classmethod
    def check_scheme_args(cls, scheme: QuantizationScheme) -> bool:
        error_logs = []
        if scheme.bits not in (4,) + cls.EXTENDED_BITS:
            error_logs.append(f"bits={scheme.bits}")
        if not re.search("int", scheme.data_type):
            error_logs.append(f"data_type={scheme.data_type}")
        if scheme.super_bits:
            error_logs.append(f"super_bits={scheme.super_bits}")
        if scheme.super_group_size:
            error_logs.append(f"super_group_size={scheme.super_group_size}")
        if error_logs:
            raise ValueError(
                f"{cls.format_name} format support quantization scheme with {','.join(cls.support_schemes)} "
                f"but got {', '.join(error_logs)}, please have a check."
            )
  • Files reviewed: 15/15 changed files
  • Comments generated: 8
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread auto_round/export/formats/backends/auto_gptq.py
Comment thread auto_round/inference/backend.py
Comment thread auto_round/compressors/mllm/dataset.py
Comment thread auto_round/compressors/mllm/dataset.py Outdated
Comment thread auto_round/compressors/mllm/dataset.py
Comment thread auto_round/inference/backend.py
Comment thread auto_round_extension/torch/qlinear_torch.py Outdated
Comment thread docs/step_by_step.md Outdated
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

wenhuach21 and others added 4 commits September 3, 2026 14:19
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wenhuach21 <108330088+wenhuach21@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
wenhuach21 and others added 2 commits September 3, 2026 14:21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@wenhuach21 wenhuach21 changed the title support 5,6,7 bits on cuda support 5,6,7 bits on cuda and add humming backend Sep 7, 2026
@wenhuach21

Copy link
Copy Markdown
Contributor Author

need to add uts later

@wenhuach21
wenhuach21 merged commit 1f23576 into main Sep 7, 2026
51 checks passed
@wenhuach21
wenhuach21 deleted the support_567_bits branch September 7, 2026 02:56
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.

5 participants