Download code/tt_transfusion/reference/__init__.py from changh95/transfusion-p150: direct link, hf CLI and curl.
- Browser
- Download file 2.47 kB
-
https://huggingface.co/changh95/transfusion-p150/resolve/main/code/tt_transfusion/reference/__init__.py
- Command line
-
hf download hf://changh95/transfusion-p150/code/tt_transfusion/reference/__init__.py
-
curl -L -o __init__.py https://huggingface.co/changh95/transfusion-p150/resolve/main/code/tt_transfusion/reference/__init__.py
2.47 kB
| # SPDX-License-Identifier: Apache-2.0 | |
| """CPU reference of TransFusion-L (Autoware lidar_transfusion) -- the ground truth every PCC / output-agreement gate | |
| compares against (PLAN.md 0.3 item 1). It runs where ttnn is absent (the research venv) and never imports ttnn. | |
| - ``config.py`` the Autoware parameters this port reproduces (the ml_package / remapper / metadata yaml of the | |
| weights, ``transfusion.param.yaml``, the node's hard-coded constants and silent sanitization) and | |
| the port's COMPILE constants (``N_MAX`` 65,536, sampling modes), each with its source line in | |
| autoware_universe @ 9ceaccf026c31ffc5319bc9eeb4bd7bede0af3fd; | |
| - ``weights.py`` ``transfusion.onnx`` read as data with the vendored ``ttaw.weights.OnnxWeights`` (initializers | |
| and constants by consuming node; every wiring assumption asserted from the graph; BN folded in | |
| float64 where the TT port folds it: the PFN MatMuls and the deblock2 ConvTranspose); | |
| - ``model.py`` fp32 torch rebuild of the deployed graph (PFN, scatter, SECOND, SECONDFPN, dense head, local max, | |
| ONNX-semantics top-K with optional teacher forcing, query init, decoder, prediction heads, | |
| output assembly) with per-module taps (``ttaw.golden.TapRegistry``; names in ``MODULE_TAPS``); | |
| - ``rewrites.py`` the TT-friendly equivalent forms (PFN tile form and 32-slot pillars, K-split shared conv, | |
| deblock rewrites, C22 masked local max, arithmetic ``query_pos``, class table, constant cross- | |
| attention K / V tables, head-dim padding, merged prediction heads), proven against ``model.py``; | |
| - ``ort.py`` ONNX Runtime golden of the shipped ONNX on the same voxel tensors, with optional intermediates | |
| (research / tests only: onnxruntime is not in the image); | |
| - ``pipeline.py`` the reference end to end: ``host/`` pre-processing -> torch or ORT network -> ``host/`` | |
| post-processing -> ``ttaw.outputs.Detections3D``. | |
| Pre- and post-processing are not duplicated here: they live in ``tt_transfusion.host`` (shared with the device path, | |
| so TT and CPU see identical voxel and feature tensors) and are tested against the research scripts. | |
| The ``to_dict()`` of this reference's output on the shipped sample is stored as | |
| ``samples/test_pcd.reference.json``: ``server/smoke_test.py`` compares the served output with it. | |
| """ | |