Skip to content

Commit 113ef13

Browse files
committed
[misc] QAT finetune: preflight-probe the fake-quant train kernel
is_attn_qat_train_available() swallows the ImportError and the selector then filters ATTN_QAT_TRAIN out silently, so attention falls back to Flash (non-QAT) BEFORE the cuda.py hard-fail guard fires. Add a preflight that imports fastvideo_kernel.triton_kernels.attn_qat_train with the real traceback and aborts if it's missing — no more silent non-QAT runs.
1 parent 175bc4b commit 113ef13

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

examples/training/finetune/wan_t2v_1.3B/mixkit/run_qat_finetune.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ if [ ! -d "${DATA_DIR}" ]; then
4242
--local_dir "${DATA_ROOT}" --repo_type "dataset"
4343
fi
4444

45+
# 1b. PREFLIGHT — the fake-quant train kernel must actually import, else the
46+
# selector silently filters ATTN_QAT_TRAIN and attention falls back to Flash
47+
# (a NON-QAT run) upstream of the cuda.py hard-fail guard. Surface the real
48+
# error and refuse to proceed rather than waste a run.
49+
echo "[qat] preflight: importing fastvideo_kernel.triton_kernels.attn_qat_train ..."
50+
python - <<'PY' || { echo "[qat] PREFLIGHT FAILED — attn_qat_train kernel not importable; aborting (would train NON-QAT)."; exit 3; }
51+
import importlib, sys, traceback
52+
sys.path.insert(0, "fastvideo-kernel/python")
53+
sys.path.insert(0, "fastvideo-kernel")
54+
try:
55+
m = importlib.import_module("fastvideo_kernel.triton_kernels.attn_qat_train")
56+
_ = m.attention
57+
print("[qat] preflight OK: attn_qat_train.attention importable")
58+
except Exception:
59+
traceback.print_exc()
60+
sys.exit(1)
61+
PY
62+
4563
# 2. Train — identical hyperparams to finetune_qat.sh (LR 5e-5, wd 1e-4,
4664
# grad-norm 1.0, bf16 + fp32 master, cfg-rate 0.1, 50 euler timesteps).
4765
torchrun --nnodes 1 --nproc_per_node "${NUM_GPUS}" \

0 commit comments

Comments
 (0)