Download src/mlx_ternary/__init__.py from Jakevin/mlx-ternary: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/Jakevin/mlx-ternary/resolve/main/src/mlx_ternary/__init__.py
- Command line
-
hf download hf://Jakevin/mlx-ternary/src/mlx_ternary/__init__.py
-
curl -L -o __init__.py https://huggingface.co/Jakevin/mlx-ternary/resolve/main/src/mlx_ternary/__init__.py
1 kB
| # 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", | |
| ] | |