Repository navigation
refactor(tools/rknn): one report line and one bootstrap per converter - #990
Merged
Merged
Conversation
Every converter ended its phases by printing a hand-shaped summary -- wrote/saved, with or without the size, each caller reformatting stat().st_size -- and re-added the module directory to sys.path at every function that lazily imports rknn_build, twice in the files that already bootstrap it at the top. rknn_build.report_engine() is now that one line (wrote <path> (<size> MB, details...)), and each converter keeps exactly the one bootstrap its import placement needs (lazy imports stay: the slice stages must run in an export venv without the toolkit). Validated on PC: all six scripts py_compile; the piper converter ran end to end in the 2.3.2 converter venv (slice self-check 138.9 dB, build gated), and the rebuilt w93 engine decodes bit-identically on RK3588 to the production lessac w93 2.3.2 engine (23808 samples, np.array_equal true; equal size, different md5 -- embedded build path).
Owner
|
Merged! |
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.
What
Finishes the layer #983 started in
tools/rknn/: after the graph-inspection readers moved intorknn_graph.py, what stayed duplicated was the reporting and the module bootstrap.wrote {output},wrote {output} ({size} MB, inputs ...),saved {out} ({size} MB)— each caller reformattingstat().st_size.rknn_build.report_engine(output, *details)is that line now:wrote <path> (<size> MB[, details...]).rknn_graphat the top (prepare_piper_tts_rknn_vocoder.py,prepare_inflect_v2_rknn_decoder.py) also repeatedsys.path.insert(0, ...)insideconvert_rknn— a no-op second insert of the same directory; it is gone. The files whose only import of the shared modules is the lazy one inside the build function keep exactly that one insert (the slice stages must run in an export venv that has no toolkit, so the lazy import itself is load-bearing), andprepare_qwen3_tts_rknn_vocoder.pykeeps itsos.pathspelling — it never importspathlibat the top.No behaviour change beyond the printed summaries: the slice/convert/check/gate sequence, the gate wiring, the file naming and the argv surface are untouched.
Validation
PC (x86_64, converter venv: rknn-toolkit2 2.3.2, onnx 1.16.1): all six scripts under
tools/rknn/py_compileclean; the piper converter ran end to end onen_US-lessac-medium.onnx:The rebuilt engine was then run on the RK3588 board against the production w93 engine built from the same voice by the same toolkit before this change: same graph contract (
z [1,192,93],y_mask [1,1,93]), and with fixed-seed inputs the 23808-sample PCM outputs are bit-identical (np.array_equaltrue; equal size 19,602,065 bytes, differing md5 is the embedded build path, not the graph).