Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

license apache-2.0

ICME 2026 Grand Challenge β€” Sub-Challenge 2: Video Generation Quantization

Post-training quantization (PTQ) and quantization-aware training (QAT) for Wan2.1-T2V-14B using W8A8 HiFloat8, targeting the VBench evaluation criteria.


Environment

Item Details
Hardware Huawei Ascend 910B (64 GB HBM per card)
OS Linux aarch64
Python 3.10
PyTorch 2.1 + torch_npu
Ascend toolkit 8.2.RC1
Model Wan2.1-T2V-14B
Quantization format HiFloat8 (HiF8) W8A8

Dependencies

external/Wan2.1/        # Wan2.1 model code
external/HiFloat8/      # HiF8 quantization kernels (hif8_npu)
external/VBench/        # VBench evaluation framework

Set up the environment before running any script:

source /usr/local/Ascend/ascend-toolkit/set_env.sh
source /path/to/.venv/bin/activate
export PYTHONPATH=external/Wan2.1:external/HiFloat8/hif8_npu:external/VBench:$PYTHONPATH

Evaluation Prompts

Five prompts, seeds 42–46 (seed = 42 + index):

Index Seed Prompt
0 42 A majestic eagle soaring over snow-capped mountains at golden hour
1 43 Ocean waves crashing on a rocky shore at sunset, foam and mist
2 44 A bustling city street at night with neon lights and rain reflections
3 45 A field of sunflowers swaying gently in the breeze on a sunny day
4 46 A brown bear fishing for salmon in a rushing mountain stream

Resolution: 832Γ—480, 49 frames, 50 denoising steps, guide_scale=6.0.


Scripts

generate.py β€” inference

python3 generate.py \
  --ckpt-dir <checkpoint_dir> \
  --model-size 14B \
  --protected-blocks 0 1 37 38 39 \
  --output-dir outputs/ptq_eval \
  --size 832*480 --frame-num 49 --sample-steps 50 --seed 42 \
  --prompts "prompt 0" "prompt 1" ...

Key flags:

  • --no-quant β€” BF16 baseline, skip quantization
  • --qat-weights <file.pt> β€” load QAT fine-tuned weights
  • --start-index N β€” offset output file index and seed (used to resume partial runs)

train_qat_single.py β€” QAT fine-tuning (single NPU)

python3 train_qat_single.py \
  --ckpt-dir <checkpoint_dir> \
  --metadata data/metadata_training.json \
  --protected-blocks 0 1 37 38 39 \
  --finetune-blocks 2 3 4 \
  --steps 1000 --lr 5e-5 --grad-accum 8

Quantizes all non-protected blocks, but only fine-tunes --finetune-blocks to keep Adam optimizer states within HBM budget. Requires precomputed latents (see below).

precompute_latents.py β€” precompute training latents

Encodes training videos with the VAE and T5; saves {z0, ctx, caption} per sample to data/latents/. Edit the hardcoded CKPT, META, OUT paths at the top before running.

analyze_activations.py β€” block-wise activation analysis

python3 analyze_activations.py --ckpt-dir <checkpoint_dir> --device 0 --steps 3

Hooks all 40 WanAttentionBlocks during a short BF16 forward pass, records max-abs / std / kurtosis / p99 per block, and saves a bar chart to outputs/activation_stats.png.

vbench_single.py β€” per-video VBench evaluation

python3 vbench_single.py \
  --video outputs/ptq_eval/video_000.mp4 \
  --name ptq_v000 \
  --device npu:0 \
  --cache-dir ~/.cache/vbench \
  --output-dir outputs/vbench_results

Evaluates four VBench dimensions: temporal_flickering, aesthetic_quality, imaging_quality, background_consistency.


Results Summary

VBench scores averaged over 5 videos:

Dimension BF16 PTQ W8A8 HiF8 QAT W8A8 HiF8
temporal_flickering 97.26% 97.84% 99.19%
aesthetic_quality 67.43% 70.01% 68.01%
imaging_quality 65.41 67.03 60.17
background_consistency 97.14% 98.29% 98.36%

Protected blocks (kept in BF16): [0, 1, 37, 38, 39] (first two and last three transformer blocks).

Submitted method: PTQ W8A8 HiF8 β€” improves over BF16 baseline on all four dimensions with no fine-tuning required.

About

πŸ₯‡ 1st place (W8A8 Training track), IEEE ICME 2026 Low-bit LLM Quantization Challenge β€” Boundary-Protection W8A8 HiFloat8 quantization for Wan2.1-T2V-14B

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages