| # Quantize Qwen/Qwen3-32B into 4 schemes, one at a time, upload each, then | |
| # delete the local checkpoint. Disk is 500GB and two 97GB GPUs are available, | |
| # so we shard the model across both GPUs (device_map="auto", no CPU offload) | |
| # and run the full-quality calibration footprint. The base stays cached across | |
| # schemes (no re-download). | |
| MODEL="Qwen/Qwen3-32B" | |
| PY="/home/vllm_env/bin/python" | |
| CALIB_SAMPLES=512 | |
| CALIB_SEQLEN=2048 | |
| cd /home | |
| # Make both GPUs visible for model sharding. | |
| export CUDA_VISIBLE_DEVICES=0,1 | |
| # shellcheck disable=SC1091 | |
| source /home/vllm_env/bin/activate | |
| # Reduce CUDA fragmentation during calibration. Auth uses the persisted HF | |
| # credential file (~/.cache/huggingface/token), so no env token is required. | |
| export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
| run() { | |
| local scheme="$1"; shift | |
| echo "===== START ${scheme} $(date) =====" | |
| "${PY}" quantize_my_model.py \ | |
| --scheme "${scheme}" \ | |
| --model-id "${MODEL}" \ | |
| --num-calibration-samples "${CALIB_SAMPLES}" \ | |
| --max-seq-length "${CALIB_SEQLEN}" \ | |
| --upload-to-hub \ | |
| --delete-local-after-upload \ | |
| "$@" \ | |
| && echo "===== OK ${scheme} $(date) =====" \ | |
| || echo "!!!!! FAILED ${scheme} $(date) !!!!!" | |
| echo "--- disk after ${scheme} ---"; df -h /home | |
| } | |
| run nvfp4 | |
| run mxfp4 | |
| run fp8 | |
| run mxfp8 | |
| echo "ALL DONE $(date)" | |