#!/usr/bin/env bash # Two NVFP4A16 quants, 2026-09-10. Operator: "run our own quant. w4a16 vllm # servable, vision towers intact, mtp if applicable." # W4A16 -> --scheme NVFP4A16 (weight-only, NOT plain NVFP4/W4A4) # vision intact -> recipe ignore-list keeps vision/audio towers BF16 # MTP -> N/A: verified 0 mtp tensors in BOTH bf16 sources # GPU1 not GPU0: the script onloads one layer at a time (GPU-light) but its own # docstring warns of OOM when the card is not fairly free. GPU0 has 4.6 GiB spare # (gen + mog-sec resident); GPU1 has ~19.3 GiB. set -uo pipefail WORK=/tank/aimodels/meromero-v2-nvfp4-work CALIB=/tank/aimodels/heretic2-nvfp4-work/production_calib_512.jsonl exec >> /home/infra-ops/quant/batch.log 2>&1 run_one () { local name="$1" src="$2" out="$3" echo "=== $(date -Is) START $name -> $out" docker rm -f meromero-quant >/dev/null 2>&1 docker run --rm --name meromero-quant --gpus '"device=1"' --ipc host \ -e PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True \ -v /tank/aimodels:/tank/aimodels \ --entrypoint bash vllm/vllm-openai:latest -c " set -e pip install -q llmcompressor==0.13.0 tiktoken sentencepiece 2>&1 | tail -1 python3 $WORK/quant_nvfp4_gemma.py \ --model '$src' --calib '$CALIB' \ --num-samples 512 --seqlen 8192 --scheme NVFP4A16 \ --out '$out' " local rc=$? echo "=== $(date -Is) END $name rc=$rc size=$(du -sh "$out" 2>/dev/null | cut -f1)" } run_one A4B-heretic \ /tank/aimodels/G4-MeroMero-26B-A4B-it-uncensored-heretic-bf16 \ /tank/aimodels/G4-MeroMero-26B-A4B-it-uncensored-heretic-NVFP4A16 run_one v2-31B-heretic \ /tank/aimodels/G4-MeroMero-v2-31B-heretic-bf16 \ /tank/aimodels/G4-MeroMero-v2-31B-heretic-NVFP4A16 echo "=== $(date -Is) BATCH DONE"