ternary-quant 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ternary_quant/__init__.py +58 -0
- ternary_quant/cli.py +1872 -0
- ternary_quant/conditional_experts.py +1171 -0
- ternary_quant/cuda_kernels.py +751 -0
- ternary_quant/data.py +87 -0
- ternary_quant/eval.py +494 -0
- ternary_quant/generative_adapters.py +1139 -0
- ternary_quant/inference.py +1416 -0
- ternary_quant/mac_kernels.py +817 -0
- ternary_quant/pipeline.py +465 -0
- ternary_quant/ptq_families.py +571 -0
- ternary_quant/quantizer.py +7 -0
- ternary_quant/quantizer_experimental.py +395 -0
- ternary_quant/quantizer_groupwise.py +2156 -0
- ternary_quant/quantizer_perrow.py +366 -0
- ternary_quant/quantizer_small.py +7 -0
- ternary_quant/quantizer_v2.py +7 -0
- ternary_quant/storage.py +613 -0
- ternary_quant/toolkit.py +308 -0
- ternary_quant/vllm_backend.py +227 -0
- ternary_quant-0.1.6.dist-info/METADATA +214 -0
- ternary_quant-0.1.6.dist-info/RECORD +26 -0
- ternary_quant-0.1.6.dist-info/WHEEL +5 -0
- ternary_quant-0.1.6.dist-info/entry_points.txt +2 -0
- ternary_quant-0.1.6.dist-info/licenses/LICENSE +184 -0
- ternary_quant-0.1.6.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Post-training ternary quantization for HuggingFace LLMs."""
|
|
2
|
+
|
|
3
|
+
from ternary_quant.quantizer_perrow import TernaryQuantizer
|
|
4
|
+
from ternary_quant.pipeline import quantize_model
|
|
5
|
+
from ternary_quant.inference import (
|
|
6
|
+
TernaryLinear,
|
|
7
|
+
clear_quantized_runtime_cache,
|
|
8
|
+
load_ternary_model,
|
|
9
|
+
prepare_quantized_runtime,
|
|
10
|
+
)
|
|
11
|
+
from ternary_quant.generative_adapters import (
|
|
12
|
+
BroadQuantizationConfig,
|
|
13
|
+
build_calibration_batches,
|
|
14
|
+
generative_model_info_to_dict,
|
|
15
|
+
inspect_generative_model,
|
|
16
|
+
load_generative_model,
|
|
17
|
+
quantize_components_inplace,
|
|
18
|
+
)
|
|
19
|
+
from ternary_quant.mac_kernels import metal_ternary_kernels_available
|
|
20
|
+
from ternary_quant.quantizer_groupwise import (
|
|
21
|
+
GroupwiseAsymmetricTernaryQuantizer,
|
|
22
|
+
build_role_aware_plan,
|
|
23
|
+
quantize_small_model_inplace,
|
|
24
|
+
)
|
|
25
|
+
from ternary_quant.ptq_families import (
|
|
26
|
+
ProgressiveTritPlaneQuantizer,
|
|
27
|
+
TritPlaneParameter,
|
|
28
|
+
build_family_config,
|
|
29
|
+
get_default_family_candidates,
|
|
30
|
+
quantize_family_inplace,
|
|
31
|
+
summarize_family_quantization,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
__version__ = "0.1.6"
|
|
35
|
+
__all__ = [
|
|
36
|
+
"TernaryQuantizer",
|
|
37
|
+
"quantize_model",
|
|
38
|
+
"GroupwiseAsymmetricTernaryQuantizer",
|
|
39
|
+
"ProgressiveTritPlaneQuantizer",
|
|
40
|
+
"TritPlaneParameter",
|
|
41
|
+
"build_role_aware_plan",
|
|
42
|
+
"quantize_small_model_inplace",
|
|
43
|
+
"build_family_config",
|
|
44
|
+
"get_default_family_candidates",
|
|
45
|
+
"quantize_family_inplace",
|
|
46
|
+
"summarize_family_quantization",
|
|
47
|
+
"BroadQuantizationConfig",
|
|
48
|
+
"inspect_generative_model",
|
|
49
|
+
"load_generative_model",
|
|
50
|
+
"build_calibration_batches",
|
|
51
|
+
"quantize_components_inplace",
|
|
52
|
+
"generative_model_info_to_dict",
|
|
53
|
+
"TernaryLinear",
|
|
54
|
+
"load_ternary_model",
|
|
55
|
+
"prepare_quantized_runtime",
|
|
56
|
+
"clear_quantized_runtime_cache",
|
|
57
|
+
"metal_ternary_kernels_available",
|
|
58
|
+
]
|