Skip to content

models: PTv3 onboarding (stage graph, seg3d export, INT8 QAT/FP8) - #23

Draft
vividf wants to merge 1 commit into
pr12-bevfusion-onboardingfrom
pr13-ptv3-onboarding
Draft

models: PTv3 onboarding (stage graph, seg3d export, INT8 QAT/FP8)#23
vividf wants to merge 1 commit into
pr12-bevfusion-onboardingfrom
pr13-ptv3-onboarding

Conversation

@vividf

@vividf vividf commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Stacked PR 14/15 — ⬅ #22 | #24

Stack(base pr-stack-base = 7e35d97):#11#12#13#14#15#16#17#18#19#20(CenterPoint 全功能點)→ #21#25#22#23#24(= 開發 branch HEAD,逐位元一致)。合併由下而上,每合一層把下一層 base retarget。

這個 PR 是什麼

PTv3 onboarding:onboarding 三連的第三次,唯一含「模型重寫層」的一個(export_modules)。

實測數字

形態 mIoU latency
FP16 0.7793 6.93 ms
INT8 PTQ(SmoothQuant) 0.7794(追平 FP16) ~7.0 ms
INT8 QAT 0.7339 7.02 ms
FP8 PTQ 0.7756

linear INT8 的教訓:直接量 linear 賠 6.4 mIoU → per-kind 宣告 + SmoothQuant recipe 解決。attention 內部(QK/AV matmul)不量:斷 TRT fused-MHA 反而 +0.3 ms。

逐檔導覽

  • main_modules/ptv3/export_modules.py:export 態的 attention / serialization 重寫(訓練態不動)——與 models: BEVFusion export fusion + head correctness (permanent work, not parking) #25 的 fused-MHA export 同哲學。數值等價性由兩層保證:stage 測試 + verification(pytorch vs onnx vs tensorrt 逐 tensor)。
  • main_modules/ptv3/stages.py:encoder(含 CPE plugin,torch_fallback_backends for ORT)+ seg3d_head 兩張圖的切界;serialized order/grid coord 經 StageContext 傳遞。
  • main_modules/ptv3/quantization.py:per-kind 宣告(conv INT8、linear FP8 或 SmoothQuant INT8)。
  • main_modules/ptv3/model.py:stage-graph 版模型類。
  • configs:base + FP16 / _int8 / _int8_qat / _fp8(tolerance observed 記在註解)。
  • 測試:test_ptv3_stagestest_verification_caveat(caveat 機制用 PTv3 情境測)。
檔案清單(點開)
.../configs/experiments/segmentation3d/__init__.py 0 
.../experiments/segmentation3d/ptv3/__init__.py 0 
.../experiments/segmentation3d/ptv3/base.yaml 144 ++++++
.../ptv3/voxel012_122m_t4dataset_j6gen2_base.yaml 255 ++++++++++
.../voxel012_122m_t4dataset_j6gen2_base_fp8.yaml 39 ++
.../voxel012_122m_t4dataset_j6gen2_base_int8.yaml 48 ++
...xel012_122m_t4dataset_j6gen2_base_int8_qat.yaml 32 ++
.../models/segmentation3d/main_modules/__init__.py 0 
.../segmentation3d/main_modules/ptv3/__init__.py 21 +
.../main_modules/ptv3/export_modules.py 517 +++++++++++++++++++++
.../segmentation3d/main_modules/ptv3/model.py 255 ++++++++++
.../main_modules/ptv3/quantization.py 56 +++
.../segmentation3d/main_modules/ptv3/stages.py 241 ++++++++++
autoware_ml/tests/deployment/test_ptv3_stages.py 100 ++++
.../tests/deployment/test_verification_caveat.py 75 +++

Review checklist

  • export_modules 與訓練態的等價性測試覆蓋(哪些重寫、各靠哪個測試)。
  • PTv3 INT8 QAT 是 fp16-typed Q/DQ NO-GO 的金絲雀圖(TRT NaN 缺陷首發處):precision pass 的任何行為變更都應拿它重測——寫在 config 或 README 的哪裡,review 確認找得到。
  • shuffle_orders 不確定性的處理(eval 重現性)。

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant