Implementing auto adpq
Project description
auto_adpq
Adaptive Post-Training Quantization tooling (replicating AdpQ)
This repository implements tools and reference code to reproduce the ideas from AdpQ: A Zero-shot Calibration Free Adaptive Post Training Quantization Method for LLMs.
This README explains how to install, run tests, build documentation (including multi-version docs), and contribute.
Installation
Install from PyPI (recommended):
python -m pip install auto_adpq
Install the latest development version directly from GitHub:
python -m pip install "git+https://github.com/Tfloow/auto_adpq.git"
To develop locally (editable install):
git clone https://github.com/Tfloow/auto_adpq.git
cd auto_adpq
python -m pip install -e .
Makefile helper:
# Run formatting, linting, coverage and docs targets as defined in Makefile
make
Quick usage
Import the package and use the public API. Example (replace with real API):
from auto_adpq import Auto_AdpQ
Add a short usage snippet here specific to the package functions you expect users to try first.
Running tests & linters
Coverage test: 91%
- Run tests with pytest:
pytest -q
- Run full coverage report (Makefile target):
make coverage
- Format & lint with
ruff(Makefile target):
make ruff
Debug mode
To obtain logs of the package, it is possible to enable the logging module. To activate it please create the new environment variable AUTO_ADPQ_DEBUG by running:
# Linux
export AUTO_ADPQ_DEBUG=1
# Windows
$Env:AUTO_ADPQ_DEBUG = 1
Documentation
The documentation can be found here.
Building the documentation
This project uses Sphinx for documentation. There are two common workflows:
- Build a single-version site (useful for local writing and previews):
python -m pip install -r docs/requirements.txt
python -m sphinx -b html docs docs/_build/html
- Build a multi-version site using
sphinx-multiversion(we configure this indocs/conf.py). This produces one static site containing each built branch and tag (useful for publishing versioned docs with a dropdown selector):
python -m pip install -r docs/requirements.txt
sphinx-multiversion docs docs/_build/html-mv
Notes about versions
- The project includes a small template
docs/_templates/versions.htmlwhich renders a versions dropdown when the site is built withsphinx-multiversion. - Adjust
smv_tag_whitelistandsmv_branch_whitelistindocs/conf.pyto control which tags/branches are included in the build.
Tasklist
- Optimize pydantic module
AdpQQuantizedWeights- Currently, there is a major overhead when creating a new object to validate the field. Since it is used internally only, we could ditch the Pydantic module but would need to ensure proper dump and load function
- Support model and integrate with
.safetensors
Contributing
Contributions are welcome. A suggested workflow:
- Fork the repository and create a feature branch.
- Add tests for new functionality.
- Run
ruffto format and lint. - Open a pull request describing the change.
Please include unit tests and keep the public API stable when possible.
Development notes
- Docs templates:
docs/_templates/versions.html— version switcher used bysphinx-multiversion. - Makefile targets:
make ruff,make coverage,make docs(runs single and multiversion builds).
License
This work is under Apache 2.0 License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_adpq-0.3.3.tar.gz.
File metadata
- Download URL: auto_adpq-0.3.3.tar.gz
- Upload date:
- Size: 22.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7869c99b1aaa4728ace10895249850f4a3d70d872ab7b20d66f6f35e306b6c2c
|
|
| MD5 |
336b6bc885e299c8f2ac128504ab4598
|
|
| BLAKE2b-256 |
d333ed7722b1c63df29c02ff6562e35522c97d8b35c7581f71fcb864e71b66b2
|
File details
Details for the file auto_adpq-0.3.3-py3-none-any.whl.
File metadata
- Download URL: auto_adpq-0.3.3-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9dfbe7137b0535f20f3340de69f750a92cce90c57005f8a2a3333a0a4798d16
|
|
| MD5 |
bd8f387c5bced9b87fd1e678786b21f3
|
|
| BLAKE2b-256 |
7a1708b240ed2c6cd0462fb8d34e631d7498d7976464ee6977b3db5f7fbee943
|