A Python-based utility for quantizing GPT models using the Hugging Face 'transformers' library.
This repository provides a Python script to quantize models with the Hugging Face 'transformers' and AutoGPTQ for 4 or 8 bit. Quantization can reduce the memory requirements of models, which may be beneficial for deployment on resource-constrained devices.
To utilize this utility, ensure that you've installed the dependencies listed in the requirements.txt file. You can install these using pip:
pip install -r requirements.txt
You can run the script in two ways:
4wikitext2128"auto"Using hardcoded values:
MODEL_ID, BITS, DATASET, GROUP_SIZE, and DEVICE_MAP at the top of the script.Using command-line arguments:
python quantize.py --model_id 'teknium/openhermes' --bits 8 --dataset 'wikitext2' --group_size 32 --device_map 'auto'
Note: Command-line arguments will take precedence over hardcoded values.
Ensure you have the necessary dependencies by checking the requirements.txt in this repo. Install them via:
pip install -r requirements.txt
Feel free to contribute to this project by creating issues or submitting pull requests. Ensure that your contributions are in line with the project's aim and structure.
This project is open source, under the MIT license.
8 commits
Python
100.0%
A Python-based utility for quantizing GPT models using the Hugging Face 'transformers' library.
This repository provides a Python script to quantize models with the Hugging Face 'transformers' and AutoGPTQ for 4 or 8 bit. Quantization can reduce the memory requirements of models, which may be beneficial for deployment on resource-constrained devices.
To utilize this utility, ensure that you've installed the dependencies listed in the requirements.txt file. You can install these using pip:
pip install -r requirements.txt
You can run the script in two ways:
4wikitext2128"auto"Using hardcoded values:
MODEL_ID, BITS, DATASET, GROUP_SIZE, and DEVICE_MAP at the top of the script.Using command-line arguments:
python quantize.py --model_id 'teknium/openhermes' --bits 8 --dataset 'wikitext2' --group_size 32 --device_map 'auto'
Note: Command-line arguments will take precedence over hardcoded values.
Ensure you have the necessary dependencies by checking the requirements.txt in this repo. Install them via:
pip install -r requirements.txt
Feel free to contribute to this project by creating issues or submitting pull requests. Ensure that your contributions are in line with the project's aim and structure.
This project is open source, under the MIT license.
8 commits
Python
100.0%