Thank you for your interest in contributing to tqai! This guide explains how to get involved.
Open an issue on GitHub Issues with:
- A clear, descriptive title
- Steps to reproduce the problem
- Expected vs actual behavior
- tqai version (
tqai info), OS, Python version - Model ID and backend (torch/mlx) you were using
- Fork the repository on GitHub
- Branch from
main— use a descriptive name (e.g.,fix/dtype-mismatch,feat/bit-packing) - Develop your changes following the code style guidelines below
- Test your changes (see Testing section)
- Submit a PR against
mainwith a clear description of what and why
Keep PRs focused on a single concern. If you have multiple unrelated changes, submit separate PRs.
- Linting: Run
ruff check .before committing - Formatting: Follow PEP 8, 100-char line length
- Imports: Sorted by ruff (isort compatible)
- Types: Use type hints for public API functions
All commits must include a Developer Certificate of Origin sign-off line:
Signed-off-by: Your Name <your@email.com>
Add this automatically with:
git commit -s -m "Your commit message"This certifies that you wrote or have the right to submit the code under the project's license. See developercertificate.org for the full text.
Before submitting a PR, run the test suite:
# Install dev dependencies
pip install -e ".[dev]"
# Run unit + accuracy tests
pytest tests/ --ignore=tests/test_e2e_models.py --ignore=tests/test_e2e_large_models.py
# Run linter
ruff check .For changes to the quantizer or cache, also run the accuracy tests:
pytest tests/test_accuracy.py -vIf you need codebooks for a head dimension not in {64, 96, 128, 256}:
pip install tqai[codegen]
python scripts/generate_codebooks.pysrc/tqai/quantizer.py— Core PolarQuantizer algorithmsrc/tqai/backend/— PyTorch + MLX abstraction (Protocol-based)src/tqai/codebook/— Lloyd-Max codebook generation and loadingsrc/tqai/cache/— HuggingFace and mlx-lm cache wrapperssrc/tqai/cli.py— CLI toolsrc/tqai/convert.py— Offline model conversion
By contributing to tqai, you agree that your contributions will be licensed under the MIT License.