File size: 1,004 Bytes
6154ddb d3c3658 8e6dc72 d3c3658 6154ddb 8e6dc72 6154ddb 8e6dc72 6154ddb | 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 | # Copyright 2026 Jakevin
# SPDX-License-Identifier: Apache-2.0
"""Ternary linear layers for MLX.
Ternary carries about 1.85 bits of information per weight; it is stored
in 2-bit slots, so the resident size is 2.25 bits at group 64, the same as MLX 2-bit,
or 2.125 bits with the group 128 option.
"""
from mlx_ternary.convert import from_mlx_2bit, unpack_mlx_2bit
from mlx_ternary.kernel import configure, set_cache_limit, tern_matmul
from mlx_ternary.linear import TernaryLinear, replace_quantized_linears
from mlx_ternary.pack import (
GROUP,
GROUPS,
dequantize,
info_bits_per_weight,
pack_trits,
stored_bits_per_weight,
unpack_trits,
)
__version__ = "0.3.0"
__all__ = [
"GROUP",
"GROUPS",
"TernaryLinear",
"configure",
"dequantize",
"from_mlx_2bit",
"info_bits_per_weight",
"pack_trits",
"replace_quantized_linears",
"set_cache_limit",
"stored_bits_per_weight",
"tern_matmul",
"unpack_mlx_2bit",
"unpack_trits",
]
|