File size: 1,897 Bytes
9c41926
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import torch
from typing import Dict, Optional, List
from .Sub1BitLLM import Sub1BitLLM, Sub1BitConfig, from_fp16
from .lowrank_factorization import low_rank_factorize, factorize_model_weights, compute_optimal_rank
from .quantization import (
    ternary_quantize, ternary_pack, ternary_unpack,
    sigma_quantize, sigma_dequantize,
    quantize_factor, pack_factor, unpack_factor, dequantize_factor,
)
from .groupwise_int4 import (
    dequantize_groupwise_int4,
    estimate_groupwise_int4_bpw,
    pack_signed_int4,
    quantize_groupwise_int4,
    unpack_signed_int4,
)
from .mixed_budget import allocate_mixed_budget, summarize_allocation
from .error_budget_residual import (
    dequantize_binary_residual,
    dequantize_error_budget_residual,
    estimate_binary_residual_bpw,
    estimate_error_budget_residual_bpw,
    quantize_binary_residual,
    quantize_error_budget_residual,
)
from .gguf_writer import GGUFWriter, GGML_TYPES, GGUF_TYPES
from .pack_gguf import pack_sub1bit_model, QuantizedLayer

__all__ = [
    "Sub1BitLLM",
    "Sub1BitConfig",
    "from_fp16",
    "low_rank_factorize",
    "factorize_model_weights",
    "compute_optimal_rank",
    "ternary_quantize",
    "ternary_pack",
    "ternary_unpack",
    "sigma_quantize",
    "sigma_dequantize",
    "quantize_factor",
    "pack_factor",
    "unpack_factor",
    "dequantize_factor",
    "dequantize_groupwise_int4",
    "estimate_groupwise_int4_bpw",
    "pack_signed_int4",
    "quantize_groupwise_int4",
    "unpack_signed_int4",
    "allocate_mixed_budget",
    "summarize_allocation",
    "dequantize_binary_residual",
    "dequantize_error_budget_residual",
    "estimate_binary_residual_bpw",
    "estimate_error_budget_residual_bpw",
    "quantize_binary_residual",
    "quantize_error_budget_residual",
    "GGUFWriter",
    "GGML_TYPES",
    "GGUF_TYPES",
    "pack_sub1bit_model",
    "QuantizedLayer",
]