Skip to content

feat: migrate from pybind11 to nanobind - #244

Open
Artlesbol wants to merge 717 commits into
sophgo:masterfrom
Artlesbol:nanobind-migrate-pr
Open

feat: migrate from pybind11 to nanobind#244
Artlesbol wants to merge 717 commits into
sophgo:masterfrom
Artlesbol:nanobind-migrate-pr

Conversation

@Artlesbol

Copy link
Copy Markdown
Contributor
  • Replace pybind11 with nanobind across all Python bindings modules,
  • updating CMakeLists.txt, include headers, and module declarations.

我执行了python/test/test_onnx.py测试程序并按README上的两个样例进行了测试(未将产物拷贝到开发板子上执行,仅完成容器中的转换流程),以上测试全部通过,如果需要完善更多测试,请告知我

I executed the python/test/test_onnx.py test program and conducted the tests according to the two examples in the README (I did not copy the results to the development board for execution; I only completed the conversion process within the container). All the tests passed. If you need to add more tests, please let me know.

xu.yang and others added 30 commits April 15, 2025 13:36
add LutOp, BinaryConstShiftOp, BinaryShiftOp to group mm

Change-Id: I929d2df66a9a2fefb94dde3581b3b6b18df52e74
Calculate the ranges of activations and weights.
Then scale the weights of layernorm and matmuls after the layernorm.

Change-Id: I1701247cc7f65da7b19548317c69cc47e17a6fcc
1.using multi maxpool to identify yolo models
2.postprocess block as F16

Change-Id: I69af2c7a804c1be8a3009766e422444067decca7
update backend

Change-Id: Ie0bcfeb4a6995b7af2d52c077a7c7b920c3bdd11
- Adding the custom operator 'Correlation'.
- The backend code uses PPL.
- Adding ONNX Runtime call logic when custom operators are present.

Change-Id: I9da52e51d8baa871e3cf5c603cf56b32a6e2a983
1. the header parse error
2. fix cmd group bin same file error

Change-Id: Ice6c326bec08f688c86c7b6174d09fdc38306318
Change-Id: I84e75a3ded7f66d26f3c27118057f5fd168670a6
1.replace op name in regression calitable for c755a68

Change-Id: Ic75f04a29274a9dd2d9d6e9720dbeaa7cd32fb9e
tpulang add a16matmul interface && support a16matmul in top layer

Change-Id: Ib9dc4f512f832341f8cd7a906b1bde4256665071
analysys all passes and auto generated a tpuc cmd builder (to replace
preparing command manully in mlir_shell before)

Change-Id: Ifc9e918bc048de38745c47bac5a295ca91c49cb6
fix w8a16 with group_size fail error

Change-Id: Id3fa7121ff96e436d8315be7ea4594faafb1bbff
…tion.

change the output type by quant int16 type with a new scale and zero point.

Change-Id: Idd7686dfa714c82bbde8cea890c474f744d450a8
v3.3 -> v3.4 url update

Change-Id: I5ac98ac19e6615133262054043232d43dcee74fa
- add enable_coverage and disable_coverage function in envsetup.sh
- add options in CMakeLists.txt
- add options in build.sh

Change-Id: Ia209f37a8ae13dc422333ca6b874213fbb2b59e1
--Implement automatic mixed-precision quantization for the model using int4 and int8.

Change-Id: I8c65de352c4105a96579403a7ac000fc4e76515b
[1, K]x[K, N] will split to multi core

Change-Id: Iaab9655a6b2fc2e9ead300e257d81b34a5bfa164
Change-Id: Ib57f3fcd84819c8887a7500841e1be62e24662db
a2 not support multi core matmul

Change-Id: Ib6ae3933e6d661e0fd3af702f5f2d604c3d4f84b
- add restriction when (oh % ih == 0 && ow % iw == 0)

Change-Id: Ie1475a7e69f295953000e1e11835844bafa4ad80
--remove run_qtable
--update regression scripts
--update documentation

Change-Id: Iaac80304b534a31c46e85e6485a94115aea81cef
-fix some bug in correlation_fp.pl
-can't get right batch when mutil-batch

Change-Id: I56dceb7a9506f41b999f5ebf939debde77bdfae2
clear all run_qtable in doc

Change-Id: I1a6663321d8cc5cda5aa2800510a5df3f46d311a
disable gdma_check option

Change-Id: Ibfcff0214f60bf76b2265777afb0f4b57d6e6a5b
update all op description, include 175 Top Ops and 167 Tpu Ops

Change-Id: I09c65570c62e9648748ed300591849bc94877003
add qwen2_7b demo

Change-Id: I79b8bbb32941a87908a7b452ff8c7aa86022baf7
subnet

keep SortOp alone like TopKOp
Change-Id: If81f54d7a8982637afafd0b0bf834696525dfe7d
…ng 3ic

Change-Id: I7953066bc4e006fea3e8532b3b047986c15d1869
Use llm_convert.py to transform gptq/awq model directly.

Change-Id: I718c5912fa3c9b1f505d7153e298dfe7343824a0
llm_convert.py -m /workspace/Qwen2.5-VL-3B-Instruct -s 2048  -q w4bf16 -g 128 --max_pixels 840,560  -c bm1684x --out_dir qwen2.5vl

Change-Id: Iec762a38fab277555696ddd83471488c551929db
qwen2vl doesn't need window attention, but qwen2.5vl needs

Change-Id: I148c1e05fde4f12228eda8a4b3a8acdb615fd177
charlesxzb and others added 27 commits August 22, 2025 18:57
- multi-core mm backend not support for bm1688

Change-Id: Idf72b00dfdbc0497dce2e406cfd1652ad092a1fb
-Reshape when the C_dims is too large

Change-Id: I6dd4ccf395da6ea42ede01dfa894feb7ea2b0b08
- The TPUC_OPT_TIMEOUT environment variable can be used to set the timeout (unit:h/m/s).
- Currently only applies to model_zoo regression.
- Does not support _os_system_log.

Change-Id: I62a52277cfaa09b56b517598e4a011582524aa14
- use options_.debugger to judge whether use manual group cost

Change-Id: I56c41c70beded59ce05b6e9a872ff483665fc3b7
- share a long prompt for different questions

Change-Id: I3a458970875b7d59ae34ea7902947f91e9b38545
-suitable for bmcv uint8 postprocess

Change-Id: I8a7f83725d416eb3da315864794ee2bca487bb6e
--search_qtable support w4a8 mode

Change-Id: I8aeacd6aaa050fb9acb662138e6e5148103745d7
the scale of logic op output should be 1.0 for correct cal in next op

Change-Id: I68e249e4b0a2fe33f96dbe9fc5798f0faa93b33c
Improve EVA02 bmodel performance

Change-Id: Ib53226b54fdfc1d98a7aba534906137b096f2d67
Match eva02 block and generate the qtable

Change-Id: I2549afd122345f195d483d9ebd835337ba89e8fe
-correct stride_h, stride_w when in_h equals stride_h and in_w equals stride_w

Change-Id: I80f0402a912792411e7a94983dc3c7981dab6214
- A16MatMul inference is not correct when group_size = 0
- A16MatMul should alway have zp, and weight should be unsign

Change-Id: Iaef75a81b4f9c8c1df12ae5524c6fd56f80485b7
- this case will switch to group_size 128

Change-Id: I2f7612412c45e5b6c03778158c9c308ee21ca34c
- as tile said
Change-Id: Icaa658071b0ba9f314d46e9afbb150eb79f45667
-reset f16 or bf16 dtype in qtable to f32

Change-Id: I9345450f3aa6bcbd8688e3307319c330d08539e2
-reset non-int8 dtype in qtable to f32

Change-Id: I607a20335fc1604252cc4777ad728bcd44ec5375
- keep sign for A16MatMul

Change-Id: Ib6d4ca0ed105bb0a3aa4a77a7111660829df9a99
-multi-core op's results cant be displayed

-fix check-diff file name bug

Change-Id: I14dcad8bf3ab6f48cadc67f4e5335a70173e48a7
- support optimized cycle modeling for multi-core case in
CycleCalculator
- reset BW in codegen process when multi-core is used for bm1688

Change-Id: Iefa913ce029c797b6069e7c27c457eb1c1cd03f2
- fix wrong dtype_len in groupnorm rstd compute

Change-Id: Iad65b379498bc9f9489180bc1305c852215e264d
- test by: llm_convert.py -m /workspace/Qwen2-7B-Instruct -s 384 -q w8bf16 -g 0  -c bm1688 --out_dir qwen2

Change-Id: Ia28624603f2a2aac4407d621019d163b66ba8a71
- there is inf in calitable causing cali info lost for this tensor, and the calitable in model zoo not match transformed mlir now.
- inf is caused in former op where, it outputs inf by selection

Change-Id: I3a7fca46cd56ec070f4802c05b778b478b796abb
- accuracy should be checked and improved in the future

Change-Id: I8ed65fa1b0e9aeceb41bfb3727605bd48baaf149
BinaryConstShiftOp quit can_be_group_small_c
Change-Id: I44bb20b9faaada6fd4e2c5a4a675360076fa842d
- if w4a16 has no group, will switch to group 128

Change-Id: I4e4357fdf3221489739cae39bc3606e808bd50ad
… hook

- Replace all Chinese comments with English equivalents
- Improve code readability for international contributors
- Translate by qwen3-8b using tools uploaded on https://github.com/Artlesbol/llm-comments-translator#
- Add language check in pre-commit hook

---------

Co-authored-by: CharlesXin <110083740+charlesxzb@users.noreply.github.com>
- Replace pybind11 with nanobind across all Python bindings modules,
- updating CMakeLists.txt, include headers, and module declarations.
@Artlesbol

Copy link
Copy Markdown
Contributor Author

about issue #237

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.