hqq-quantization
Half-Quadratic Quantization for LLMs without calibration data. Use when quantizing models to 4/3/2-bit precision without needing calibration datasets, for fast quantization workflows, or when deploying with vLLM or HuggingFace Transformers.
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Half-Quadratic Quantization for LLMs without calibration data. Use when quantizing models to 4/3/2-bit precision without needing calibration datasets, for fast quantization workflows, or when deploying with vLLM or HuggingFace Transformers.
How to use
Zainstaluj HQQ za pomocą pip install hqq. Jeśli chcesz konkretny backend (np. PyTorch), użyj pip install hqq[torch], pip install hqq[torchao], pip install hqq[bitblas] lub pip install hqq[marlin].
Zaimportuj niezbędne moduły: from hqq.core.quantize import BaseQuantizeConfig, HQQLinear oraz torch.nn as nn.
Zdefiniuj konfigurację kwantyzacji, określając precyzję (8, 4, 3, 2 lub 1 bit) i rozmiar grupy wag. Konfiguracja decyduje o kompromisie między rozmiarem modelu a jakością wyjścia.
Zastosuj HQQLinear do warstw modelu, które chcesz skwantyzować. Proces przebiega bez kalibracji – wystarczy model i konfiguracja.
Jeśli planujesz fine-tuning, użyj LoRA lub PEFT na skwantyzowanych wagach. HQQ jest w pełni kompatybilny z tymi metodami.
Wdrażaj model z vLLM lub HuggingFace Transformers – oba frameworki natywnie wspierają HQQ i automatycznie wykorzystują zoptymalizowany backend do szybszej inferencji.