Skip to main content

teeny_quant/
lib.rs

1/*
2 * Copyright (c) 2026 Teenygrad.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *   http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//! Quantization tooling for [teenygrad](https://teenygrad.org): reads `.safetensors` model
18//! checkpoints and writes quantized `.safetensors` checkpoints following the
19//! [compressed-tensors](https://github.com/vllm-project/compressed-tensors) convention (see
20//! [`mod@format`]). Initially validated against Ultralytics YOLO models.
21//!
22//! Weight-only post-training quantization (INT8/INT4/FP8, [`quant`]) needs only the checkpoint
23//! itself and is what this crate supports today. Static activation quantization (calibrating
24//! from a forward pass over sample inputs) is tracked separately as `teenygrad-303.10` since it
25//! depends on running the model's ONNX export through `teeny-onnx`/`teeny-compiler`.
26
27#![warn(missing_docs)]
28
29pub mod cli;
30pub mod error;
31pub mod format;
32pub mod quant;
33pub mod read;
34pub mod validate;
35pub mod write;
36
37pub use error::{Error, Result};