Skip to content

feat(AWML): introduce new deployment and onnx/tensorRT evaluation pipeline#115

Open
vividf wants to merge 53 commits into
mainfrom
feat/new_deployment_and_evaluation_pipeline
Open

feat(AWML): introduce new deployment and onnx/tensorRT evaluation pipeline#115
vividf wants to merge 53 commits into
mainfrom
feat/new_deployment_and_evaluation_pipeline

Conversation

@vividf

@vividf vividf commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

AWML Unified Deployment Framework

Introduced a unified deployment and evaluation framework for AWML, significantly improving consistency, scalability, and maintainability across projects

Key Contributions

1. Unified Deployment Pipeline

  • Standardized model deployment flow: PyTorch → ONNX → TensorRT
  • Eliminated duplicated and project-specific deployment scripts
  • Enabled config-driven, reusable pipelines across multiple models
  • Supported seamless backend switching (PyTorch / ONNX / TensorRT)

2. Cross-Backend Verification

  • Implemented automatic output comparison across backends
  • Ensured numerical consistency between PyTorch, ONNX Runtime, and TensorRT
  • Prevented silent accuracy regressions during deployment
  • Improved reliability for production-level inference

3. Integrated Evaluation Framework

  • Built unified evaluation pipeline based on T4MetricV2
  • Supports:
    • mAP / mAPH
    • Per-class metrics
    • Threshold-based evaluation
    • Enables consistent benchmarking across different backends and models

How to run

python -m deployment.cli.main centerpoint deployment/projects/centerpoint/config/deploy_config.py   projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_8xb16_121m_j6gen2_base_amp_t4metric_v2.py   --rot-y-axis-reference

@vividf vividf changed the title feat(AWML): introduce new deployment and onnx/tensorRT evaluation pipeline WIP: feat(AWML): introduce new deployment and onnx/tensorRT evaluation pipeline Nov 14, 2025
@vividf vividf force-pushed the feat/new_deployment_and_evaluation_pipeline branch from 68d1700 to 7ac5b8b Compare January 29, 2026 08:08
vividf and others added 10 commits March 11, 2026 13:24
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf vividf force-pushed the feat/new_deployment_and_evaluation_pipeline branch from 5256306 to 2b28f60 Compare March 11, 2026 04:27
vividf and others added 14 commits March 25, 2026 20:49
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@vividf vividf self-assigned this Apr 14, 2026
vividf added 2 commits April 16, 2026 16:16
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
@vividf vividf force-pushed the feat/new_deployment_and_evaluation_pipeline branch from 8756669 to 1d4c27f Compare April 20, 2026 13:05

@KSeangTan KSeangTan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only review the first part, please address the comments accordingly first.

Comment thread deployment/cli/args.py Outdated
Comment thread deployment/cli/args.py Outdated
Comment thread deployment/cli/main.py Outdated
Comment thread deployment/configs/base.py Outdated
Comment thread deployment/configs/base.py Outdated
Comment thread deployment/configs/base.py Outdated
Comment thread deployment/config/base.py
Comment thread deployment/configs/base.py Outdated
Comment thread deployment/configs/base.py Outdated
Comment thread deployment/configs/schema.py Outdated
vividf and others added 22 commits May 19, 2026 20:35
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
…se.py

Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>
Signed-off-by: vividf <yihsiang.fang@tier4.jp>

@KSeangTan KSeangTan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a unified, project-agnostic deployment framework under deployment/ that standardizes export (PyTorch→ONNX→TensorRT), verification (cross-backend output comparison), and evaluation (metrics + latency), and migrates CenterPoint deployment to this new pipeline.

Changes:

  • Added a new deployment/ package with CLI, typed config/schema, exporters/pipelines, runtime orchestrators, primitives, evaluation/verification utilities, and shared documentation.
  • Integrated CenterPoint into the unified framework via a deployment/projects/centerpoint bundle (entrypoint, runner, export decomposition, inference pipelines, evaluator/executor, config).
  • Removed legacy CenterPoint deploy script/runner and added CPU-only unit tests for key framework behaviors (artifact resolution, export orchestration, ONNX atomic write path, comparator, schema validation).

Reviewed changes

Copilot reviewed 87 out of 92 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
projects/CenterPoint/scripts/deploy.py Removed legacy CenterPoint deploy entry script (superseded by unified CLI).
projects/CenterPoint/runners/deployment_runner.py Removed legacy CenterPoint deployment runner (superseded by unified runner/orchestrators).
projects/CenterPoint/README.md Updated CenterPoint docs to use unified deployment CLI and Docker image.
projects/CenterPoint/models/detectors/centerpoint_onnx.py Removed legacy ONNX-specific detector implementation from training project tree.
projects/CenterPoint/models/init.py Dropped exports of legacy ONNX variants now living under deployment/projects.
projects/CenterPoint/Dockerfile Added CenterPoint deployment Docker image with ORT/TensorRT dependencies.
projects/CenterPoint/configs/t4dataset/Centerpoint/second_secfpn_8xb16_121m_j6gen2_base_amp.py Adjusted info_directory_path default.
deployment/tests/test_output_comparator.py Added unit tests for output comparator pass/fail and mismatch paths.
deployment/tests/test_onnx_exporter.py Added tests for atomic ONNX export publish logic (incl. external-data sidecars).
deployment/tests/test_export_pipelines.py Added tests for ONNX/TensorRT export pipeline control flow and validation.
deployment/tests/test_export_orchestrator.py Added tests for stale-ONNX guard and artifact resolution delegation.
deployment/tests/test_config_schema.py Added tests for deploy-config schema parsing/validation.
deployment/tests/test_artifacts.py Added tests for artifact path resolution and ArtifactManager priority order.
deployment/tests/init.py Added tests package marker.
deployment/runtime/verification_orchestrator.py Added scenario-based verification orchestration.
deployment/runtime/runner.py Added unified base deployment runner wiring export/verify/eval stacks.
deployment/runtime/evaluation_orchestrator.py Added cross-backend evaluation orchestration with device resolution.
deployment/runtime/artifact_manager.py Added artifact registration + resolution logic across stages.
deployment/runtime/init.py Added runtime package marker.
deployment/README.md Added top-level deployment framework README and navigation.
deployment/projects/registry.py Added project adapter registry for project-agnostic unified CLI dispatch.
deployment/projects/centerpoint/runner.py Added CenterPoint runner wiring project-specific model load + export pipeline.
deployment/projects/centerpoint/README.md Added CenterPoint deployment bundle README.
deployment/projects/centerpoint/io/sample_types.py Added CenterPoint typed sample payloads and export feature bundle types.
deployment/projects/centerpoint/io/model_loader.py Added CenterPoint ONNX-compatible model config rewriting + checkpoint loading.
deployment/projects/centerpoint/io/data_loader.py Added MMDet3D-backed CenterPoint deployment dataloader.
deployment/projects/centerpoint/io/init.py Added IO package marker.
deployment/projects/centerpoint/inference/pytorch_inference_pipeline.py Added staged PyTorch inference pipeline matching ONNX/TRT component outputs.
deployment/projects/centerpoint/inference/onnx_inference_pipeline.py Added ORT-based componentized inference pipeline.
deployment/projects/centerpoint/export/sample_extractor.py Added CenterPoint export sample extractor using model feature extraction.
deployment/projects/centerpoint/export/onnx_models/centerpoint_onnx.py Added deploy-only CenterPoint ONNX-friendly detector variant.
deployment/projects/centerpoint/export/onnx_models/centerpoint_head_onnx.py Added deploy-only ONNX head variants with deterministic output ordering.
deployment/projects/centerpoint/export/onnx_models/init.py Added ONNX models package marker.
deployment/projects/centerpoint/export/component_builder.py Added CenterPoint component builder (voxel encoder + backbone/neck/head).
deployment/projects/centerpoint/export/init.py Added export package marker.
deployment/projects/centerpoint/evaluation/executor.py Added CenterPoint backend executor (pipeline creation + input preparation).
deployment/projects/centerpoint/evaluation/evaluator.py Added CenterPoint evaluator using shared 3D detection metrics interface.
deployment/projects/centerpoint/evaluation/init.py Added evaluation package marker.
deployment/projects/centerpoint/entrypoint.py Added project entrypoint invoked by unified CLI to wire config/runner.
deployment/projects/centerpoint/contexts.py Added CenterPoint export context for --rot-y-axis-reference.
deployment/projects/centerpoint/config/deploy_config.py Added reference deploy config (export/eval/verify sections + components).
deployment/projects/centerpoint/cli.py Added CenterPoint-specific CLI flag registration.
deployment/projects/centerpoint/init.py Registered CenterPoint project adapter into the registry.
deployment/projects/init.py Added projects package marker.
deployment/primitives/device.py Added DeviceSpec runtime device descriptor and provider helpers.
deployment/primitives/artifacts.py Added artifact dataclass + safe path resolution helper.
deployment/primitives/init.py Added primitives package marker.
deployment/metrics/detection_base.py Added shared base for flattening/summarizing detection metrics.
deployment/metrics/detection_2d_metrics.py Added 2D detection metrics interface implementation.
deployment/metrics/init.py Added metrics package marker.
deployment/io/base_data_loader.py Added base dataloader interface and default shape-sample helper.
deployment/io/init.py Added IO package marker.
deployment/inference/gpu_resource_mixin.py Added GPU resource cleanup utilities and TensorRT resource manager.
deployment/inference/base_inference_pipeline.py Added base inference pipeline contract with latency breakdown.
deployment/inference/init.py Added inference package marker.
deployment/export/pipelines/tensorrt_export_pipeline.py Added model-agnostic TensorRT export pipeline (per-component engines).
deployment/export/pipelines/sample_extractor.py Added sample extractor seam + default whole-model implementation.
deployment/export/pipelines/onnx_export_pipeline.py Added model-agnostic ONNX export pipeline with injected decomposition seams.
deployment/export/pipelines/component_builder.py Added component builder seam + default whole-model implementation.
deployment/export/pipelines/init.py Added export pipelines package marker and documentation.
deployment/export/exporters/onnx_exporter.py Added ONNX exporter with staging-dir atomic publish behavior.
deployment/export/exporters/model_wrappers.py Added base/identity model wrappers for ONNX export.
deployment/export/exporters/configs.py Added typed ONNX/TensorRT exporter config dataclasses.
deployment/export/contexts.py Added base ExportContext type for per-project extensions.
deployment/export/init.py Added export package marker.
deployment/evaluation/output_comparator.py Added structured output comparator used by verification.
deployment/evaluation/evaluator_types.py Added shared evaluator/verifier datatypes (ModelSpec, latency stats, etc.).
deployment/evaluation/base_evaluator.py Added base evaluator loop for metrics + latency across backends.
deployment/evaluation/backend_executor.py Added backend executor contract shared by evaluation + verification.
deployment/evaluation/init.py Added evaluation package marker.
deployment/docs/runbook.md Added operational runbook for the unified CLI and workflow.
deployment/docs/operations.md Added ops guidance and troubleshooting.
deployment/docs/contributing.md Added contribution guide for adding new project bundles.
deployment/docs/architecture.md Added architecture/contract documentation for framework layers and seams.
deployment/config/enums.py Added config enums (Backend, ExportMode, PrecisionPolicy).
deployment/config/base.py Added BaseDeploymentConfig with runtime validation and helpers.
deployment/config/init.py Added config package marker.
deployment/cli/main.py Added unified CLI that discovers/loads project bundles and dispatches.
deployment/cli/args.py Added shared CLI args and file logging helpers.
deployment/cli/init.py Added CLI package marker.
deployment/init.py Added deployment package root and version.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread deployment/config/base.py
@staticmethod
def _parse_deploy_log_path(raw: Optional[str]) -> Optional[str]:
"""Parse deploy_log_path; None or blank disables file logging."""
return raw.strip() or None if raw is not None else None
Comment on lines +68 to +72
def to_ort_provider(self) -> list[str]:
"""Return ONNX Runtime execution providers for this device."""
if self.is_cuda:
return ["CUDAExecutionProvider", "CPUExecutionProvider"]
return ["CPUExecutionProvider"]
to modify them manually.
"""
# Heatmap
heatmap_tensors = head_tensors["heatmap"][:, torch.tensor([0, 1, 2, 3, 4], dtype=torch.int), :, :]
heatmap_scale_factors = heatmap_scale_factors.view([1, -1, 1, 1])
scale_heatmap_tensors = torch.mul(heatmap_tensors, heatmap_scale_factors)
# Reg
reg_tensors = head_tensors["reg"][:, torch.tensor([0, 1], dtype=torch.int), :, :]
scale_reg_tensors = torch.mul(reg_tensors, reg_scale_factors)

# Height
height_tensors = head_tensors["height"][:, torch.tensor([0], dtype=torch.int), :, :]

# Dim
# Swap length, width, height to width, length, height
flip_dim_tensors = head_tensors["dim"][:, torch.tensor([1, 0, 2], dtype=torch.int), :, :]

# Rot
# Swap sin(y), cos(x) to cos(x), sin(y)
flip_rot_tensors = head_tensors["rot"][:, torch.tensor([1, 0], dtype=torch.int), :, :]
scale_flip_rot_tensors = torch.mul(flip_rot_tensors, rot_scale_factors)

# Vel
vel_tensors = head_tensors["vel"][:, torch.tensor([0, 1], dtype=torch.int), :, :]
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.

3 participants