--- license: apache-2.0 language: - en library_name: transformers pipeline_tag: text-generation tags: - text-generation-inference --- # GPTQ Algorithm with `auto-gptq` Integration ## Model Description The GPTQ algorithm, developed by Frantar et al., is designed to compress transformer-based language models into fewer bits with minimal performance degradation. The `auto-gptq` library, based on the GPTQ algorithm, has been seamlessly integrated into the 🤗 transformers, enabling users to load and work with models quantized using the GPTQ algorithm. ## Features - **Quantization**: Compress transformer-based language models with minimal performance loss. - **Integration with 🤗 transformers**: Directly load models quantized with the GPTQ algorithm. - **Flexibility**: Offers two scenarios for users: 1. Quantize a language model from scratch. 2. Load a pre-quantized model from the 🤗 Hub. - **Calibration**: Uses model inference to calibrate the quantized weights, ensuring optimal performance. - **Custom Dataset Support**: Users can quantize models using either a supported dataset or a custom dataset. ## Intended Use This integration is intended for users who want to compress their transformer-based language models without significant performance loss. It's especially useful for deployment scenarios where model size is a constraint. ## Limitations and Considerations - The quality of quantization may vary based on the dataset used for calibration. It's recommended to use a dataset closely related to the model's domain for best results. - While the GPTQ algorithm minimizes performance degradation, some loss in performance is expected, especially at lower bit quantizations. ## Training Data The GPTQ algorithm requires calibration data for optimal quantization. Users can either use supported datasets like "c4", "wikitext2", etc., or provide a custom dataset for calibration. ## Evaluation Results Performance after quantization may vary based on the dataset used for calibration and the bit precision chosen for quantization. It's recommended to evaluate the quantized model on relevant tasks to ensure it meets the desired performance criteria. ## References - Frantar et al., "GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers" - [AutoGPTQ GitHub Repository](https://github.com/PanQiWei/AutoGPTQ)