Orchestra-Research/AI-Research-SKILLs / 10-optimization/gptq
gptq
VerifiedPost-training 4-bit quantization for LLMs with minimal accuracy loss. Use for deploying large models (70B, 405B) on consumer GPUs, when you need 4× memory reduction with <2% perplexity degradation, or for faster inference (3-4× speedup) vs FP16. Integrates with transformers and PEFT for QLoRA fine-tuning.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.3 KB |
| references/calibration.md | markdown | 8.0 KB |
| references/integration.md | markdown | 2.7 KB |
| references/troubleshooting.md | markdown | 1.9 KB |
references/troubleshooting.md
View on GitHub# GPTQ Troubleshooting Guide
Common issues and solutions for GPTQ quantization and inference.
## Installation Issues
### CUDA mismatch
```bash
# Check CUDA version
nvcc --version
python -c "import torch; print(torch.version.cuda)"
# Install matching version
pip install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # CUDA 11.8
```
### Build errors
```bash
# Install build dependencies
pip install auto-gptq --no-build-isolation
# On Ubuntu
sudo apt-get install python3-dev
```
## Runtime Issues
### Slow inference
```python
# Try different backends
model = AutoGPTQForCausalLM.from_quantized(
model_name,
use_exllama=True # Fastest (try v1 or v2)
)
# Or Marlin (Ampere+ GPUs)
model = AutoGPTQForCausalLM.from_quantized(
model_name,
use_marlin=True
)
```
### OOM during inference
```python
# Reduce batch size
outputs = model.generate(**inputs, batch_size=1)
# Use CPU offloading
model = AutoGPTQForCausalLM.from_quantized(
model_name,
device_map="auto",
max_memory={"cpu": "100GB"}
)
# Reduce context
model.seqlen = 1024 # Instead of 2048
```
### Poor quality outputs
```python
# Requantize with better calibration
# 1. Use more samples (256 instead of 128)
# 2. Use domain-specific data
# 3. Lower dampening: damp_percent=0.005
# 4. Enable desc_act=True
```
## Quantization Issues
### Very slow quantization
```bash
# Expected times (7B model):
# - A100: 10-15 min
# - RTX 4090: 20-30 min
# - CPU: 2-4 hours
# Speed up:
# 1. Use GPU
# 2. Reduce samples (64 instead of 256)
# 3. Disable desc_act
# 4. Use multi-GPU
```
### Quantization crashes
```python
# Reduce memory usage
model = AutoGPTQForCausalLM.from_pretrained(
model_name,
device_map="auto",
max_memory={"cpu": "100GB"} # Offload to CPU
)
# Or quantize layer-by-layer (slower but works)
model.quantize(calibration_data, batch_size=1)
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |