Skip to content

Commit 4152fe1

Browse files
committed
Merge branch 'export/v1-1-0' into lab/docs-v1-1-0
2 parents 1d13009 + dc11173 commit 4152fe1

11 files changed

Lines changed: 2485 additions & 1652 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@
105105

106106
### Bug Fix
107107

108+
- Fixed `model_config.py`: `load_model()` VLM fallback did not trigger for models raising `"Unrecognized configuration class"` (e.g. Cohere2VisionForConditionalGeneration). Added the error pattern to `_vlm_hints`
109+
- Fixed `gptq/_gptq.py`: Cholesky decomposition in `run_gptq` could fail with `LinAlgError` on ill-conditioned Hessians (observed on large VLMs at deeper layers). Extracted `_compute_inverse_hessian()` with progressive damping fallback (up to 5 retries, 10x damping increase per retry). No impact on normal operation
108110
- Fixed `TypeError` in `QuantLinear.forward` when `S_qk` scaling was applied to MLP layers (`onecomp/pre_process/quant_models.py`)
109111
- Fixed silent weight corruption in `GPTQLinear` when `qzero=0` was stored through the GPTQ v1 zero-point path (`onecomp/quantizer/gptq/gptq_layer.py`)
110112
- Root cause: AutoGPTQ v1 stores `raw_zero - 1`, so `qzero=0` becomes `-1`; without masking, its sign-extended bits corrupted neighboring packed slots
@@ -113,6 +115,14 @@
113115
- Added regression tests for per-slot pack corruption, packed/unpacked forward paths, the `gptq_v2` branch, and the `from_saved_state` path for GPTQ v1 tensors
114116
- **NOTE**: If you have GPTQ models quantized with previous versions, please re-quantize them with this release, as they may contain corrupted internal data.
115117

118+
### Packaging
119+
120+
- Bumped minimum `transformers` requirement from `>=5.3.0` to `>=5.5.0` (`pyproject.toml`)
121+
- Added `cu130` optional-dependency extra and the `pytorch-cu130` wheel index (`https://download.pytorch.org/whl/cu130`) for CUDA 13 hosts (e.g. NVIDIA B200) (`pyproject.toml`)
122+
- Pinned the `vllm` extra to `vllm>=0.10` to prevent uv from falling back to legacy versions whose source build requires `CUDA_HOME` (`pyproject.toml`)
123+
- Added uv `conflicts` declarations between the `vllm` extra and the `cpu` / `cu118` / `cu121` / `cu124` / `cu126` / `cu128` extras: vLLM `>=0.20` requires `torch>=2.10`, which is only published for `cu130`. This forces `vllm` to be installed only with `--extra cu130` and prevents silent fallback to a `vllm` version incompatible with `transformers>=5` at runtime (`pyproject.toml`)
124+
- Restricted `tool.uv.environments` to `sys_platform == 'linux'` and `python_full_version >= '3.12', < '3.14'` to skip lock splits for unused Windows and out-of-range Python versions (`pyproject.toml`)
125+
116126
### Examples
117127

118128
- Added `example/example_custom_calibration.py`: Demonstrates `CalibrationConfig` with a custom calibration dataset (Python code snippets in `example/data/python_calibration.txt`). Quantizes TinyLlama with GPTQ 3-bit using both default C4 and custom Python-code calibration, then compares inference outputs across multiple prompts to show how calibration data choice affects quantization quality.
@@ -142,6 +152,7 @@
142152
- Added `docs/api/quantizers/onebit.md` (OneBit API reference)
143153
- Updated `mkdocs.yml` nav: added AutoBit/JointQ algorithm pages, OneBit API page; renamed Post-Process nav title to include Block-wise PTQ
144154
- Added example script links to `docs/user-guide/pre-process.md`
155+
- Added a Troubleshooting section to `docs/user-guide/vllm-inference.md` describing how to bypass the unconditional DeepGEMM (FP8) kernel warmup for non-FP8 quantization (GPTQ / DBF / Mixed-GPTQ) by setting `VLLM_USE_DEEP_GEMM=0` and `VLLM_DEEP_GEMM_WARMUP=skip`
145156

146157
### Tests
147158

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Choose the appropriate CUDA version for your system:
7979
| CUDA 12.4 | `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124` |
8080
| CUDA 12.6 | `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126` |
8181
| CUDA 12.8 | `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128` |
82+
| CUDA 13.0 | `pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130` |
8283

8384
Check your CUDA version:
8485
```bash
@@ -124,18 +125,20 @@ uv sync --extra cu128 --extra dev --extra visualize
124125
The `uv sync` command creates a Python virtual environment and installs all dependent libraries.
125126

126127
The `--extra cu128` option installs the CUDA-enabled version of PyTorch (along with `torchvision` from the same CUDA index).
127-
Replace `cu128` with the appropriate variant for your environment: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, or `cu128`.
128+
Replace `cu128` with the appropriate variant for your environment: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, `cu128`, or `cu130`.
128129
PyTorch will be automatically downloaded by `uv`, so you do not need to install it beforehand.
129130

130131
Adding `--extra dev` installs development tools (black, pytest, pylint).
131132
Adding `--extra visualize` installs matplotlib for visualization features.
132133

133-
To use vLLM for serving quantized models, add `--extra vllm`:
134+
To use vLLM for serving quantized models, add `--extra vllm` together with `--extra cu130`:
134135

135136
```bash
136-
uv sync --extra cu128 --extra dev --extra visualize --extra vllm
137+
uv sync --extra cu130 --extra dev --extra visualize --extra vllm
137138
```
138139

140+
> **Note:** `--extra vllm` is only compatible with `--extra cu130`. Recent vLLM releases require `torch>=2.10`, whose wheels are only published for the `cu130` index. Combining `--extra vllm` with `cpu` / `cu118` / `cu121` / `cu124` / `cu126` / `cu128` is rejected by `uv` at lock time.
141+
139142
> **Note:** `--extra vllm` may take a long time on the first run if a pre-built `xformers` wheel is not available for your Python/CUDA combination (e.g. Python 3.13). Using Python 3.12 typically avoids this.
140143
141144
#### Running commands (uv environment)
@@ -171,7 +174,7 @@ pip install torch --index-url https://download.pytorch.org/whl/cu128
171174
pip install -e ".[dev]"
172175
```
173176

174-
Replace `cu128` with the appropriate variant for your environment: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, or `cu128`.
177+
Replace `cu128` with the appropriate variant for your environment: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, `cu128`, or `cu130`.
175178

176179

177180
### Building Documentation Locally
@@ -209,8 +212,8 @@ OneComp-quantized models can be served with [vLLM](https://docs.vllm.ai/) via bu
209212
Combined with [Open WebUI](https://github.com/open-webui/open-webui), you can chat with your quantized model through a ChatGPT-like browser interface — entirely on your local machine.
210213

211214
```bash
212-
# uv users
213-
uv sync --extra cu128 --extra vllm
215+
# uv users (vLLM requires cu130; see Installation for details)
216+
uv sync --extra cu130 --extra vllm
214217

215218
# pip users
216219
pip install vllm

benchmark/llama3-8b-jointq/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ llama3-8b-fixed-lam0.3/
5454
llama3-8b-fixed-lam0.5/
5555
llama3-8b-incremental/
5656
llama3-8b-incremental-actorder-mse/
57+
58+
run_llama3-8b_diagonal_lam*_actorder.sh
59+
llama3-8b-diagonal-lam*-actorder/

benchmark/qwen3-14b-jointq/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ qwen3-14b-fixed-lam0.3/
5555
qwen3-14b-fixed-lam0.5/
5656
qwen3-14b-incremental/
5757
qwen3-14b-incremental-actorder-mse/
58+
59+
run_qwen3-14b_diagonal_lam*_actorder.sh
60+
qwen3-14b-diagonal-lam*-actorder/

benchmark/qwen3-8b-jointq/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ qwen3-8b-fixed-lam0.3/
5555
qwen3-8b-fixed-lam0.5/
5656
qwen3-8b-incremental/
5757
qwen3-8b-incremental-actorder-mse/
58+
59+
run_qwen3-8b_diagonal_lam*_actorder.sh
60+
qwen3-8b-diagonal-lam*-actorder/

docs/getting-started/installation.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ Install the appropriate version of PyTorch for your system.
4949
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128
5050
```
5151

52+
=== "CUDA 13.0"
53+
54+
```bash
55+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130
56+
```
57+
5258
Check your CUDA version:
5359

5460
```bash
@@ -92,17 +98,20 @@ uv sync --extra cu128 --extra dev --extra visualize
9298
```
9399

94100
The `uv sync` command creates a virtual environment and installs all dependencies (including `torchvision` from the same CUDA index as PyTorch).
95-
Replace `cu128` with the appropriate CUDA variant for your system: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, or `cu128`.
101+
Replace `cu128` with the appropriate CUDA variant for your system: `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, `cu128`, or `cu130`.
96102

97103
Adding `--extra dev` installs development tools (black, pytest, pylint).
98104
Adding `--extra visualize` installs matplotlib for visualization features.
99105

100-
To use vLLM for serving quantized models, add `--extra vllm`:
106+
To use vLLM for serving quantized models, add `--extra vllm` together with `--extra cu130`:
101107

102108
```bash
103-
uv sync --extra cu128 --extra dev --extra visualize --extra vllm
109+
uv sync --extra cu130 --extra dev --extra visualize --extra vllm
104110
```
105111

112+
!!! note "vLLM requires the `cu130` extra"
113+
Recent vLLM releases depend on `torch>=2.10`, whose wheels are only published for the `cu130` index. The `--extra vllm` declaration in `pyproject.toml` therefore conflicts with `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, and `cu128`; combining any of these with `--extra vllm` is rejected by `uv` at lock time.
114+
106115
!!! warning
107116
Do **not** install vLLM with `uv pip install vllm` after `uv sync`. Packages installed via `uv pip` are not tracked by the lockfile and will be removed or overwritten by subsequent `uv sync` or `uv run` commands. Always use `--extra vllm` instead.
108117

docs/user-guide/vllm-inference.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ vLLM is available as an optional dependency:
2020
=== "uv (recommended)"
2121

2222
```bash
23-
uv sync --extra cu128 --extra vllm
23+
uv sync --extra cu130 --extra vllm
2424
```
2525

26-
Replace `cu128` with your CUDA variant (`cu118`, `cu121`, `cu124`, `cu126`, or `cu128`).
26+
!!! note "Use `cu130`; older CUDA extras are rejected"
27+
Recent vLLM releases depend on `torch>=2.10`, whose wheels are only published for the `cu130` PyTorch index. `pyproject.toml` therefore declares `--extra vllm` as conflicting with `cpu`, `cu118`, `cu121`, `cu124`, `cu126`, and `cu128`; combining any of those with `--extra vllm` will fail at lock time. Use `--extra cu130` for vLLM workflows.
2728

2829
=== "pip"
2930

@@ -218,3 +219,27 @@ Select the model from the dropdown at the top of the chat screen and start a con
218219
| Variable | Default | Description |
219220
|----------|---------|-------------|
220221
| `ONECOMP_DBF_NAIVE_LINEAR` | `0` | Set to `1` to force the naive (non-GemLite) kernel for DBF inference. Useful for debugging or when GemLite is unavailable. |
222+
223+
## Troubleshooting
224+
225+
### `RuntimeError: DeepGEMM backend is not available or outdated`
226+
227+
vLLM unconditionally runs a DeepGEMM (FP8) kernel warmup at engine startup, even for non-FP8 quantization such as GPTQ, DBF, or Mixed-GPTQ. When the optional [`deep_gemm`](https://github.com/deepseek-ai/DeepGEMM) package is not installed, the warmup fails with:
228+
229+
```
230+
RuntimeError: DeepGEMM backend is not available or outdated. Please install or update the `deep_gemm` to a newer version to enable FP8 kernels.
231+
```
232+
233+
OneComp-quantized models do not require DeepGEMM. Disable the FP8 kernel path before launching vLLM:
234+
235+
```bash
236+
export VLLM_USE_DEEP_GEMM=0
237+
export VLLM_DEEP_GEMM_WARMUP=skip
238+
239+
# Then launch vllm as usual
240+
vllm serve ./your-quantized-model
241+
# or
242+
python your_vllm_script.py
243+
```
244+
245+
Both variables are read directly by vLLM; OneComp does not interpret them.

onecomp/model_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def load_model(self, device_map=None):
8383
try:
8484
model = AutoModelForCausalLM.from_pretrained(self.get_model_id_or_path(), **kwargs)
8585
except ValueError as e:
86-
_vlm_hints = ("Unrecognized model", "is not supported")
86+
_vlm_hints = ("Unrecognized configuration class", "Unrecognized model", "is not supported")
8787
if not _HAS_VLM_AUTO or not any(h in str(e) for h in _vlm_hints):
8888
raise
8989
self.logger.info("AutoModelForCausalLM failed; trying AutoModelForImageTextToText.")

onecomp/quantizer/gptq/_gptq.py

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,53 @@ def create_inference_layer(self, result, linear_module, **kwargs):
463463
)
464464

465465

466+
def _compute_inverse_hessian(
467+
hessian: torch.Tensor,
468+
percdamp: float,
469+
max_retries: int = 5,
470+
) -> torch.Tensor:
471+
"""Compute the upper-triangular Cholesky factor of the inverse Hessian.
472+
473+
Applies damping to the diagonal for numerical stability. If the
474+
Cholesky decomposition fails (non-positive-definite), progressively
475+
increases damping and retries up to *max_retries* times.
476+
477+
Args:
478+
hessian: Square Hessian matrix (modified in-place).
479+
percdamp: Base damping as a fraction of the mean diagonal.
480+
max_retries: Maximum number of retry attempts with increased damping.
481+
482+
Returns:
483+
Upper-triangular Cholesky factor of the inverse Hessian.
484+
"""
485+
damp = percdamp * torch.mean(torch.diag(hessian))
486+
diag = torch.arange(hessian.shape[0], device=hessian.device)
487+
hessian[diag, diag] += damp
488+
489+
damp_scale = 1.0
490+
for attempt in range(max_retries):
491+
try:
492+
cholesky_lower = torch.linalg.cholesky(hessian)
493+
break
494+
except torch._C._LinAlgError:
495+
damp_scale *= 10.0
496+
extra = damp_scale * damp
497+
hessian[diag, diag] += extra
498+
logger.warning(
499+
"Cholesky failed (attempt %d/%d); adding extra damping %.2e",
500+
attempt + 1,
501+
max_retries,
502+
extra,
503+
)
504+
else:
505+
raise RuntimeError(
506+
"Cholesky decomposition failed after %d damping attempts. "
507+
"The Hessian may be severely ill-conditioned." % max_retries
508+
)
509+
hessian = torch.cholesky_inverse(cholesky_lower)
510+
return torch.linalg.cholesky(hessian, upper=True)
511+
512+
466513
def run_gptq( # pylint: disable=too-many-positional-arguments
467514
hessian: torch.Tensor,
468515
layer: torch.nn.Module,
@@ -518,13 +565,7 @@ def run_gptq( # pylint: disable=too-many-positional-arguments
518565

519566
Q_int = torch.zeros_like(matrix_W, dtype=torch.int32)
520567

521-
damp = percdamp * torch.mean(torch.diag(hessian))
522-
diag = torch.arange(hessian.shape[0], device=hessian.device)
523-
hessian[diag, diag] += damp
524-
hessian = torch.linalg.cholesky(hessian)
525-
hessian = torch.cholesky_inverse(hessian)
526-
hessian = torch.linalg.cholesky(hessian, upper=True)
527-
Hinv = hessian
568+
Hinv = _compute_inverse_hessian(hessian, percdamp)
528569

529570
# Accumulate per-group scale/zero for grouped quantization
530571
if groupsize != -1:

pyproject.toml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers = [
2323
"Intended Audience :: Science/Research",
2424
]
2525
dependencies = [
26-
"transformers >= 5.3.0",
26+
"transformers >= 5.5.0",
2727
"accelerate",
2828
"datasets",
2929
"lm-eval",
@@ -52,6 +52,7 @@ cu121 = ["torch", "torchvision"]
5252
cu124 = ["torch", "torchvision"]
5353
cu126 = ["torch", "torchvision"]
5454
cu128 = ["torch", "torchvision"]
55+
cu130 = ["torch", "torchvision"]
5556
dev = [
5657
"black",
5758
"pylint",
@@ -60,7 +61,7 @@ dev = [
6061
visualize = [
6162
"matplotlib>=3.10.8",
6263
]
63-
vllm = ["vllm"]
64+
vllm = ["vllm>=0.10"]
6465
docs = [
6566
"mkdocs-material",
6667
"mkdocstrings[python]",
@@ -74,7 +75,21 @@ mixed_gptq = "vllm_plugins.gptq.vllm_plugin:register_vllm_plugin"
7475

7576
[tool.uv]
7677
conflicts = [
77-
[{extra = "cpu"}, {extra = "cu118"}, {extra = "cu121"}, {extra = "cu124"}, {extra = "cu126"}, {extra = "cu128"}],
78+
[{extra = "cpu"}, {extra = "cu118"}, {extra = "cu121"}, {extra = "cu124"}, {extra = "cu126"}, {extra = "cu128"}, {extra = "cu130"}],
79+
# vLLM (latest, >=0.20) requires torch 2.10/2.11, whose wheels are only
80+
# published for cu130. Forbid using vllm together with the older CUDA
81+
# wheel indices so that uv either picks vllm>=0.20 on cu130 or refuses
82+
# the combination, instead of silently falling back to a vllm version
83+
# that is incompatible with transformers>=5 at runtime.
84+
[{extra = "cpu"}, {extra = "vllm"}],
85+
[{extra = "cu118"}, {extra = "vllm"}],
86+
[{extra = "cu121"}, {extra = "vllm"}],
87+
[{extra = "cu124"}, {extra = "vllm"}],
88+
[{extra = "cu126"}, {extra = "vllm"}],
89+
[{extra = "cu128"}, {extra = "vllm"}],
90+
]
91+
environments = [
92+
"sys_platform == 'linux' and python_full_version >= '3.12' and python_full_version < '3.14'",
7893
]
7994

8095
[tool.uv.sources]
@@ -85,6 +100,7 @@ torch = [
85100
{index = "pytorch-cu124", extra = "cu124"},
86101
{index = "pytorch-cu126", extra = "cu126"},
87102
{index = "pytorch-cu128", extra = "cu128"},
103+
{index = "pytorch-cu130", extra = "cu130"},
88104
]
89105
torchvision = [
90106
{index = "pytorch-cpu", extra = "cpu"},
@@ -93,6 +109,7 @@ torchvision = [
93109
{index = "pytorch-cu124", extra = "cu124"},
94110
{index = "pytorch-cu126", extra = "cu126"},
95111
{index = "pytorch-cu128", extra = "cu128"},
112+
{index = "pytorch-cu130", extra = "cu130"},
96113
]
97114

98115
[[tool.uv.index]]
@@ -125,6 +142,11 @@ name = "pytorch-cu128"
125142
url = "https://download.pytorch.org/whl/cu128"
126143
explicit = true
127144

145+
[[tool.uv.index]]
146+
name = "pytorch-cu130"
147+
url = "https://download.pytorch.org/whl/cu130"
148+
explicit = true
149+
128150
[tool.uv.extra-build-dependencies]
129151
xformers = ["torch"]
130152

0 commit comments

Comments
 (0)