diff --git a/.gitattributes b/.gitattributes
index a6344aac8c09253b3b630fb776ae94478aa0275b..7c30d717acb7ca5a7f08dc534960a6cffe2303b2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
+*.axmodel filter=lfs diff=lfs merge=lfs -text
+qwen3-vl-tokenizer/merges.txt filter=lfs diff=lfs merge=lfs -text
+qwen3-vl-tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
+qwen3-vl-tokenizer/vocab.json filter=lfs diff=lfs merge=lfs -text
+main_axcl_aarch64 filter=lfs diff=lfs merge=lfs -text
+*.jpg filter=lfs diff=lfs merge=lfs -text
diff --git a/Qwen3-VL-2B-Instruct-ax8850/Qwen3-VL-2B-Instruct_vision.axmodel b/Qwen3-VL-2B-Instruct-ax8850/Qwen3-VL-2B-Instruct_vision.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..d531d2c143f4cb68a3fb4debff41cc1c7a74681c
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/Qwen3-VL-2B-Instruct_vision.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f8bd7c1864e378ebccd7c50b006586360dea7f0302db8662cfe93773603ae749
+size 452430541
diff --git a/Qwen3-VL-2B-Instruct-ax8850/model.embed_tokens.weight.bfloat16.bin b/Qwen3-VL-2B-Instruct-ax8850/model.embed_tokens.weight.bfloat16.bin
new file mode 100755
index 0000000000000000000000000000000000000000..a31b5884982fa51dd19d43505e6c99d71a3e055a
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/model.embed_tokens.weight.bfloat16.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:91c45bb2b9d8b678ceba1e3f0da785e47e5e6316384be544aa71b3c5d68ed733
+size 622329856
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l0_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l0_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..3bd6456507ff3f3472e8aad19c54e34125c246e5
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l0_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d35ad01c9630b23ae0715c3604ff01581debc033934f7e42feb38fd385cab4d9
+size 73017579
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l10_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l10_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..6d150f57c0c7000e8b4183c500e91073aa30b0b6
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l10_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6fae923bae282c1dce739e360615684ecd5790aa8d221c52bec0a10b54b95745
+size 73017227
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l11_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l11_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..5119ac31c345be35e0630e69a9966f0060e20fdd
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l11_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:61a0661023037cafe2666be3d6e74e6656eccfd4e08a4eada20476a46cfc78ac
+size 73013195
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l12_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l12_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..0e42f230e5a883ae8e4729ddb8f1cb88a52a91c1
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l12_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ec00c49eb7c6f282a3b8df8c5ed12060abd652e4a6fded9feb69c472354ab261
+size 73018731
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l13_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l13_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..c1380848a26fa8ef0bfd60da8ee6ce5174965903
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l13_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c991fe51f02c8e1f0c3095c7e84888d0aa31d85cb148bf2696fadc31dfbc6cc0
+size 73015723
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l14_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l14_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..4634d16f688a90bfd15bacee947f547c9e558315
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l14_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6606f5e112ce0116c5fb2a75e1e859b1262dc88520f9fcce7af9803e2f3b5ed5
+size 73010379
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l15_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l15_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..a98c218674f5dd2b4dee0111ad0d02fdbf6c21c3
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l15_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:37c53e7d6d1601107b4fd220b5ec7c569754ee8a3ec55876157d06499c1781eb
+size 73010379
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l16_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l16_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..352cad6851b96246838020281e5a801bf529fa7c
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l16_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:371364a9461c0905e97f239b465b3b2f9cbb147b7ae95a356b47ebf74190e98e
+size 73002091
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l17_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l17_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..7d3c40581189412590fd7fa144384f1af6c5488c
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l17_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d0d661a297436ecf2c20b537c562b54446abb7aeba206fe6ec1f9a7e05a1c57d
+size 73009131
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l18_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l18_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..1757758c13e0d2aee6f014516687933507db904c
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l18_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:24b0392b48879fb2cb35ff600c11f240b31e7b22126992cfa727047f35c7565c
+size 73010827
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l19_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l19_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..6c5a3e1ff851d303d93bf9f6b39b31cb8c1eaef8
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l19_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:78f7899e82de2c02d4a37e5ffe6b37b2fd9f573e4e0ba3aaeaa10dda590adf64
+size 73008747
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l1_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l1_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..8f19dffcf641b3fa9138f887e19a1bafefde2623
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l1_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2356413dbd20507f502c05b387d90700f92e960cc5c27a5a8cd56b7b6fa9da44
+size 73015243
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l20_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l20_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..a85d6c65aaf27e93fa08431124b2855be2b36a25
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l20_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d92b4ed9e9fa201f09cfd5af7d433d7001fceeb6da3f2332098c178a84e8781f
+size 73007627
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l21_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l21_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..1a2d3f0e1fc2e5aaf8811ba0bbaa058ae5520cd8
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l21_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6fdf7d91127a444f67391aac8c6990582612ca22eaabc4706a5743eb44d7d9a4
+size 73010923
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l22_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l22_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..c988c33a278533a51e4cb2d6400143a7974ad473
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l22_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d6b386c94c28a85954ba42ad5b679f21b69450e18c5f48e2152c6c33de7e257a
+size 73011915
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l23_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l23_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..681906ee6cb12b69d54025efda103ad142d2c96c
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l23_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1fa54ebaf7e6f3438a4665a2a106afe6940e379b18c5441c947f46565c80ebf3
+size 73012939
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l24_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l24_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..f9a1e5d9bc615ed14ab4ca37a03e5609de41a099
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l24_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4691860fa6623e93e90d6cac9f0f1c35aa39cf444b7867401ba4e954d3f6ef77
+size 73018251
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l25_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l25_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..92a6bd19e9fddd7fef74509603be714e9c58352a
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l25_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0a4cbeea075f7e2666ec64452581769b21d245fa42ec917f891c4a74a5ea3694
+size 73017227
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l26_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l26_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..07b08520054de63286f2eeec31fd629cfae24177
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l26_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:98e4ea7cab1e872fef4315def8b06d8e3dae4cbc5aee09a02c00331ec458bfc0
+size 73012747
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l27_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l27_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..67a2b2dc1852b8fd82f446aa61c18116d6e60058
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l27_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:158747691d802f9b8873784fe238f54961068d5d337bad8c467720182056904b
+size 73019211
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l2_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l2_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..b9474722f1894bec985495f5deb4f9927a4cb1a2
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l2_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d5e3cfd99a40f324c5ab5dd0be0f94536edf72b69c83e32376e3130fbffc87af
+size 73015755
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l3_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l3_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..075750a88332405f297eebdd8d64ab3241aa5dd3
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l3_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2ab35c47469478e044c115d76a33b9e058ff29108aa74563f9d60ca0fa1bf31c
+size 73016427
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l4_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l4_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..68a8f433137f96a014d3143a72ad3d1c78076e65
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l4_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:12d6fe031ade93a0ceecf632c4dcde5411e2262a8632edbdcd89ae9aed278b9f
+size 73014987
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l5_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l5_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..4d713e4df62f61904478c8a5242e205b29bb67ad
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l5_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:361da9989d0fbcfb2730992967565b09303379ddea90e84375e4cf9cdcd89841
+size 73014603
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l6_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l6_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..0bf6af4a06939f30e003f2e2f6df843c788e8e53
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l6_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1aca7a41fdd3950bdb95198088b24e21aff86ac5ae6375db32b9bd7a2a3b1175
+size 73010507
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l7_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l7_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..1100528f10501fb08c34838b58a347eff93f736b
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l7_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:84a7b57f821e683970fbdd2346f57242c3ac87ef19fd2769823a62acedc3d222
+size 73018955
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l8_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l8_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..be93656ec76a612485d0c6f70f53b8700bc02467
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l8_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5de3147a63b1ae3974925664ecd5bf640a3155888de211e6ff915ffc2a8bce9a
+size 73017835
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l9_together.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l9_together.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..f48321d58ba1ce634dc5ab8fad11b1d4b9953d19
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_p128_l9_together.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:75ab25d28cf4bd87a7d6e5f3115432acf92a04144b267bb742bd3c3e9616b84b
+size 73009259
diff --git a/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_post.axmodel b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_post.axmodel
new file mode 100755
index 0000000000000000000000000000000000000000..892593614f01b963653c3e702e1643d3eaae9a07
--- /dev/null
+++ b/Qwen3-VL-2B-Instruct-ax8850/qwen3_vl_text_post.axmodel
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:40ff92e3c93b96b34d4d440d69cf5ae516f445f7dd957eec9775235c0944b053
+size 339277488
diff --git a/images/demo.jpg b/images/demo.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..edb279f175afdbf585af17314fa8fcf806e37b77
--- /dev/null
+++ b/images/demo.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:344d5f0e43bfd6a4a6ed655dc9c3dc76a2a6ecb1de3afeee998e61722378e8b3
+size 64541
diff --git a/images/demo1.jpg b/images/demo1.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..3edad3e076cd965869a73044b483f474ef76dae8
--- /dev/null
+++ b/images/demo1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:8d6156cbaa86cf0f4a9ebbfc8c2bf307dcf6fc64e32176d69333f6f7c7b294c5
+size 100862
diff --git a/images/recoAll_attractions_1.jpg b/images/recoAll_attractions_1.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..03b15c0dd1ecfada3c459ce7b2a55df66d45fa39
--- /dev/null
+++ b/images/recoAll_attractions_1.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0072430513e76580c4134b78e452a1fb729112fe5725d1f8481e697c7b5cd4a1
+size 73319
diff --git a/images/recoAll_attractions_2.jpg b/images/recoAll_attractions_2.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..90dcbc401c943e2488279f66f5a4166b53fe0348
--- /dev/null
+++ b/images/recoAll_attractions_2.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:28acba6c284d06039ca57c9ce182094baafa8a48b49068dc44482a6d643689cc
+size 105498
diff --git a/images/recoAll_attractions_3.jpg b/images/recoAll_attractions_3.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..70e170c242ffa512ac57428cb076ee224d1a5eae
--- /dev/null
+++ b/images/recoAll_attractions_3.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f308b3ebb1855b74768d9a24a256616f683ba59e52c238326501f4008a3ab9a4
+size 59354
diff --git a/images/recoAll_attractions_4.jpg b/images/recoAll_attractions_4.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..5001ed9aa0c8f07288efd148eb6d5633d354ed8c
--- /dev/null
+++ b/images/recoAll_attractions_4.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e47e13a69c16073e221b143a43263fcbe956bcfeb8ad47fddbdbc03a2b6f7261
+size 115280
diff --git a/images/ssd_car.jpg b/images/ssd_car.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..cd6073130ead4b43d66fddcf396c83445106527a
--- /dev/null
+++ b/images/ssd_car.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:92d459a39a9eef03956257cf9fec84114d9e5df8fb9c0662fb257488cdd4f365
+size 50535
diff --git a/images/ssd_horse.jpg b/images/ssd_horse.jpg
new file mode 100755
index 0000000000000000000000000000000000000000..d249dded68682cc2543f2cef074249f1ffd7c1cd
--- /dev/null
+++ b/images/ssd_horse.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ed22f6b4c8c33e50e391e089ede14e8fa9402c623b09dbcf010e804770698fbb
+size 123072
diff --git a/main_axcl_aarch64 b/main_axcl_aarch64
new file mode 100755
index 0000000000000000000000000000000000000000..a5e331e4411c3ecb74f4274da5da0b578c38d4f4
--- /dev/null
+++ b/main_axcl_aarch64
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1c43130c85d23321f85f3b62419c8a542fe6c8a63b03edada8fa6ccd050aaa79
+size 7622944
diff --git a/post_config.json b/post_config.json
new file mode 100755
index 0000000000000000000000000000000000000000..39e29ae7ecc5f235744f4a64c6664f3eb04a343e
--- /dev/null
+++ b/post_config.json
@@ -0,0 +1,14 @@
+{
+ "enable_temperature" : true,
+ "temperature" : 0.2,
+
+ "enable_repetition_penalty" : false,
+ "repetition_penalty" : 1,
+ "penalty_window" : 30,
+
+ "enable_top_p_sampling" : false,
+ "top_p" : 0.8,
+
+ "enable_top_k_sampling" : true,
+ "top_k" : 10
+}
diff --git a/qwen3-vl-tokenizer/README.md b/qwen3-vl-tokenizer/README.md
new file mode 100755
index 0000000000000000000000000000000000000000..fd1e6f0fe30e4619709e810e5ae05cb05d137783
--- /dev/null
+++ b/qwen3-vl-tokenizer/README.md
@@ -0,0 +1,192 @@
+---
+license: apache-2.0
+pipeline_tag: image-text-to-text
+library_name: transformers
+---
+
+
+
+
+
+# Qwen3-VL-2B-Instruct
+
+
+Meet Qwen3-VL — the most powerful vision-language model in the Qwen series to date.
+
+This generation delivers comprehensive upgrades across the board: superior text understanding & generation, deeper visual perception & reasoning, extended context length, enhanced spatial and video dynamics comprehension, and stronger agent interaction capabilities.
+
+Available in Dense and MoE architectures that scale from edge to cloud, with Instruct and reasoning‑enhanced Thinking editions for flexible, on‑demand deployment.
+
+
+#### Key Enhancements:
+
+* **Visual Agent**: Operates PC/mobile GUIs—recognizes elements, understands functions, invokes tools, completes tasks.
+
+* **Visual Coding Boost**: Generates Draw.io/HTML/CSS/JS from images/videos.
+
+* **Advanced Spatial Perception**: Judges object positions, viewpoints, and occlusions; provides stronger 2D grounding and enables 3D grounding for spatial reasoning and embodied AI.
+
+* **Long Context & Video Understanding**: Native 256K context, expandable to 1M; handles books and hours-long video with full recall and second-level indexing.
+
+* **Enhanced Multimodal Reasoning**: Excels in STEM/Math—causal analysis and logical, evidence-based answers.
+
+* **Upgraded Visual Recognition**: Broader, higher-quality pretraining is able to “recognize everything”—celebrities, anime, products, landmarks, flora/fauna, etc.
+
+* **Expanded OCR**: Supports 32 languages (up from 19); robust in low light, blur, and tilt; better with rare/ancient characters and jargon; improved long-document structure parsing.
+
+* **Text Understanding on par with pure LLMs**: Seamless text–vision fusion for lossless, unified comprehension.
+
+
+#### Model Architecture Updates:
+
+
+
+
+
+
+1. **Interleaved-MRoPE**: Full‑frequency allocation over time, width, and height via robust positional embeddings, enhancing long‑horizon video reasoning.
+
+2. **DeepStack**: Fuses multi‑level ViT features to capture fine‑grained details and sharpen image–text alignment.
+
+3. **Text–Timestamp Alignment:** Moves beyond T‑RoPE to precise, timestamp‑grounded event localization for stronger video temporal modeling.
+
+This is the weight repository for Qwen3-VL-2B-Instruct.
+
+
+---
+
+## Model Performance
+
+**Multimodal performance**
+
+
+
+**Pure text performance**
+
+
+## Quickstart
+
+Below, we provide simple examples to show how to use Qwen3-VL with 🤖 ModelScope and 🤗 Transformers.
+
+The code of Qwen3-VL has been in the latest Hugging Face transformers and we advise you to build from source with command:
+```
+pip install git+https://github.com/huggingface/transformers
+# pip install transformers==4.57.0 # currently, V4.57.0 is not released
+```
+
+### Using 🤗 Transformers to Chat
+
+Here we show a code snippet to show how to use the chat model with `transformers`:
+
+```python
+from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
+
+# default: Load the model on the available device(s)
+model = Qwen3VLForConditionalGeneration.from_pretrained(
+ "Qwen/Qwen3-VL-2B-Instruct", dtype="auto", device_map="auto"
+)
+
+# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
+# model = Qwen3VLForConditionalGeneration.from_pretrained(
+# "Qwen/Qwen3-VL-2B-Instruct",
+# dtype=torch.bfloat16,
+# attn_implementation="flash_attention_2",
+# device_map="auto",
+# )
+
+processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-2B-Instruct")
+
+messages = [
+ {
+ "role": "user",
+ "content": [
+ {
+ "type": "image",
+ "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
+ },
+ {"type": "text", "text": "Describe this image."},
+ ],
+ }
+]
+
+# Preparation for inference
+inputs = processor.apply_chat_template(
+ messages,
+ tokenize=True,
+ add_generation_prompt=True,
+ return_dict=True,
+ return_tensors="pt"
+)
+inputs = inputs.to(model.device)
+
+# Inference: Generation of the output
+generated_ids = model.generate(**inputs, max_new_tokens=128)
+generated_ids_trimmed = [
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
+]
+output_text = processor.batch_decode(
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
+)
+print(output_text)
+```
+
+### Generation Hyperparameters
+#### VL
+```bash
+export greedy='false'
+export top_p=0.8
+export top_k=20
+export temperature=0.7
+export repetition_penalty=1.0
+export presence_penalty=1.5
+export out_seq_length=16384
+```
+
+#### Text
+```bash
+export greedy='false'
+export top_p=1.0
+export top_k=40
+export repetition_penalty=1.0
+export presence_penalty=2.0
+export temperature=1.0
+export out_seq_length=32768
+```
+
+
+## Citation
+
+If you find our work helpful, feel free to give us a cite.
+
+```
+@misc{qwen3technicalreport,
+ title={Qwen3 Technical Report},
+ author={Qwen Team},
+ year={2025},
+ eprint={2505.09388},
+ archivePrefix={arXiv},
+ primaryClass={cs.CL},
+ url={https://arxiv.org/abs/2505.09388},
+}
+
+@article{Qwen2.5-VL,
+ title={Qwen2.5-VL Technical Report},
+ author={Bai, Shuai and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Song, Sibo and Dang, Kai and Wang, Peng and Wang, Shijie and Tang, Jun and Zhong, Humen and Zhu, Yuanzhi and Yang, Mingkun and Li, Zhaohai and Wan, Jianqiang and Wang, Pengfei and Ding, Wei and Fu, Zheren and Xu, Yiheng and Ye, Jiabo and Zhang, Xi and Xie, Tianbao and Cheng, Zesen and Zhang, Hang and Yang, Zhibo and Xu, Haiyang and Lin, Junyang},
+ journal={arXiv preprint arXiv:2502.13923},
+ year={2025}
+}
+
+@article{Qwen2VL,
+ title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
+ author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},
+ journal={arXiv preprint arXiv:2409.12191},
+ year={2024}
+}
+
+@article{Qwen-VL,
+ title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},
+ author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},
+ journal={arXiv preprint arXiv:2308.12966},
+ year={2023}
+}
+```
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/chat_template.json b/qwen3-vl-tokenizer/chat_template.json
new file mode 100755
index 0000000000000000000000000000000000000000..e49e75bdda104c8de941eb20e0b3765184fb27bc
--- /dev/null
+++ b/qwen3-vl-tokenizer/chat_template.json
@@ -0,0 +1,4 @@
+{
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within XML tags:\\n\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n\\n\\nFor each function call, return a json object with function name and arguments within XML tags:\\n\\n{\\\"name\\\": , \\\"arguments\\\": }\\n<|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n"
+}
+
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/config.json b/qwen3-vl-tokenizer/config.json
new file mode 100755
index 0000000000000000000000000000000000000000..0cd8c646eb55794594b14fefcd1d3acea5cc000f
--- /dev/null
+++ b/qwen3-vl-tokenizer/config.json
@@ -0,0 +1,63 @@
+{
+ "architectures": [
+ "Qwen3VLForConditionalGeneration"
+ ],
+ "image_token_id": 151655,
+ "model_type": "qwen3_vl",
+ "text_config": {
+ "attention_bias": false,
+ "attention_dropout": 0.0,
+ "bos_token_id": 151643,
+ "dtype": "bfloat16",
+ "eos_token_id": 151645,
+ "head_dim": 128,
+ "hidden_act": "silu",
+ "hidden_size": 2048,
+ "initializer_range": 0.02,
+ "intermediate_size": 6144,
+ "max_position_embeddings": 262144,
+ "model_type": "qwen3_vl_text",
+ "num_attention_heads": 16,
+ "num_hidden_layers": 28,
+ "num_key_value_heads": 8,
+ "rms_norm_eps": 1e-06,
+ "rope_scaling": {
+ "mrope_interleaved": true,
+ "mrope_section": [
+ 24,
+ 20,
+ 20
+ ],
+ "rope_type": "default"
+ },
+ "rope_theta": 5000000,
+ "tie_word_embeddings": true,
+ "use_cache": true,
+ "vocab_size": 151936
+ },
+ "tie_word_embeddings": true,
+ "transformers_version": "4.57.0.dev0",
+ "video_token_id": 151656,
+ "vision_config": {
+ "deepstack_visual_indexes": [
+ 5,
+ 11,
+ 17
+ ],
+ "depth": 24,
+ "hidden_act": "gelu_pytorch_tanh",
+ "hidden_size": 1024,
+ "in_channels": 3,
+ "initializer_range": 0.02,
+ "intermediate_size": 4096,
+ "model_type": "qwen3_vl",
+ "num_heads": 16,
+ "num_position_embeddings": 2304,
+ "out_hidden_size": 2048,
+ "patch_size": 16,
+ "spatial_merge_size": 2,
+ "temporal_patch_size": 2
+ },
+ "vision_end_token_id": 151653,
+ "vision_start_token_id": 151652
+}
diff --git a/qwen3-vl-tokenizer/configuration.json b/qwen3-vl-tokenizer/configuration.json
new file mode 100755
index 0000000000000000000000000000000000000000..3a6d425685de8896b2bc8b59b671e41aea1d7bf3
--- /dev/null
+++ b/qwen3-vl-tokenizer/configuration.json
@@ -0,0 +1 @@
+{"framework":"Pytorch","task":"image-text-to-text"}
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/generation_config.json b/qwen3-vl-tokenizer/generation_config.json
new file mode 100755
index 0000000000000000000000000000000000000000..7bb37933d2d86e4ceaabcc6540be989658f238e9
--- /dev/null
+++ b/qwen3-vl-tokenizer/generation_config.json
@@ -0,0 +1,14 @@
+{
+ "bos_token_id": 151643,
+ "pad_token_id": 151643,
+ "do_sample": true,
+ "eos_token_id": [
+ 151645,
+ 151643
+ ],
+ "top_p": 0.8,
+ "top_k": 20,
+ "temperature": 0.7,
+ "repetition_penalty": 1.0,
+ "transformers_version": "4.56.0"
+}
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/merges.txt b/qwen3-vl-tokenizer/merges.txt
new file mode 100755
index 0000000000000000000000000000000000000000..7ce1d95196227d613b7f49e7d007393b42389cfb
--- /dev/null
+++ b/qwen3-vl-tokenizer/merges.txt
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:599bab54075088774b1733fde865d5bd747cbcc7a547c5bc12610e874e26f5e3
+size 1671839
diff --git a/qwen3-vl-tokenizer/preprocessor_config.json b/qwen3-vl-tokenizer/preprocessor_config.json
new file mode 100755
index 0000000000000000000000000000000000000000..2ea84a437d448ff71b08df68fdd949d5cc4ebb64
--- /dev/null
+++ b/qwen3-vl-tokenizer/preprocessor_config.json
@@ -0,0 +1,21 @@
+{
+ "size": {
+ "longest_edge": 16777216,
+ "shortest_edge": 65536
+ },
+ "patch_size": 16,
+ "temporal_patch_size": 2,
+ "merge_size": 2,
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "processor_class": "Qwen3VLProcessor",
+ "image_processor_type": "Qwen2VLImageProcessorFast"
+}
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/tokenizer.json b/qwen3-vl-tokenizer/tokenizer.json
new file mode 100755
index 0000000000000000000000000000000000000000..3a5ba30c9c4ca4ddf9b0f723f2460826cd54f9f2
--- /dev/null
+++ b/qwen3-vl-tokenizer/tokenizer.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a5d85b6dcc535e6b93115a9ef287e6132fdbf30270da6218194ba742261173c7
+size 7032403
diff --git a/qwen3-vl-tokenizer/tokenizer_config.json b/qwen3-vl-tokenizer/tokenizer_config.json
new file mode 100755
index 0000000000000000000000000000000000000000..d3d3763207692c78780f4bf42d4dadf49a5c8012
--- /dev/null
+++ b/qwen3-vl-tokenizer/tokenizer_config.json
@@ -0,0 +1,239 @@
+{
+ "add_bos_token": false,
+ "add_prefix_space": false,
+ "added_tokens_decoder": {
+ "151643": {
+ "content": "<|endoftext|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151644": {
+ "content": "<|im_start|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151645": {
+ "content": "<|im_end|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151646": {
+ "content": "<|object_ref_start|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151647": {
+ "content": "<|object_ref_end|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151648": {
+ "content": "<|box_start|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151649": {
+ "content": "<|box_end|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151650": {
+ "content": "<|quad_start|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151651": {
+ "content": "<|quad_end|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151652": {
+ "content": "<|vision_start|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151653": {
+ "content": "<|vision_end|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151654": {
+ "content": "<|vision_pad|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151655": {
+ "content": "<|image_pad|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151656": {
+ "content": "<|video_pad|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": true
+ },
+ "151657": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151658": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151659": {
+ "content": "<|fim_prefix|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151660": {
+ "content": "<|fim_middle|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151661": {
+ "content": "<|fim_suffix|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151662": {
+ "content": "<|fim_pad|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151663": {
+ "content": "<|repo_name|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151664": {
+ "content": "<|file_sep|>",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151665": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151666": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151667": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ },
+ "151668": {
+ "content": "",
+ "lstrip": false,
+ "normalized": false,
+ "rstrip": false,
+ "single_word": false,
+ "special": false
+ }
+ },
+ "additional_special_tokens": [
+ "<|im_start|>",
+ "<|im_end|>",
+ "<|object_ref_start|>",
+ "<|object_ref_end|>",
+ "<|box_start|>",
+ "<|box_end|>",
+ "<|quad_start|>",
+ "<|quad_end|>",
+ "<|vision_start|>",
+ "<|vision_end|>",
+ "<|vision_pad|>",
+ "<|image_pad|>",
+ "<|video_pad|>"
+ ],
+ "bos_token": null,
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within XML tags:\\n\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n\\n\\nFor each function call, return a json object with function name and arguments within XML tags:\\n\\n{\\\"name\\\": , \\\"arguments\\\": }\\n<|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
+ "clean_up_tokenization_spaces": false,
+ "eos_token": "<|im_end|>",
+ "errors": "replace",
+ "model_max_length": 262144,
+ "pad_token": "<|endoftext|>",
+ "split_special_tokens": false,
+ "tokenizer_class": "Qwen2Tokenizer",
+ "unk_token": null
+}
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/video_preprocessor_config.json b/qwen3-vl-tokenizer/video_preprocessor_config.json
new file mode 100755
index 0000000000000000000000000000000000000000..3ba673a5ad7d4d13f54155ecd38b2a94a6dac8fe
--- /dev/null
+++ b/qwen3-vl-tokenizer/video_preprocessor_config.json
@@ -0,0 +1,21 @@
+{
+ "size": {
+ "longest_edge": 25165824,
+ "shortest_edge": 4096
+ },
+ "patch_size": 16,
+ "temporal_patch_size": 2,
+ "merge_size": 2,
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "processor_class": "Qwen3VLProcessor",
+ "video_processor_type": "Qwen3VLVideoProcessor"
+}
\ No newline at end of file
diff --git a/qwen3-vl-tokenizer/vocab.json b/qwen3-vl-tokenizer/vocab.json
new file mode 100755
index 0000000000000000000000000000000000000000..6c49fc63bcb109de13abe49e58f85a4cdba7b679
--- /dev/null
+++ b/qwen3-vl-tokenizer/vocab.json
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
+size 2776833
diff --git a/run_image_axcl_aarch64.sh b/run_image_axcl_aarch64.sh
new file mode 100755
index 0000000000000000000000000000000000000000..9afa0f04361f91f00460d3b8ec8889d2e03abe91
--- /dev/null
+++ b/run_image_axcl_aarch64.sh
@@ -0,0 +1,20 @@
+AXMODEL_DIR=./Qwen3-VL-2B-Instruct-ax8850/
+
+./main_axcl_aarch64 \
+--template_filename_axmodel "${AXMODEL_DIR}/qwen3_vl_text_p128_l%d_together.axmodel" \
+--axmodel_num 28 \
+--filename_image_encoder_axmodedl "${AXMODEL_DIR}/Qwen3-VL-2B-Instruct_vision.axmodel" \
+--use_mmap_load_embed 1 \
+--filename_tokenizer_model "http://127.0.0.1:8080" \
+--filename_post_axmodel "${AXMODEL_DIR}/qwen3_vl_text_post.axmodel" \
+--filename_tokens_embed "${AXMODEL_DIR}/model.embed_tokens.weight.bfloat16.bin" \
+--tokens_embed_num 151936 \
+--tokens_embed_size 2048 \
+--patch_size 16 \
+--live_print 1 \
+--video 0 \
+--img_width 384 \
+--img_height 384 \
+--vision_start_token_id 151652 \
+--post_config_path post_config.json \
+--devices 0,
diff --git a/run_video_axcl_aarch64.sh b/run_video_axcl_aarch64.sh
new file mode 100755
index 0000000000000000000000000000000000000000..019f639a58d960f9f5f756e6758814917a9afbc3
--- /dev/null
+++ b/run_video_axcl_aarch64.sh
@@ -0,0 +1,20 @@
+AXMODEL_DIR=./Qwen3-VL-2B-Instruct-ax8850/
+
+./main_axcl_aarch64 \
+--template_filename_axmodel "${AXMODEL_DIR}/qwen3_vl_text_p128_l%d_together.axmodel" \
+--axmodel_num 28 \
+--filename_image_encoder_axmodedl "${AXMODEL_DIR}/Qwen3-VL-2B-Instruct_vision.axmodel" \
+--use_mmap_load_embed 1 \
+--filename_tokenizer_model "http://127.0.0.1:8080" \
+--filename_post_axmodel "${AXMODEL_DIR}/qwen3_vl_text_post.axmodel" \
+--filename_tokens_embed "${AXMODEL_DIR}/model.embed_tokens.weight.bfloat16.bin" \
+--tokens_embed_num 151936 \
+--tokens_embed_size 2048 \
+--patch_size 16 \
+--live_print 1 \
+--video 1 \
+--img_width 384 \
+--img_height 384 \
+--vision_start_token_id 151652 \
+--post_config_path post_config.json \
+--devices 0,
diff --git a/tokenizer_images.py b/tokenizer_images.py
new file mode 100755
index 0000000000000000000000000000000000000000..945b792c8755ae187bfe79d00e3cd4961a492f8a
--- /dev/null
+++ b/tokenizer_images.py
@@ -0,0 +1,251 @@
+from transformers import AutoTokenizer, PreTrainedTokenizerFast
+from transformers.tokenization_utils_base import AddedToken
+from http.server import HTTPServer, BaseHTTPRequestHandler
+import json
+import argparse
+
+def _prompt_split_image(
+ image_seq_len,
+ image_rows,
+ image_cols,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+):
+ """Prompt with expanded image tokens for when the image is split into patches."""
+ text_split_images = ""
+ for n_h in range(image_rows):
+ for n_w in range(image_cols):
+ text_split_images += (
+ f"{fake_token_around_image}"
+ + f""
+ + f"{image_token}" * image_seq_len
+ )
+ text_split_images += "\n"
+
+ text_split_images += (
+ f"\n{fake_token_around_image}"
+ + f"{global_img_token}"
+ + f"{image_token}" * image_seq_len
+ + f"{fake_token_around_image}"
+ )
+ return text_split_images
+
+
+def _prompt_single_image(
+ image_seq_len, fake_token_around_image, image_token, global_img_token
+):
+ """Prompt with expanded image tokens for a single image."""
+ return (
+ f"{fake_token_around_image}"
+ + f"{global_img_token}"
+ + f"{image_token}" * image_seq_len
+ + f"{fake_token_around_image}"
+ )
+
+
+def get_image_prompt_string(
+ image_rows,
+ image_cols,
+ image_seq_len,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+):
+ if image_rows == 0 and image_cols == 0:
+ return _prompt_single_image(
+ image_seq_len,
+ fake_token_around_image=fake_token_around_image,
+ image_token=image_token,
+ global_img_token=global_img_token,
+ )
+ return _prompt_split_image(
+ image_seq_len,
+ image_rows,
+ image_cols,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+ )
+
+class Tokenizer_Http():
+
+ def __init__(self):
+
+ path = 'qwen3-vl-tokenizer'
+ self.tokenizer = AutoTokenizer.from_pretrained(path,
+ trust_remote_code=True,
+ use_fast=False)
+ self.token_ids_cache = []
+
+ def encode(self, content):
+ text = [f'<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{content}<|im_end|>\n<|im_start|>assistant\n']
+ input_ids = self.tokenizer(text)
+ return input_ids["input_ids"][0]
+
+ def encode_vpm(self, content="Describe this image.", num_img=1, img_token_num=256):
+
+ # official implementation
+ imgs_token = '<|vision_start|>' + '<|image_pad|>'*img_token_num + '<|vision_end|>'
+ imgs_token *= num_img
+ text = f'<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{imgs_token}{content}<|im_end|>\n<|im_start|>assistant\n'
+
+ output_kwargs = {'text_kwargs': {'padding': True, 'return_tensors': 'pt'}, 'images_kwargs': {'return_tensors': 'pt'}, 'audio_kwargs': {'padding': True, 'return_tensors': 'pt'}, 'videos_kwargs': {'fps': 2.0, 'return_tensors': 'pt'}, 'common_kwargs': {'return_tensors': 'pt'}}
+
+ text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
+ return text_inputs["input_ids"].tolist()[0]
+
+ def decode(self, token_ids):
+ self.token_ids_cache += token_ids
+ text = self.tokenizer.decode(self.token_ids_cache)
+ if "\ufffd" in text:
+ print("text 中包含非法字符")
+ return ""
+ else:
+ self.token_ids_cache.clear()
+ return text
+
+ @property
+ def bos_id(self):
+ return self.tokenizer.bos_token_id
+
+ @property
+ def eos_id(self):
+ return self.tokenizer.eos_token_id
+
+ @property
+ def bos_token(self):
+ return self.tokenizer.bos_token
+
+ @property
+ def eos_token(self):
+ return self.tokenizer.eos_token
+
+ @property
+ def img_start_token(self):
+ return self.tokenizer.encode("<|vision_start|>")[0]
+
+ @property
+ def img_context_token(self):
+ return self.tokenizer.encode("<|image_pad|>")[0]
+
+tokenizer = Tokenizer_Http()
+
+print(tokenizer.bos_id, tokenizer.bos_token, tokenizer.eos_id,
+ tokenizer.eos_token)
+token_ids = tokenizer.encode_vpm()
+# [151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287, 42140, 53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623, 48692, 100168, 110498, 1773, 151645, 151644, 872, 198,
+# 151646,
+# 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648,
+# 151647,
+# 198, 5501, 7512, 279, 2168, 19620, 13, 151645, 151644, 77091, 198]
+# 118
+print(token_ids)
+print(len(token_ids))
+token_ids = tokenizer.encode("hello world")
+# [151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287, 42140, 53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623, 48692, 100168, 110498, 1773, 151645, 151644, 872, 198, 14990, 1879, 151645, 151644, 77091, 198]
+# 47
+print(token_ids)
+print(len(token_ids))
+
+
+class Request(BaseHTTPRequestHandler):
+ #通过类继承,新定义类
+ timeout = 5
+ server_version = 'Apache'
+
+ def do_GET(self):
+ print(self.path)
+ #在新类中定义get的内容(当客户端向该服务端使用get请求时,本服务端将如下运行)
+ self.send_response(200)
+ self.send_header("type", "get") #设置响应头,可省略或设置多个
+ self.end_headers()
+
+ if self.path == '/bos_id':
+ bos_id = tokenizer.bos_id
+ # print(bos_id)
+ # to json
+ if bos_id is None:
+ msg = json.dumps({'bos_id': -1})
+ else:
+ msg = json.dumps({'bos_id': bos_id})
+ elif self.path == '/eos_id':
+ eos_id = tokenizer.eos_id
+ if eos_id is None:
+ msg = json.dumps({'eos_id': -1})
+ else:
+ msg = json.dumps({'eos_id': eos_id})
+ elif self.path == '/img_start_token':
+ img_start_token = tokenizer.img_start_token
+ if img_start_token is None:
+ msg = json.dumps({'img_start_token': -1})
+ else:
+ msg = json.dumps({'img_start_token': img_start_token})
+ elif self.path == '/img_context_token':
+ img_context_token = tokenizer.img_context_token
+ if img_context_token is None:
+ msg = json.dumps({'img_context_token': -1})
+ else:
+ msg = json.dumps({'img_context_token': img_context_token})
+ else:
+ msg = 'error'
+
+ print(msg)
+ msg = str(msg).encode() #转为str再转为byte格式
+
+ self.wfile.write(msg) #将byte格式的信息返回给客户端
+
+ def do_POST(self):
+ #在新类中定义post的内容(当客户端向该服务端使用post请求时,本服务端将如下运行)
+ data = self.rfile.read(int(
+ self.headers['content-length'])) #获取从客户端传入的参数(byte格式)
+ data = data.decode() #将byte格式转为str格式
+
+ self.send_response(200)
+ self.send_header("type", "post") #设置响应头,可省略或设置多个
+ self.end_headers()
+
+ if self.path == '/encode':
+ req = json.loads(data)
+ print(req)
+ prompt = req['text']
+ b_img_prompt = False
+ if 'img_prompt' in req:
+ b_img_prompt = req['img_prompt']
+ if b_img_prompt:
+ token_ids = tokenizer.encode_vpm(prompt, req["num_img"], req["img_token_num"])
+ else:
+ token_ids = tokenizer.encode(prompt)
+
+ if token_ids is None:
+ msg = json.dumps({'token_ids': -1})
+ else:
+ msg = json.dumps({'token_ids': token_ids})
+
+ elif self.path == '/decode':
+ req = json.loads(data)
+ token_ids = req['token_ids']
+ text = tokenizer.decode(token_ids)
+ if text is None:
+ msg = json.dumps({'text': ""})
+ else:
+ msg = json.dumps({'text': text})
+ else:
+ msg = 'error'
+ print(msg)
+ msg = str(msg).encode() #转为str再转为byte格式
+
+ self.wfile.write(msg) #将byte格式的信息返回给客户端
+
+
+if __name__ == "__main__":
+
+ args = argparse.ArgumentParser()
+ args.add_argument('--host', type=str, default='localhost')
+ args.add_argument('--port', type=int, default=8080)
+ args = args.parse_args()
+
+ host = (args.host, args.port) #设定地址与端口号,'localhost'等价于'127.0.0.1'
+ print('http://%s:%s' % host)
+ server = HTTPServer(host, Request) #根据地址端口号和新定义的类,创建服务器实例
+ server.serve_forever() #开启服务
diff --git a/tokenizer_video.py b/tokenizer_video.py
new file mode 100755
index 0000000000000000000000000000000000000000..85229fd4cc840d656ef1f0df37f81ceaf4dc62ab
--- /dev/null
+++ b/tokenizer_video.py
@@ -0,0 +1,251 @@
+from transformers import AutoTokenizer, PreTrainedTokenizerFast
+from transformers.tokenization_utils_base import AddedToken
+from http.server import HTTPServer, BaseHTTPRequestHandler
+import json
+import argparse
+
+def _prompt_split_image(
+ image_seq_len,
+ image_rows,
+ image_cols,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+):
+ """Prompt with expanded image tokens for when the image is split into patches."""
+ text_split_images = ""
+ for n_h in range(image_rows):
+ for n_w in range(image_cols):
+ text_split_images += (
+ f"{fake_token_around_image}"
+ + f""
+ + f"{image_token}" * image_seq_len
+ )
+ text_split_images += "\n"
+
+ text_split_images += (
+ f"\n{fake_token_around_image}"
+ + f"{global_img_token}"
+ + f"{image_token}" * image_seq_len
+ + f"{fake_token_around_image}"
+ )
+ return text_split_images
+
+
+def _prompt_single_image(
+ image_seq_len, fake_token_around_image, image_token, global_img_token
+):
+ """Prompt with expanded image tokens for a single image."""
+ return (
+ f"{fake_token_around_image}"
+ + f"{global_img_token}"
+ + f"{image_token}" * image_seq_len
+ + f"{fake_token_around_image}"
+ )
+
+
+def get_image_prompt_string(
+ image_rows,
+ image_cols,
+ image_seq_len,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+):
+ if image_rows == 0 and image_cols == 0:
+ return _prompt_single_image(
+ image_seq_len,
+ fake_token_around_image=fake_token_around_image,
+ image_token=image_token,
+ global_img_token=global_img_token,
+ )
+ return _prompt_split_image(
+ image_seq_len,
+ image_rows,
+ image_cols,
+ fake_token_around_image,
+ image_token,
+ global_img_token,
+ )
+
+class Tokenizer_Http():
+
+ def __init__(self):
+
+ path = 'qwen3-vl-tokenizer'
+ self.tokenizer = AutoTokenizer.from_pretrained(path,
+ trust_remote_code=True,
+ use_fast=False)
+ self.token_ids_cache = []
+
+ def encode(self, content):
+ text = [f'<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{content}<|im_end|>\n<|im_start|>assistant\n']
+ input_ids = self.tokenizer(text)
+ return input_ids["input_ids"][0]
+
+ def encode_vpm(self, content="Describe this image.", num_img=1, img_token_num=256):
+
+ # official implementation
+ imgs_token = '<|vision_start|>' + '<|video_pad|>'*img_token_num*num_img + '<|vision_end|>'
+
+ text = f'<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n{imgs_token}{content}<|im_end|>\n<|im_start|>assistant\n'
+
+ output_kwargs = {'text_kwargs': {'padding': True, 'return_tensors': 'pt'}, 'images_kwargs': {'return_tensors': 'pt'}, 'audio_kwargs': {'padding': True, 'return_tensors': 'pt'}, 'videos_kwargs': {'fps': 2.0, 'return_tensors': 'pt'}, 'common_kwargs': {'return_tensors': 'pt'}}
+
+ text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
+ return text_inputs["input_ids"].tolist()[0]
+
+ def decode(self, token_ids):
+ self.token_ids_cache += token_ids
+ text = self.tokenizer.decode(self.token_ids_cache)
+ if "\ufffd" in text:
+ print("text 中包含非法字符")
+ return ""
+ else:
+ self.token_ids_cache.clear()
+ return text
+
+ @property
+ def bos_id(self):
+ return self.tokenizer.bos_token_id
+
+ @property
+ def eos_id(self):
+ return self.tokenizer.eos_token_id
+
+ @property
+ def bos_token(self):
+ return self.tokenizer.bos_token
+
+ @property
+ def eos_token(self):
+ return self.tokenizer.eos_token
+
+ @property
+ def img_start_token(self):
+ return self.tokenizer.encode("<|vision_start|>")[0]
+
+ @property
+ def img_context_token(self):
+ return self.tokenizer.encode("<|video_pad|>")[0]
+
+tokenizer = Tokenizer_Http()
+
+print(tokenizer.bos_id, tokenizer.bos_token, tokenizer.eos_id,
+ tokenizer.eos_token)
+token_ids = tokenizer.encode_vpm()
+# [151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287, 42140, 53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623, 48692, 100168, 110498, 1773, 151645, 151644, 872, 198,
+# 151646,
+# 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648, 151648,
+# 151647,
+# 198, 5501, 7512, 279, 2168, 19620, 13, 151645, 151644, 77091, 198]
+# 118
+print(token_ids)
+print(len(token_ids))
+token_ids = tokenizer.encode("hello world")
+# [151644, 8948, 198, 56568, 104625, 100633, 104455, 104800, 101101, 32022, 102022, 99602, 100013, 9370, 90286, 21287, 42140, 53772, 35243, 26288, 104949, 3837, 105205, 109641, 67916, 30698, 11, 54851, 46944, 115404, 42192, 99441, 100623, 48692, 100168, 110498, 1773, 151645, 151644, 872, 198, 14990, 1879, 151645, 151644, 77091, 198]
+# 47
+print(token_ids)
+print(len(token_ids))
+
+
+class Request(BaseHTTPRequestHandler):
+ #通过类继承,新定义类
+ timeout = 5
+ server_version = 'Apache'
+
+ def do_GET(self):
+ print(self.path)
+ #在新类中定义get的内容(当客户端向该服务端使用get请求时,本服务端将如下运行)
+ self.send_response(200)
+ self.send_header("type", "get") #设置响应头,可省略或设置多个
+ self.end_headers()
+
+ if self.path == '/bos_id':
+ bos_id = tokenizer.bos_id
+ # print(bos_id)
+ # to json
+ if bos_id is None:
+ msg = json.dumps({'bos_id': -1})
+ else:
+ msg = json.dumps({'bos_id': bos_id})
+ elif self.path == '/eos_id':
+ eos_id = tokenizer.eos_id
+ if eos_id is None:
+ msg = json.dumps({'eos_id': -1})
+ else:
+ msg = json.dumps({'eos_id': eos_id})
+ elif self.path == '/img_start_token':
+ img_start_token = tokenizer.img_start_token
+ if img_start_token is None:
+ msg = json.dumps({'img_start_token': -1})
+ else:
+ msg = json.dumps({'img_start_token': img_start_token})
+ elif self.path == '/img_context_token':
+ img_context_token = tokenizer.img_context_token
+ if img_context_token is None:
+ msg = json.dumps({'img_context_token': -1})
+ else:
+ msg = json.dumps({'img_context_token': img_context_token})
+ else:
+ msg = 'error'
+
+ print(msg)
+ msg = str(msg).encode() #转为str再转为byte格式
+
+ self.wfile.write(msg) #将byte格式的信息返回给客户端
+
+ def do_POST(self):
+ #在新类中定义post的内容(当客户端向该服务端使用post请求时,本服务端将如下运行)
+ data = self.rfile.read(int(
+ self.headers['content-length'])) #获取从客户端传入的参数(byte格式)
+ data = data.decode() #将byte格式转为str格式
+
+ self.send_response(200)
+ self.send_header("type", "post") #设置响应头,可省略或设置多个
+ self.end_headers()
+
+ if self.path == '/encode':
+ req = json.loads(data)
+ print(req)
+ prompt = req['text']
+ b_img_prompt = False
+ if 'img_prompt' in req:
+ b_img_prompt = req['img_prompt']
+ if b_img_prompt:
+ token_ids = tokenizer.encode_vpm(prompt, req["num_img"], req["img_token_num"])
+ else:
+ token_ids = tokenizer.encode(prompt)
+
+ if token_ids is None:
+ msg = json.dumps({'token_ids': -1})
+ else:
+ msg = json.dumps({'token_ids': token_ids})
+
+ elif self.path == '/decode':
+ req = json.loads(data)
+ token_ids = req['token_ids']
+ text = tokenizer.decode(token_ids)
+ if text is None:
+ msg = json.dumps({'text': ""})
+ else:
+ msg = json.dumps({'text': text})
+ else:
+ msg = 'error'
+ print(msg)
+ msg = str(msg).encode() #转为str再转为byte格式
+
+ self.wfile.write(msg) #将byte格式的信息返回给客户端
+
+
+if __name__ == "__main__":
+
+ args = argparse.ArgumentParser()
+ args.add_argument('--host', type=str, default='localhost')
+ args.add_argument('--port', type=int, default=8080)
+ args = args.parse_args()
+
+ host = (args.host, args.port) #设定地址与端口号,'localhost'等价于'127.0.0.1'
+ print('http://%s:%s' % host)
+ server = HTTPServer(host, Request) #根据地址端口号和新定义的类,创建服务器实例
+ server.serve_forever() #开启服务
diff --git a/video/out_0001.jpg b/video/out_0001.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..aa5dee624b69f4b703535b43529bbc7e62eb545c
--- /dev/null
+++ b/video/out_0001.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:568012b352a060d01c86143bc4322a60bfd6477e405a1f64a43bc3f9a5bfdf6f
+size 41632
diff --git a/video/out_0002.jpg b/video/out_0002.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..8c7483d912ac44e629a44dccc619f5a8f503b429
--- /dev/null
+++ b/video/out_0002.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a013c5b6d03f784271b5b8dc0a82e44356fe5a61b78ef91f5e72d64fc10c9a3c
+size 51834
diff --git a/video/out_0003.jpg b/video/out_0003.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..cb5d625ee665d7d064c8beb09f9039ff96a15696
--- /dev/null
+++ b/video/out_0003.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b5cd05f19aa021d87209d408c04637a8c55ea7b80dce8934e855becb57817468
+size 77748
diff --git a/video/out_0004.jpg b/video/out_0004.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..f9780f07a67083960b26fb52edd24a81e4699a7b
--- /dev/null
+++ b/video/out_0004.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a637ef3f3226843fe46e7d602c94013cf8fef69332f2cec8a78c8ce23015d9c5
+size 51199
diff --git a/video/out_0005.jpg b/video/out_0005.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..a3a899cc628f7e8c21992fc8f66b1b27a2406ae7
--- /dev/null
+++ b/video/out_0005.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a296203caa4c7b4f906cbafbbd06c13af275b6480124a431a4a10723db75f248
+size 65354
diff --git a/video/out_0006.jpg b/video/out_0006.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..f2a4cb1fa1ee759810badc22502fa220c2bcab54
--- /dev/null
+++ b/video/out_0006.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d433b4982ccb7ef919f5f1d3944e6462267a0f947ca650b4818077f1b3385714
+size 73630
diff --git a/video/out_0007.jpg b/video/out_0007.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..baf9a769f81c811cc617f135e305e9926106c439
--- /dev/null
+++ b/video/out_0007.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:522dc68ef77184a6958c97f15c63a037ff442c81662cb4ec23ba48da3b446a30
+size 63891
diff --git a/video/out_0008.jpg b/video/out_0008.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..d78209fc61ba35643c2c6825b9d7ce736d0eddbe
--- /dev/null
+++ b/video/out_0008.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f33d23d8c2b85d32733a7752a687a847cfa3dcc5aef4a5dd5a0a3fdc37395e16
+size 53209
diff --git a/video/out_0009.jpg b/video/out_0009.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..79d996f38add57edc8241d31c55caafd3f9cb9e2
--- /dev/null
+++ b/video/out_0009.jpg
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:68271292fc89d53900a0d9d2ce3da466084ee0d9ef4e6c64a71c09500641f5a5
+size 45390