deploy: stage-graph foundation (GraphStage/TorchStage) + shared runtime utils - #13
Draft
vividf wants to merge 1 commit into
Draft
deploy: stage-graph foundation (GraphStage/TorchStage) + shared runtime utils#13vividf wants to merge 1 commit into
vividf wants to merge 1 commit into
Conversation
This was referenced Sep 5, 2026
…me utils Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
vividf
force-pushed
the
pr2-ptv3-model-parking
branch
from
September 7, 2026 05:23
5c6e004 to
46d96d7
Compare
vividf
force-pushed
the
pr3-deployment-stage-graph
branch
from
September 7, 2026 05:23
8903af0 to
0eeeabd
Compare
This was referenced Sep 7, 2026
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 是什麼
Deployment 框架的地基:stage graph + 全 stack 共用的輕量 utils。從這個 PR 起每一層都值得細 review。
核心設計:模型自述怎麼拆
一個模型的 deploy 面 = 一個
build_stages(),回傳 stage 序列,只有兩種 stage:GraphStage:一張可匯出子圖 = 一份 ONNX = 一顆 engine。宣告name/module/inputs/outputs;inputs/outputs 名就是 ONNX IO 名,值經StageContext(跨 stage 的 name→tensor 字典)取放。進階欄位各有明確語意:torch_fallback_backends(某 backend 跑不了這張圖時退回 torch,如 spconv 圖之於 ORT)、onnx_dynamic_axes(宣告即動態的維度,如點數)、onnx_transforms(這張圖固有的匯出後重寫,如 bias+activation 摺進 plugin 節點)、output_fields(最終 stage 輸出 →assemble_predictions的鍵名映射)。TorchStage:不可匯出的膠水(voxelize/scatter/索引計算),永遠跑 PyTorch,簽名fn(context) -> {name: value}。為什麼這樣設計:真實模型不是一張圖(sparse conv 要 plugin、動態索引、不該進圖的前處理)。stage graph 把「哪裡可以是圖、哪裡必須是 torch」變成模型的宣告,pipeline 照宣告執行——新模型不改框架,框架不認識任何模型。
逐檔導覽
deployment/stages.py:兩個 stage dataclass、StageContext、validate_stages(名字唯一、宣告完整、output_fields ⊆ outputs)、artifact_path命名規則。types/backend.py:Backend 型別(pytorch/onnx/tensorrt)。utils/config_parsing.py:reject_unknown_keys——deploy 與 quantization 的 config schema 共用同一個 unknown-key 驗證(打錯字的 option 立即爆,不會靜默落到預設值)。utils/runtime.py、builders/mlflow_builder.py(run-status context manager)+ 測試:pr7(quantize script)與 pr8(deploy script)都依賴,故下沉到地基層。autoware_ml/__init__.py(license header)、.gitignore(+work_dirs)。檔案清單(點開)
Review checklist
validate_stages的錯誤訊息品質(新模型作者宣告錯誤時的第一接觸面)。GraphStage.__post_init__的 output_fields 檢查是否涵蓋常見宣告錯。🤖 Generated with Claude Code