MCPcopy Create free account
hub / github.com/evilsocket/cake / detect_quantization

Function detect_quantization

cake-core/src/utils/mod.rs:128–139  ·  view source on GitHub ↗

Detect quantization strategy from a model's config.json.

(config_path: &Path)

Source from the content-addressed store, hash-verified

126
127/// Detect quantization strategy from a model's config.json.
128pub fn detect_quantization(config_path: &Path) -> Box<dyn Quantization> {
129 if fp8::is_fp8_quantized(config_path) {
130 log::info!("model uses FP8 quantization — weights will be dequantized at load time");
131 Box::new(Fp8Quantization)
132 } else if gptq::is_gptq_quantized(config_path) {
133 let gs = gptq::gptq_group_size(config_path);
134 log::info!("model uses GPTQ quantization (group_size={gs}) — weights will be dequantized at load time");
135 Box::new(GptqQuantization { group_size: gs })
136 } else {
137 Box::new(NoQuantization)
138 }
139}
140
141// ─── End quantization trait ──────────────────────────────────────────────────
142

Callers 5

from_argsMethod · 0.85
master_setupFunction · 0.85

Calls 3

is_fp8_quantizedFunction · 0.85
is_gptq_quantizedFunction · 0.85
gptq_group_sizeFunction · 0.85