Skip to content

Commit 2581cad

Browse files
committed
Merge branch 'lab/issue-39-global-ptq' into 'export/v1-2-0'
Add global ptq See merge request onecomp/onecomp-lab!51
2 parents 97bccb6 + 273c2fa commit 2581cad

56 files changed

Lines changed: 5148 additions & 88 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
# Change log
22

3-
4-
## [v1.2.0] 2026-06-04 (WIP)
5-
6-
### Evaluation:
7-
- Added `onecomp.eval` and the `onecomp-eval` CLI: one vLLM server, subprocess evaluators, aggregated `summary.json` / `summary.csv`
8-
- Added `mt_bench` (Japanese MT-Bench) and opt-in `throughput` (TTFT / decode tok/s) evaluators
9-
10-
## New Feature : Dashboard
11-
12-
- Added `dashboard/`, a browser-based web app for OneCompression on **SLURM-managed HPC GPU nodes without Docker**: pick a Hugging Face model and quantization settings in the UI, run jobs on the GPU, deploy the quantized checkpoint, and validate inference via chat
13-
- **Stack**: React + Vite frontend (local PC), FastAPI API, Celery worker + user-built Redis, SQLite job DB, per-job output under `backend/tmp/quantized/`; CUDA quantization via `onecomp` and chat deploy via a separate **vLLM** subprocess from the same `backend/.venv` (`onecomp` + `vllm>=0.21` in `pyproject.toml`)
14-
- **Quantization methods exposed in the UI**: `gptq`, `autobit`, `jointq`, and `auto_run` (VRAM-based bitwidth / group size); optional QEP (not with JointQ); fractional bit widths for `autobit` / `auto_run`
15-
16-
### for Developer: pre-commit
17-
18-
- Added `.pre-commit-config.yaml` with `black`, `isort`, and local hooks (`no-japanese`, `copyright-header`, `no-email-address`); install with `uv sync --extra dev` then `pre-commit install` (see README)
3+
## [v1.2.0] 2026-06-08
194

205
### Save/Load Support for JointQ, RTN, and OneBit Quantizers
216

@@ -37,6 +22,26 @@
3722
- `create_inference_layer()` builds `OneBitLinear` via `OneBitLinear.from_quantization_result()`
3823
- Added `_build_quantization_bits()` static method for per-layer metadata
3924

25+
## New Feature : Dashboard
26+
27+
- Added `dashboard/`, a browser-based web app for OneCompression on **SLURM-managed HPC GPU nodes without Docker**: pick a Hugging Face model and quantization settings in the UI, run jobs on the GPU, deploy the quantized checkpoint, and validate inference via chat
28+
- **Stack**: React + Vite frontend (local PC), FastAPI API, Celery worker + user-built Redis, SQLite job DB, per-job output under `backend/tmp/quantized/`; CUDA quantization via `onecomp` and chat deploy via a separate **vLLM** subprocess from the same `backend/.venv` (`onecomp` + `vllm>=0.21` in `pyproject.toml`)
29+
- **Quantization methods exposed in the UI**: `gptq`, `autobit`, `jointq`, and `auto_run` (VRAM-based bitwidth / group size); optional QEP (not with JointQ); fractional bit widths for `autobit` / `auto_run`
30+
31+
### New Feature: Global PTQ (Post-Training Quantization)
32+
33+
- Added `GlobalPTQ` and `GlobalPTQDistributed` post-process classes for KL-distillation-based global optimisation of continuous quantization parameters (scales and zeros for GPTQ; scaling factors for DBF)
34+
- `GlobalPTQ`: Single-GPU implementation with cosine-warmup LR scheduling, early stopping, mixed-precision support, and gradient accumulation
35+
- `GlobalPTQDistributed`: Multi-GPU implementation using HuggingFace Trainer + DeepSpeed ZeRO-2, supporting KL divergence and/or NTP loss with automatic best-state rollback
36+
37+
### Evaluation:
38+
- Added `onecomp.eval` and the `onecomp-eval` CLI: one vLLM server, subprocess evaluators, aggregated `summary.json` / `summary.csv`
39+
- Added `mt_bench` (Japanese MT-Bench) and opt-in `throughput` (TTFT / decode tok/s) evaluators
40+
41+
### for Developer: pre-commit
42+
43+
- Added `.pre-commit-config.yaml` with `black`, `isort`, and local hooks (`no-japanese`, `copyright-header`, `no-email-address`); install with `uv sync --extra dev` then `pre-commit install` (see README)
44+
4045
### OneBitLinear Inference Layer Improvements
4146

4247
- Added `OneBitLinear.from_quantization_result()` class method: builds `OneBitLinear` from `OnebitResult` (mirrors the pattern used by `GPTQLinear` and `DoubleBinaryLinear`) (`onecomp/quantizer/onebit/onebit_layer.py`)
@@ -77,6 +82,9 @@
7782
- Changed JointQ test default `bits` from `1` to `2` to match GPTQLinear packing constraints (`tests/onecomp/quantizer/jointq/test_jointq.py`)
7883
- Updated `check_equal_results` in RTN and OneBit tests to use `compute_dequantized_weight()` instead of direct `dequantized_weight` attribute access
7984
- Updated `apply_quantized_weights` in RTN and OneBit tests to use `compute_dequantized_weight()` with proper dtype preservation
85+
- Tightened GPTQ unit test tolerances in `tests/onecomp/quantizer/gptq/test_gptq.py` so regressions in dequantized-weight error are detected earlier (`error < 0.4`, `max_error < 1.71`; previously `0.6` / `2.5`) (`tests/onecomp/quantizer/gptq/test_gptq.py`)
86+
- Fixed `tests/onecomp/quantizer/test_module.py` to feed `y_replaced` consistently into `q_proj` / `k_proj` / `v_proj` after quantized weights are applied, aligning the replacement-path forward test with the intended residual update flow
87+
- Extracted the duplicated attention+MLP forward loop in `test_quantize_error` into `TestModel.forward()` (`tests/onecomp/quantizer/test_module.py`); both the pre-quantization and post-quantization inference paths now call `model(inp)` directly, eliminating 34 duplicate lines
8088

8189
### Documentation
8290

@@ -92,17 +100,6 @@
92100

93101
- Added `example/vllm_inference/example_jointq_vllm_inference.py`: end-to-end JointQ quantization (4-bit, `group_size=128`) → save → vLLM offline inference. Mirrors the GPTQ vLLM example, uses `qep=False` (JointQ does not support QEP), and documents the `bits >= 2` requirement for vLLM bit-packing. Registered in the README example table.
94102

95-
### Quantizer module forward test fix
96-
97-
- Fixed `tests/onecomp/quantizer/test_module.py` to feed `y_replaced` consistently into `q_proj` / `k_proj` / `v_proj` after quantized weights are applied, aligning the replacement-path forward test with the intended residual update flow
98-
99-
### GPTQ quantization test thresholds
100-
101-
- Tightened GPTQ unit test tolerances in `tests/onecomp/quantizer/gptq/test_gptq.py` so regressions in dequantized-weight error are detected earlier (`error < 0.4`, `max_error < 1.71`; previously `0.6` / `2.5`)
102-
103-
### Test infrastructure
104-
105-
- Extracted the duplicated attention+MLP forward loop in `test_quantize_error` into `TestModel.forward()` (`tests/onecomp/quantizer/test_module.py`); both the pre-quantization and post-quantization inference paths now call `model(inp)` directly, eliminating 34 duplicate lines
106103

107104
## [v1.1.1] 2026-05-21
108105

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ Once PyTorch is installed, you can install `onecomp`:
108108
pip install onecomp
109109
```
110110

111+
To enable multi-GPU training features (DeepSpeed), install with the `distributed` extra:
112+
113+
```bash
114+
pip install "onecomp[distributed]"
115+
```
116+
111117
### for developers (uv : recommended)
112118

113119
#### Install `uv`
@@ -133,6 +139,7 @@ PyTorch will be automatically downloaded by `uv`, so you do not need to install
133139

134140
Adding `--extra dev` installs development tools (black, pre-commit, pytest, pylint).
135141
Adding `--extra visualize` installs matplotlib for visualization features.
142+
Adding `--extra distributed` installs DeepSpeed for multi-GPU training.
136143
Adding `--extra hydra` installs `hydra-core` for the example scripts and `model_validation/` runners that use Hydra-based configuration.
137144

138145
To use vLLM for serving quantized models, add `--extra vllm` together with `--extra cu130`:

dashboard/backend/app/api/jobs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from app.constants import ChatTaskStatus, InferenceStatus, JobStatus
24
from app.core.config import settings
35
from app.core.database import get_db

dashboard/backend/app/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from enum import StrEnum
24

35

dashboard/backend/app/core/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from typing import Literal
24

35
from pydantic_settings import BaseSettings

dashboard/backend/app/core/database.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from app.core.config import settings
24
from sqlalchemy import create_engine
35
from sqlalchemy.orm import DeclarativeBase, sessionmaker

dashboard/backend/app/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from contextlib import asynccontextmanager
24

35
from app.api.jobs import router as jobs_router

dashboard/backend/app/models/job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
import uuid
24
from datetime import datetime, timezone
35

dashboard/backend/app/schemas/job.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Copyright 2025-2026 Fujitsu Ltd."""
2+
13
from datetime import datetime
24

35
from app.constants import ChatTaskStatus, InferenceStatus, JobStatus

dashboard/backend/app/services/huggingface.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
"""Lightweight HuggingFace Hub helpers used by the API layer."""
1+
"""Lightweight HuggingFace Hub helpers used by the API layer.
2+
3+
Copyright 2025-2026 Fujitsu Ltd.
4+
"""
25

36
from __future__ import annotations
47

0 commit comments

Comments
 (0)