Skip to main content

INT4 quantization tooling and CUDA extension

Project description

qgemm

Scaffold for INT4 weight quantization utilities and future CUDA/C++ extensions.

  • CPU/Python quantization utilities in python/quantize.py
  • LLaMA converter to INT4 safetensors in python/convert_llama.py
  • Weight format documented in docs/weight_format.md
  • Packaging via pyproject.toml and wired CUDA extension in setup.py

Build the CUDA/C++ extension (Phase 3)

  • Prereqs: PyTorch with CUDA, a CUDA toolkit (nvcc), a GPU with sm80+.
  • Via pip/setuptools (in-place build):
    • QGEMM_BUILD_EXT=1 TORCH_CUDA_ARCH_LIST=80 pip install -e .
    • or set custom arches: QGEMM_CUDA_ARCHS="80,90" pip install -e .
  • After install, importing qgemm will auto-register torch.ops.qgemm.*.

Build with CMake

  • cmake -S . -B build -DCMAKE_CUDA_ARCHITECTURES=80
  • cmake --build build -j
  • Load the produced libqgemm_ops.so using torch.ops.load_library if using outside the package.

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

qgemm-0.0.2.tar.gz (25.2 kB view details)

Uploaded Source

File details

Details for the file qgemm-0.0.2.tar.gz.

File metadata

  • Download URL: qgemm-0.0.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for qgemm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 db6d0d647a7cd6b4289ed69d4c68ae54161533b94c08503dafe7a54147d97c91
MD5 940ebd4b3d9acc9bf8d99d8ed998046f
BLAKE2b-256 c575d0d8f58ffbf181d03f7bbe118188d8c6e14e6485579ea03edecb80d580bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page