#!/usr/bin/env bash set -euo pipefail # Quantize Reka yasa2 mmproj F16 -> mostly Q8_0. Some tensors (patch embed, depthwise, down conv) # cannot use Q8_0 when ncols is not divisible by 32; those stay F16 (same approach as a full Q8_0 run). # # Usage: ./scripts/quantize_reka_mmproj_q8.sh [INPUT_F16_GGUF] [OUTPUT_GGUF] # Optional: QUANTIZE_BIN (default: build_linux/bin or build/bin llama-quantize) SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" cd "$REPO_ROOT" INPUT_GGUF="${1:-}" OUTPUT_GGUF="${2:-}" THREADS="${THREADS:-16}" if [[ -z "$INPUT_GGUF" || -z "$OUTPUT_GGUF" ]]; then echo "Usage: $0 " >&2 exit 1 fi if [[ -z "${QUANTIZE_BIN:-}" ]]; then if [[ -x "$REPO_ROOT/build_linux/bin/llama-quantize" ]]; then QUANTIZE_BIN="$REPO_ROOT/build_linux/bin/llama-quantize" else QUANTIZE_BIN="$REPO_ROOT/build/bin/llama-quantize" fi fi "$QUANTIZE_BIN" \ --tensor-type 'patch_embd=f16' \ --tensor-type '.*\.dw\.weight=f16' \ --tensor-type '.*down\.conv\.weight=f16' \ "$INPUT_GGUF" \ "$OUTPUT_GGUF" \ Q8_0 \ "$THREADS"