#!/bin/bash

set -eu

Q="/mnt/workspace/llama.cpp/build/bin/llama-quantize"

quantize() {
    local bf16="$1" type="$2"
    local out="${bf16/-BF16.gguf/-${type}.gguf}"
    if [ -f "$out" ]; then
        echo "[Skip] $out"
    else
        $Q "$bf16" "$out" "$type"
    fi
}

# LM thinkers : full quant range (7.6B params tolerate Q4_K_M cleanly)
for bf16 in models/acestep-captioner-BF16.gguf models/acestep-transcriber-BF16.gguf; do
    for type in Q4_K_M Q5_K_M Q6_K Q8_0; do
        quantize "$bf16" "$type"
    done
done

# mmproj : stays BF16 (small encoder, quality matters for audio features)
