models: BEVFusion export fusion + head correctness (permanent work, not parking) - #25
Draft
vividf wants to merge 1 commit into
Draft
models: BEVFusion export fusion + head correctness (permanent work, not parking)#25vividf wants to merge 1 commit into
vividf wants to merge 1 commit into
Conversation
…rking) BN fold for the sparse encoder's export copy, fusion-ready attention export for the TransFusion head (Myelin MHA: 0.25 ms fused vs 0.68 unfused), and the velocity-loss masking fix with its test. This work survives any replacement of the model bodies in pr1/pr2 - which is why it is its own PR and not part of the parking commit. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Sep 7, 2026
Draft
Draft
quant: declarative quantization (plan/placement, modelopt engine, PTQ/QAT, self-describing ckpt)
#17
Draft
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 是什麼(以及為什麼從 parking 拆出來)
BEVFusion 的 export fusion 與 head 正確性工作——永久資產。原本混在 #11(parking),review 時抓出:這些工作不會隨模型本體被替換——換了別人的 multitask 之後,BN fold、fused-MHA export、velocity-loss 修正照樣要在,埋在會被整塊丟掉的 parking 裡等於預約遺失。因此獨立成 PR。
逐檔導覽
models/detection3d/encoders/sparse.py(+66):_fuse_sparse_convolution_bn:在 export 副本上把每對相鄰(sparse conv, BatchNorm1d)fold 掉(用 spconv 的fuse_spconv_bn_eval)——fold 必須發生在 export wrapper 建構之前,wrapper 才會帶著 fold 產生的 bias。部署圖無 BN、訓練 encoder 保留 BN。_convert_sparse_convolution(do_sort):export 轉換帶 serialization order 參數。models/detection3d/heads/transfusion.py(+158):fuse_export_attention:export 產出 fusion-ready 的 attention 形式——不擋 TensorRT Myelin 的 MHA 融合(實測 fused 0.25 ms vs unfused 0.68 ms @ j6gen2 dense 圖)。shared_conv_norm_act:shared conv 的 conv(no bias)+BN+ReLU 形式(否則 BN+ReLU 會 clip 掉約一半 shared-feature 能量——註解載明)。nan*0還是nan,target 也要歸零(與 CenterHead.loss 同慣例)。tests/models/test_bevfusion_sparse.py:BN fold 數值斷言(fold_scale 沿 dim0、expected_weight 逐元素)。tests/models/test_transfusion.py(+98):velocity masking 測試。檔案清單(點開)
Review checklist
🤖 Generated with Claude Code