Skip to content

fix: derive MacaqLinear torch compute dtype from the input (#4217) - #4263

Merged
Qubitium merged 1 commit into
mainfrom
pr/4217
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
pr/4217

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Summary

MacaqLinear fixed compute_dtype in __init__; after module.to(dtype) the Torch path crashed when a bias existed (Half vs BFloat16) and silently computed in the stale dtype without one.

What Changed

  • gptqmodel/nn_modules/qlinear/macaq.py: _forward_torch derives the compute dtype from the input, dequantizes with it, casts pre_scale/bias at forward time, and returns the input activation dtype.
  • Added tests/test_macaq_forward_dtype_4217.py (33 cases: 2 dtypes × 8 precision/rotation/pre_mode combos × bias/no-bias).

Tests

pytest tests/test_macaq_forward_dtype_4217.py -q   # 33 passed
ruff check <changed files>   # clean

Fixes #4217

Model Support / Module Plan

N/A — no new model types or registry entries.

Verification environment

No compiled GPTQModel extensions are built in this environment (Machete/Marlin/QQQ-CUDA unavailable), so hardware-specific paths are called out explicitly above. The 19 fix branches from this sprint merge cleanly into one integration branch; the combined run was 195 passed, 2 skipped, ruff check clean.

Comment thread tests/test_macaq_forward_dtype_4217.py Resolved
@Qubitium
Qubitium merged commit def7ef1 into main Nov 16, 2026
6 checks passed
@Qubitium
Qubitium deleted the pr/4217 branch November 16, 2026 06:26
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.

[BUG] MacaqLinear Torch path crashes after module.to(dtype) when it has a bias, and silently computes in the old dtype without one

1 participant