Skip to main content

Model Compression & Acceleration Module for sageLLM

Project description

sagellm-compression

CI PyPI version Python 3.10+ codecov

Model Compression & Acceleration Module for sageLLM inference engine.

Overview

This package provides model compression and acceleration techniques for LLM inference:

  • Quantization (Task3.1)
  • Sparsity (Task3.2)
  • Speculative decoding (Task3.3)
  • Kernel fusion (Task3.4)
  • CoT acceleration (Task3.5)

Installation

# 从 PyPI 安装(自动安装依赖)
pip install isagellm-compression

🚀 开发者快速开始

git clone git@github.com:intellistream/sagellm-compression.git
cd sagellm-compression
./quickstart.sh   # 一键安装开发环境(含依赖)

# 或手动安装
pip install -e ".[dev]"

运行测试:

pytest tests/ -v

💡 isagellm-protocolisagellm-backend 会自动从 PyPI 安装。

Quick Start

from sagellm_compression import QuantizationConfig, apply_quantization

# Apply INT8 quantization
config = QuantizationConfig(
    method="int8",
    per_channel=True
)
quantized_model = apply_quantization(model, config)

Team Assignment

  • Task3.1 Quantization: 项翔老师团队
  • Task3.2 Sparsity: 万瑶老师团队
  • Task3.3 Speculative Decoding: 张书豪老师团队
  • Task3.4 Kernel Fusion: 王雄老师团队
  • Task3.5 CoT Acceleration: 张书豪老师团队

Supported Techniques

Quantization

  • INT8/INT4 weight quantization
  • Per-channel/per-tensor quantization
  • Dynamic activation quantization

Sparsity

  • Structured pruning
  • Unstructured pruning
  • N:M sparsity

Acceleration

  • Speculative decoding with draft models
  • Kernel fusion (Flash Attention, etc.)
  • Chain-of-Thought acceleration

Dependencies

  • isagellm-protocol>=0.1.0 - Protocol definitions
  • isagellm-backend>=0.1.0 - Backend abstraction

Development

Quick Setup

# Install pre-commit hooks
pip install pre-commit
pre-commit install

# Run pre-commit manually
pre-commit run --all-files

Testing & Quality

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Format & lint (via pre-commit)
pre-commit run --all-files

# Or manually
ruff format .
ruff check .
mypy src/

Pre-commit Hooks

This project uses pre-commit hooks to ensure code quality:

  • ruff: Linting and auto-fixing
  • ruff-format: Code formatting
  • mypy: Type checking
  • Standard checks (trailing whitespace, YAML/TOML validation, etc.)

All code is automatically formatted on commit. To skip hooks temporarily:

git commit --no-verify

License

Private - IntelliStream Research Project

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isagellm_compression-0.1.0-cp311-none-any.whl (4.2 kB view details)

Uploaded CPython 3.11

File details

Details for the file isagellm_compression-0.1.0-cp311-none-any.whl.

File metadata

File hashes

Hashes for isagellm_compression-0.1.0-cp311-none-any.whl
Algorithm Hash digest
SHA256 c72d468b530478a5141cf7908ad3ac58c5f747c6d237648e1c456fe398a6b266
MD5 8864d6a17ea2d877a1ab8c63fb39d62b
BLAKE2b-256 7eadd079725e6487f3fa5a001800d996b1e9b7accafa9f69a6439d805f51154f

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