deploy: ORT/TensorRT backends (strongly typed), staged pipeline, cross-backend verification - #15
Draft
vividf wants to merge 1 commit into
Draft
Conversation
This was referenced Sep 5, 2026
Draft
…s-backend verification Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
vividf
force-pushed
the
pr5-backends-pipeline-verification
branch
from
September 7, 2026 05:23
6b4256e to
a7cb0c5
Compare
vividf
force-pushed
the
pr4-onnx-toolchain
branch
from
September 7, 2026 05:23
6cdcf75 to
99f03b4
Compare
This was referenced Sep 7, 2026
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 是什麼
三 backend 執行層 + 跨 backend 驗證 + deploy config schema。這幾個模組同 PR 是依賴閉環:verifier → pipeline → backends;config schema → verifier scenario 型別;
models/base.py→utils/deploy(legacy 型別)→ backends。設計決策
tensorrt_builder.py):engine 精度由 ONNX 圖的型別決定,不由 builder flag 猜。weak-typed + FP16 flag 讓 TRT kernel 自選精度——在量化模型上實測翻車過;strongly typed 把精度變成圖上可審查的事實,與 deploy: ONNX toolchain — export, precision pass (fp16 sea / fp32 Q/DQ islands), graph modify #14 的 precision pass 構成閉環(圖怎麼寫、engine 就怎麼跑)。load_tensorrt_plugin_libraries在 registry init 前載.so;缺檔 FileNotFoundError;parse 失敗疑似 plugin 時錯誤訊息附deploy.tensorrt.plugin_libraries提示。SUGGESTED_GATE_HEADROOM=1.25,常數含出處註解)並要求把 observed 記進 config 註解。StagedPipeline:三 backend 用同一套 stage 序列,差別只在 GraphStage 執行體(torch module / ORT session / TRT engine);PipelineCache一 run 一 cache、無 invalidation(docstring 載明契約)。逐檔導覽
backends/tensorrt_builder.py:strongly-typed build、optimization profile、plugin 載入、workspace。backends/tensorrt_runner.py/onnx_runner.py:engine / ORT session 執行體。deployment/pipeline.py:StagedPipeline、PipelineCache、cuda-synced 計時。verification/backend_verifier.py:scenario 執行(config 宣告pytorch(cuda) vs tensorrt(cuda)等)。verification/output_comparator.py:遞迴逐 tensor 比 max_diff、建議 gate、caveat 機制(模型可宣告某輸出跨 backend 不可比的理由,gate 大聲跳過而不是配一個沒人能辯護的 tolerance)。deployment/config.py:deploy schema(unknown-key 驗證走 deploy: stage-graph foundation (GraphStage/TorchStage) + shared runtime utils #13 的共用 helper)。models/base.py:框架 hook + legacy export 契約(TODO 標記,過渡期)。utils/deploy.py:整檔 legacy(TODO 待刪),新路徑僅models/base.py的過渡型別 import。檔案清單(點開)
Review checklist
utils/deploy.py新路徑零依賴確認。🤖 Generated with Claude Code