LittleMouse commited on
Commit ·
5ad6791
1
Parent(s): cda5e06
Add file
Browse files- .gitattributes +2 -0
- internvl3_1b_ax630c/internvl3_1b_vit.axmodel +3 -0
- internvl3_1b_ax630c/model.embed_tokens.weight.bfloat16.bin +3 -0
- internvl3_1b_ax630c/qwen2_p128_l0_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l10_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l11_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l12_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l13_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l14_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l15_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l16_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l17_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l18_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l19_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l1_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l20_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l21_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l22_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l23_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l2_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l3_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l4_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l5_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l6_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l7_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l8_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_p128_l9_together.axmodel +3 -0
- internvl3_1b_ax630c/qwen2_post.axmodel +3 -0
- internvl3_tokenizer/added_tokens.json +33 -0
- internvl3_tokenizer/config.json +224 -0
- internvl3_tokenizer/generation_config.json +4 -0
- internvl3_tokenizer/merges.txt +0 -0
- internvl3_tokenizer/preprocessor_config.json +19 -0
- internvl3_tokenizer/special_tokens_map.json +31 -0
- internvl3_tokenizer/tokenizer.json +0 -0
- internvl3_tokenizer/tokenizer_config.json +281 -0
- internvl3_tokenizer/vocab.json +0 -0
- main_ctx +3 -0
- run_internvl_3_1b_448_ax630c.sh +12 -0
- tokenizer_internvl3-1B-448-ax650.py +241 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.axmodel filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
main_ctx filter=lfs diff=lfs merge=lfs -text
|
internvl3_1b_ax630c/internvl3_1b_vit.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56667d1cd9ae8af5f2d4b5c833df83a17f067e4bc88285e18f2af0ee0ca5ba69
|
| 3 |
+
size 426316355
|
internvl3_1b_ax630c/model.embed_tokens.weight.bfloat16.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9cecf2aa3a9d0762e525990561e75f08ab5df970d918f53e1b72dd73c81a6d34
|
| 3 |
+
size 271799808
|
internvl3_1b_ax630c/qwen2_p128_l0_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2ebffcc2e6581aae23d14c04e1615cf2351409bbb7222fe82c2bfc114316ed0f
|
| 3 |
+
size 17120990
|
internvl3_1b_ax630c/qwen2_p128_l10_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f5f0df0689a5e79d0183b0ff189f8c6bf4abe57c1aa0c22fe58fcc5bbcd78400
|
| 3 |
+
size 17121006
|
internvl3_1b_ax630c/qwen2_p128_l11_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d9485c7df5101178bdd84993f40449770f2e027fafe4db06fcfbf0b442729ee8
|
| 3 |
+
size 17121022
|
internvl3_1b_ax630c/qwen2_p128_l12_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7d81aef9dddd5072542a73e69dbff994b8a8dfa05e9244f15abca4bcd2432fa
|
| 3 |
+
size 17121014
|
internvl3_1b_ax630c/qwen2_p128_l13_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf6343d402188afd8b367849ebec6d77f435dd3b4700862d808c8f526c671ac7
|
| 3 |
+
size 17120998
|
internvl3_1b_ax630c/qwen2_p128_l14_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:10287c78f1a81e668b64fffeb114a7f0b7ffc5697744d5f0872167d0c89d203a
|
| 3 |
+
size 17121014
|
internvl3_1b_ax630c/qwen2_p128_l15_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22793e4a7b7639751f295ecb06dbae447d60ac92d747e33ed25dc445efcd3c27
|
| 3 |
+
size 17120998
|
internvl3_1b_ax630c/qwen2_p128_l16_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c72f6a5f80a79ddf414d69a08e7e56b201cbb707b0bfe403c0b2ca0e684cd99c
|
| 3 |
+
size 17120998
|
internvl3_1b_ax630c/qwen2_p128_l17_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e0c2a83abbb3d5e7143f76a04197dc986625931d8000e7bc66fbedd642085be
|
| 3 |
+
size 17120966
|
internvl3_1b_ax630c/qwen2_p128_l18_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:72799e7c2df4575a12ca7e4fbb1d79d23a43ef007544b03067cd5c304f3b0297
|
| 3 |
+
size 17121006
|
internvl3_1b_ax630c/qwen2_p128_l19_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:619e6a19ba53dc2702c39c6df25bc2f4c8e2402a32b09c7a0342718e045e412c
|
| 3 |
+
size 17120998
|
internvl3_1b_ax630c/qwen2_p128_l1_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8391610f4e220f7daa7670f02c5a4537e18c7e546bcd2ac454d7bdccd37d0a25
|
| 3 |
+
size 17121022
|
internvl3_1b_ax630c/qwen2_p128_l20_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a900cf17474ad2ebf29fbc3f44b2bbaf18cf7a11250366a6e459f8cd5253a9d3
|
| 3 |
+
size 17121014
|
internvl3_1b_ax630c/qwen2_p128_l21_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80a9d1198593fa482b54bef8ad9287f6db11b33276826fc1fbef87b8f61d6968
|
| 3 |
+
size 17120998
|
internvl3_1b_ax630c/qwen2_p128_l22_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:59ac8c6fd8e86a558ce08b7e228b50f71331266abc4af4f62b0398214d7da26a
|
| 3 |
+
size 17120982
|
internvl3_1b_ax630c/qwen2_p128_l23_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9f545c11385c49d42578a3779eb82b07b328ae5a15bf3f459713b9b7e87fca55
|
| 3 |
+
size 17121014
|
internvl3_1b_ax630c/qwen2_p128_l2_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb35816b33f228ac3c87112dcbdf0b1029ccb25c113d2988cf7b4e12502cd6b2
|
| 3 |
+
size 17121014
|
internvl3_1b_ax630c/qwen2_p128_l3_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c64285f4533ac3732b146deec978b133f13777c9b6237cb218eb87179c1a3512
|
| 3 |
+
size 17121006
|
internvl3_1b_ax630c/qwen2_p128_l4_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:714da73bd13e60c39ec623fe2ff14229c1212bccfe03d5082ebfb268827b1852
|
| 3 |
+
size 17121022
|
internvl3_1b_ax630c/qwen2_p128_l5_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2c0fc9013c34f931c1a97072ee978e891191eadf0128f39501b96377f0fb3aa4
|
| 3 |
+
size 17121022
|
internvl3_1b_ax630c/qwen2_p128_l6_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c3ac3c960db100d957eb5f2ff1a7d83de510cc3f66734d201b35ec522678769
|
| 3 |
+
size 17121022
|
internvl3_1b_ax630c/qwen2_p128_l7_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d7a2da624aebf55de47c8cd11fb04e589825b72f1a9c2d8afb6d25d38656ffc
|
| 3 |
+
size 17120982
|
internvl3_1b_ax630c/qwen2_p128_l8_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f588b8b6eaa2b18bbbc2bd79020361ace0d47bd2a0b4b70b061a88b57e0a3389
|
| 3 |
+
size 17121006
|
internvl3_1b_ax630c/qwen2_p128_l9_together.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:167fab97d04593530ed7e24681407d6a9685488abc53d76a79f6e58100e71601
|
| 3 |
+
size 17120982
|
internvl3_1b_ax630c/qwen2_post.axmodel
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:971894c69fcb4573f54e07b109b49a71152327386a230810589f23f3a4eed425
|
| 3 |
+
size 139704503
|
internvl3_tokenizer/added_tokens.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</box>": 151673,
|
| 3 |
+
"</img>": 151666,
|
| 4 |
+
"</quad>": 151669,
|
| 5 |
+
"</ref>": 151671,
|
| 6 |
+
"</tool_call>": 151658,
|
| 7 |
+
"<IMG_CONTEXT>": 151667,
|
| 8 |
+
"<box>": 151672,
|
| 9 |
+
"<img>": 151665,
|
| 10 |
+
"<quad>": 151668,
|
| 11 |
+
"<ref>": 151670,
|
| 12 |
+
"<tool_call>": 151657,
|
| 13 |
+
"<|box_end|>": 151649,
|
| 14 |
+
"<|box_start|>": 151648,
|
| 15 |
+
"<|endoftext|>": 151643,
|
| 16 |
+
"<|file_sep|>": 151664,
|
| 17 |
+
"<|fim_middle|>": 151660,
|
| 18 |
+
"<|fim_pad|>": 151662,
|
| 19 |
+
"<|fim_prefix|>": 151659,
|
| 20 |
+
"<|fim_suffix|>": 151661,
|
| 21 |
+
"<|im_end|>": 151645,
|
| 22 |
+
"<|im_start|>": 151644,
|
| 23 |
+
"<|image_pad|>": 151655,
|
| 24 |
+
"<|object_ref_end|>": 151647,
|
| 25 |
+
"<|object_ref_start|>": 151646,
|
| 26 |
+
"<|quad_end|>": 151651,
|
| 27 |
+
"<|quad_start|>": 151650,
|
| 28 |
+
"<|repo_name|>": 151663,
|
| 29 |
+
"<|video_pad|>": 151656,
|
| 30 |
+
"<|vision_end|>": 151653,
|
| 31 |
+
"<|vision_pad|>": 151654,
|
| 32 |
+
"<|vision_start|>": 151652
|
| 33 |
+
}
|
internvl3_tokenizer/config.json
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_commit_hash": null,
|
| 3 |
+
"_name_or_path": "/mnt/petrelfs/wangweiyun/workspace_wwy/open_source/InternVL/internvl_chat/work_dirs/internvl_chat_v3_0/InternVL3_0-1B-MPO-try0-2",
|
| 4 |
+
"architectures": [
|
| 5 |
+
"InternVLChatModel"
|
| 6 |
+
],
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_internvl_chat.InternVLChatConfig",
|
| 9 |
+
"AutoModel": "modeling_internvl_chat.InternVLChatModel",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_internvl_chat.InternVLChatModel"
|
| 11 |
+
},
|
| 12 |
+
"downsample_ratio": 0.5,
|
| 13 |
+
"dynamic_image_size": true,
|
| 14 |
+
"force_image_size": 448,
|
| 15 |
+
"hidden_size": 896,
|
| 16 |
+
"image_fold": null,
|
| 17 |
+
"llm_config": {
|
| 18 |
+
"_attn_implementation_autoset": true,
|
| 19 |
+
"_name_or_path": "./pretrained/Qwen2.5-32B-Instruct",
|
| 20 |
+
"add_cross_attention": false,
|
| 21 |
+
"architectures": [
|
| 22 |
+
"Qwen2ForCausalLM"
|
| 23 |
+
],
|
| 24 |
+
"attention_dropout": 0.0,
|
| 25 |
+
"bad_words_ids": null,
|
| 26 |
+
"begin_suppress_tokens": null,
|
| 27 |
+
"bos_token_id": 151643,
|
| 28 |
+
"chunk_size_feed_forward": 0,
|
| 29 |
+
"cross_attention_hidden_size": null,
|
| 30 |
+
"decoder_start_token_id": null,
|
| 31 |
+
"diversity_penalty": 0.0,
|
| 32 |
+
"do_sample": false,
|
| 33 |
+
"early_stopping": false,
|
| 34 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 35 |
+
"eos_token_id": 151643,
|
| 36 |
+
"exponential_decay_length_penalty": null,
|
| 37 |
+
"finetuning_task": null,
|
| 38 |
+
"forced_bos_token_id": null,
|
| 39 |
+
"forced_eos_token_id": null,
|
| 40 |
+
"hidden_act": "silu",
|
| 41 |
+
"hidden_size": 896,
|
| 42 |
+
"id2label": {
|
| 43 |
+
"0": "LABEL_0",
|
| 44 |
+
"1": "LABEL_1"
|
| 45 |
+
},
|
| 46 |
+
"initializer_range": 0.02,
|
| 47 |
+
"intermediate_size": 4864,
|
| 48 |
+
"is_decoder": false,
|
| 49 |
+
"is_encoder_decoder": false,
|
| 50 |
+
"label2id": {
|
| 51 |
+
"LABEL_0": 0,
|
| 52 |
+
"LABEL_1": 1
|
| 53 |
+
},
|
| 54 |
+
"length_penalty": 1.0,
|
| 55 |
+
"max_length": 20,
|
| 56 |
+
"max_position_embeddings": 32768,
|
| 57 |
+
"max_window_layers": 70,
|
| 58 |
+
"min_length": 0,
|
| 59 |
+
"model_type": "qwen2",
|
| 60 |
+
"moe_config": null,
|
| 61 |
+
"no_repeat_ngram_size": 0,
|
| 62 |
+
"num_attention_heads": 14,
|
| 63 |
+
"num_beam_groups": 1,
|
| 64 |
+
"num_beams": 1,
|
| 65 |
+
"num_hidden_layers": 24,
|
| 66 |
+
"num_key_value_heads": 2,
|
| 67 |
+
"num_return_sequences": 1,
|
| 68 |
+
"output_attentions": false,
|
| 69 |
+
"output_hidden_states": false,
|
| 70 |
+
"output_scores": false,
|
| 71 |
+
"pad_token_id": null,
|
| 72 |
+
"prefix": null,
|
| 73 |
+
"problem_type": null,
|
| 74 |
+
"pruned_heads": {},
|
| 75 |
+
"remove_invalid_values": false,
|
| 76 |
+
"repetition_penalty": 1.0,
|
| 77 |
+
"return_dict": true,
|
| 78 |
+
"return_dict_in_generate": false,
|
| 79 |
+
"rms_norm_eps": 1e-06,
|
| 80 |
+
"rope_scaling": {
|
| 81 |
+
"factor": 2.0,
|
| 82 |
+
"rope_type": "dynamic",
|
| 83 |
+
"type": "dynamic"
|
| 84 |
+
},
|
| 85 |
+
"rope_theta": 1000000.0,
|
| 86 |
+
"sep_token_id": null,
|
| 87 |
+
"sliding_window": null,
|
| 88 |
+
"suppress_tokens": null,
|
| 89 |
+
"task_specific_params": null,
|
| 90 |
+
"temperature": 1.0,
|
| 91 |
+
"tf_legacy_loss": false,
|
| 92 |
+
"tie_encoder_decoder": false,
|
| 93 |
+
"tie_word_embeddings": false,
|
| 94 |
+
"tokenizer_class": null,
|
| 95 |
+
"top_k": 50,
|
| 96 |
+
"top_p": 1.0,
|
| 97 |
+
"torch_dtype": "bfloat16",
|
| 98 |
+
"torchscript": false,
|
| 99 |
+
"transformers_version": "4.48.3",
|
| 100 |
+
"typical_p": 1.0,
|
| 101 |
+
"use_bfloat16": true,
|
| 102 |
+
"use_cache": false,
|
| 103 |
+
"use_sliding_window": false,
|
| 104 |
+
"vocab_size": 151674
|
| 105 |
+
},
|
| 106 |
+
"max_dynamic_patch": 12,
|
| 107 |
+
"min_dynamic_patch": 1,
|
| 108 |
+
"model_type": "internvl_chat",
|
| 109 |
+
"pad2square": false,
|
| 110 |
+
"ps_version": "v2",
|
| 111 |
+
"select_layer": -1,
|
| 112 |
+
"system_message": null,
|
| 113 |
+
"template": "internvl2_5",
|
| 114 |
+
"tie_word_embeddings": false,
|
| 115 |
+
"torch_dtype": "bfloat16",
|
| 116 |
+
"transformers_version": null,
|
| 117 |
+
"use_backbone_lora": 0,
|
| 118 |
+
"use_llm_lora": 0,
|
| 119 |
+
"use_thumbnail": true,
|
| 120 |
+
"vision_config": {
|
| 121 |
+
"_attn_implementation_autoset": true,
|
| 122 |
+
"_name_or_path": "OpenGVLab/InternViT-6B-448px-V1-5",
|
| 123 |
+
"add_cross_attention": false,
|
| 124 |
+
"architectures": [
|
| 125 |
+
"InternVisionModel"
|
| 126 |
+
],
|
| 127 |
+
"attention_dropout": 0.0,
|
| 128 |
+
"auto_map": {
|
| 129 |
+
"AutoConfig": "configuration_intern_vit.InternVisionConfig",
|
| 130 |
+
"AutoModel": "modeling_intern_vit.InternVisionModel"
|
| 131 |
+
},
|
| 132 |
+
"bad_words_ids": null,
|
| 133 |
+
"begin_suppress_tokens": null,
|
| 134 |
+
"bos_token_id": null,
|
| 135 |
+
"capacity_factor": 1.2,
|
| 136 |
+
"chunk_size_feed_forward": 0,
|
| 137 |
+
"cross_attention_hidden_size": null,
|
| 138 |
+
"decoder_start_token_id": null,
|
| 139 |
+
"diversity_penalty": 0.0,
|
| 140 |
+
"do_sample": false,
|
| 141 |
+
"drop_path_rate": 0.1,
|
| 142 |
+
"dropout": 0.0,
|
| 143 |
+
"early_stopping": false,
|
| 144 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 145 |
+
"eos_token_id": null,
|
| 146 |
+
"eval_capacity_factor": 1.4,
|
| 147 |
+
"exponential_decay_length_penalty": null,
|
| 148 |
+
"finetuning_task": null,
|
| 149 |
+
"forced_bos_token_id": null,
|
| 150 |
+
"forced_eos_token_id": null,
|
| 151 |
+
"hidden_act": "gelu",
|
| 152 |
+
"hidden_size": 1024,
|
| 153 |
+
"id2label": {
|
| 154 |
+
"0": "LABEL_0",
|
| 155 |
+
"1": "LABEL_1"
|
| 156 |
+
},
|
| 157 |
+
"image_size": 448,
|
| 158 |
+
"initializer_factor": 0.1,
|
| 159 |
+
"initializer_range": 1e-10,
|
| 160 |
+
"intermediate_size": 4096,
|
| 161 |
+
"is_decoder": false,
|
| 162 |
+
"is_encoder_decoder": false,
|
| 163 |
+
"label2id": {
|
| 164 |
+
"LABEL_0": 0,
|
| 165 |
+
"LABEL_1": 1
|
| 166 |
+
},
|
| 167 |
+
"laux_allreduce": "all_nodes",
|
| 168 |
+
"layer_norm_eps": 1e-06,
|
| 169 |
+
"length_penalty": 1.0,
|
| 170 |
+
"max_length": 20,
|
| 171 |
+
"min_length": 0,
|
| 172 |
+
"model_type": "intern_vit_6b",
|
| 173 |
+
"moe_coeff_ratio": 0.5,
|
| 174 |
+
"moe_intermediate_size": 768,
|
| 175 |
+
"moe_output_scale": 4.0,
|
| 176 |
+
"no_repeat_ngram_size": 0,
|
| 177 |
+
"noisy_gate_policy": "RSample_before",
|
| 178 |
+
"norm_type": "layer_norm",
|
| 179 |
+
"num_attention_heads": 16,
|
| 180 |
+
"num_beam_groups": 1,
|
| 181 |
+
"num_beams": 1,
|
| 182 |
+
"num_channels": 3,
|
| 183 |
+
"num_experts": 8,
|
| 184 |
+
"num_hidden_layers": 24,
|
| 185 |
+
"num_return_sequences": 1,
|
| 186 |
+
"num_routed_experts": 4,
|
| 187 |
+
"num_shared_experts": 4,
|
| 188 |
+
"output_attentions": false,
|
| 189 |
+
"output_hidden_states": false,
|
| 190 |
+
"output_scores": false,
|
| 191 |
+
"pad_token_id": null,
|
| 192 |
+
"patch_size": 14,
|
| 193 |
+
"prefix": null,
|
| 194 |
+
"problem_type": null,
|
| 195 |
+
"pruned_heads": {},
|
| 196 |
+
"qk_normalization": false,
|
| 197 |
+
"qkv_bias": true,
|
| 198 |
+
"remove_invalid_values": false,
|
| 199 |
+
"repetition_penalty": 1.0,
|
| 200 |
+
"return_dict": true,
|
| 201 |
+
"return_dict_in_generate": false,
|
| 202 |
+
"sep_token_id": null,
|
| 203 |
+
"shared_expert_intermediate_size": 3072,
|
| 204 |
+
"suppress_tokens": null,
|
| 205 |
+
"task_specific_params": null,
|
| 206 |
+
"temperature": 1.0,
|
| 207 |
+
"tf_legacy_loss": false,
|
| 208 |
+
"tie_encoder_decoder": false,
|
| 209 |
+
"tie_word_embeddings": true,
|
| 210 |
+
"tokenizer_class": null,
|
| 211 |
+
"top_k": 50,
|
| 212 |
+
"top_p": 1.0,
|
| 213 |
+
"torch_dtype": "bfloat16",
|
| 214 |
+
"torchscript": false,
|
| 215 |
+
"transformers_version": "4.48.3",
|
| 216 |
+
"typical_p": 1.0,
|
| 217 |
+
"use_bfloat16": true,
|
| 218 |
+
"use_flash_attn": true,
|
| 219 |
+
"use_moe": false,
|
| 220 |
+
"use_residual": true,
|
| 221 |
+
"use_rts": false,
|
| 222 |
+
"use_weighted_residual": false
|
| 223 |
+
}
|
| 224 |
+
}
|
internvl3_tokenizer/generation_config.json
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"transformers_version": "4.48.3"
|
| 4 |
+
}
|
internvl3_tokenizer/merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
internvl3_tokenizer/preprocessor_config.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"crop_size": 448,
|
| 3 |
+
"do_center_crop": true,
|
| 4 |
+
"do_normalize": true,
|
| 5 |
+
"do_resize": true,
|
| 6 |
+
"feature_extractor_type": "CLIPFeatureExtractor",
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.485,
|
| 9 |
+
0.456,
|
| 10 |
+
0.406
|
| 11 |
+
],
|
| 12 |
+
"image_std": [
|
| 13 |
+
0.229,
|
| 14 |
+
0.224,
|
| 15 |
+
0.225
|
| 16 |
+
],
|
| 17 |
+
"resample": 3,
|
| 18 |
+
"size": 448
|
| 19 |
+
}
|
internvl3_tokenizer/special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
internvl3_tokenizer/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
internvl3_tokenizer/tokenizer_config.json
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"add_prefix_space": false,
|
| 5 |
+
"added_tokens_decoder": {
|
| 6 |
+
"151643": {
|
| 7 |
+
"content": "<|endoftext|>",
|
| 8 |
+
"lstrip": false,
|
| 9 |
+
"normalized": false,
|
| 10 |
+
"rstrip": false,
|
| 11 |
+
"single_word": false,
|
| 12 |
+
"special": true
|
| 13 |
+
},
|
| 14 |
+
"151644": {
|
| 15 |
+
"content": "<|im_start|>",
|
| 16 |
+
"lstrip": false,
|
| 17 |
+
"normalized": false,
|
| 18 |
+
"rstrip": false,
|
| 19 |
+
"single_word": false,
|
| 20 |
+
"special": true
|
| 21 |
+
},
|
| 22 |
+
"151645": {
|
| 23 |
+
"content": "<|im_end|>",
|
| 24 |
+
"lstrip": false,
|
| 25 |
+
"normalized": false,
|
| 26 |
+
"rstrip": false,
|
| 27 |
+
"single_word": false,
|
| 28 |
+
"special": true
|
| 29 |
+
},
|
| 30 |
+
"151646": {
|
| 31 |
+
"content": "<|object_ref_start|>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": false,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false,
|
| 36 |
+
"special": true
|
| 37 |
+
},
|
| 38 |
+
"151647": {
|
| 39 |
+
"content": "<|object_ref_end|>",
|
| 40 |
+
"lstrip": false,
|
| 41 |
+
"normalized": false,
|
| 42 |
+
"rstrip": false,
|
| 43 |
+
"single_word": false,
|
| 44 |
+
"special": true
|
| 45 |
+
},
|
| 46 |
+
"151648": {
|
| 47 |
+
"content": "<|box_start|>",
|
| 48 |
+
"lstrip": false,
|
| 49 |
+
"normalized": false,
|
| 50 |
+
"rstrip": false,
|
| 51 |
+
"single_word": false,
|
| 52 |
+
"special": true
|
| 53 |
+
},
|
| 54 |
+
"151649": {
|
| 55 |
+
"content": "<|box_end|>",
|
| 56 |
+
"lstrip": false,
|
| 57 |
+
"normalized": false,
|
| 58 |
+
"rstrip": false,
|
| 59 |
+
"single_word": false,
|
| 60 |
+
"special": true
|
| 61 |
+
},
|
| 62 |
+
"151650": {
|
| 63 |
+
"content": "<|quad_start|>",
|
| 64 |
+
"lstrip": false,
|
| 65 |
+
"normalized": false,
|
| 66 |
+
"rstrip": false,
|
| 67 |
+
"single_word": false,
|
| 68 |
+
"special": true
|
| 69 |
+
},
|
| 70 |
+
"151651": {
|
| 71 |
+
"content": "<|quad_end|>",
|
| 72 |
+
"lstrip": false,
|
| 73 |
+
"normalized": false,
|
| 74 |
+
"rstrip": false,
|
| 75 |
+
"single_word": false,
|
| 76 |
+
"special": true
|
| 77 |
+
},
|
| 78 |
+
"151652": {
|
| 79 |
+
"content": "<|vision_start|>",
|
| 80 |
+
"lstrip": false,
|
| 81 |
+
"normalized": false,
|
| 82 |
+
"rstrip": false,
|
| 83 |
+
"single_word": false,
|
| 84 |
+
"special": true
|
| 85 |
+
},
|
| 86 |
+
"151653": {
|
| 87 |
+
"content": "<|vision_end|>",
|
| 88 |
+
"lstrip": false,
|
| 89 |
+
"normalized": false,
|
| 90 |
+
"rstrip": false,
|
| 91 |
+
"single_word": false,
|
| 92 |
+
"special": true
|
| 93 |
+
},
|
| 94 |
+
"151654": {
|
| 95 |
+
"content": "<|vision_pad|>",
|
| 96 |
+
"lstrip": false,
|
| 97 |
+
"normalized": false,
|
| 98 |
+
"rstrip": false,
|
| 99 |
+
"single_word": false,
|
| 100 |
+
"special": true
|
| 101 |
+
},
|
| 102 |
+
"151655": {
|
| 103 |
+
"content": "<|image_pad|>",
|
| 104 |
+
"lstrip": false,
|
| 105 |
+
"normalized": false,
|
| 106 |
+
"rstrip": false,
|
| 107 |
+
"single_word": false,
|
| 108 |
+
"special": true
|
| 109 |
+
},
|
| 110 |
+
"151656": {
|
| 111 |
+
"content": "<|video_pad|>",
|
| 112 |
+
"lstrip": false,
|
| 113 |
+
"normalized": false,
|
| 114 |
+
"rstrip": false,
|
| 115 |
+
"single_word": false,
|
| 116 |
+
"special": true
|
| 117 |
+
},
|
| 118 |
+
"151657": {
|
| 119 |
+
"content": "<tool_call>",
|
| 120 |
+
"lstrip": false,
|
| 121 |
+
"normalized": false,
|
| 122 |
+
"rstrip": false,
|
| 123 |
+
"single_word": false,
|
| 124 |
+
"special": false
|
| 125 |
+
},
|
| 126 |
+
"151658": {
|
| 127 |
+
"content": "</tool_call>",
|
| 128 |
+
"lstrip": false,
|
| 129 |
+
"normalized": false,
|
| 130 |
+
"rstrip": false,
|
| 131 |
+
"single_word": false,
|
| 132 |
+
"special": false
|
| 133 |
+
},
|
| 134 |
+
"151659": {
|
| 135 |
+
"content": "<|fim_prefix|>",
|
| 136 |
+
"lstrip": false,
|
| 137 |
+
"normalized": false,
|
| 138 |
+
"rstrip": false,
|
| 139 |
+
"single_word": false,
|
| 140 |
+
"special": false
|
| 141 |
+
},
|
| 142 |
+
"151660": {
|
| 143 |
+
"content": "<|fim_middle|>",
|
| 144 |
+
"lstrip": false,
|
| 145 |
+
"normalized": false,
|
| 146 |
+
"rstrip": false,
|
| 147 |
+
"single_word": false,
|
| 148 |
+
"special": false
|
| 149 |
+
},
|
| 150 |
+
"151661": {
|
| 151 |
+
"content": "<|fim_suffix|>",
|
| 152 |
+
"lstrip": false,
|
| 153 |
+
"normalized": false,
|
| 154 |
+
"rstrip": false,
|
| 155 |
+
"single_word": false,
|
| 156 |
+
"special": false
|
| 157 |
+
},
|
| 158 |
+
"151662": {
|
| 159 |
+
"content": "<|fim_pad|>",
|
| 160 |
+
"lstrip": false,
|
| 161 |
+
"normalized": false,
|
| 162 |
+
"rstrip": false,
|
| 163 |
+
"single_word": false,
|
| 164 |
+
"special": false
|
| 165 |
+
},
|
| 166 |
+
"151663": {
|
| 167 |
+
"content": "<|repo_name|>",
|
| 168 |
+
"lstrip": false,
|
| 169 |
+
"normalized": false,
|
| 170 |
+
"rstrip": false,
|
| 171 |
+
"single_word": false,
|
| 172 |
+
"special": false
|
| 173 |
+
},
|
| 174 |
+
"151664": {
|
| 175 |
+
"content": "<|file_sep|>",
|
| 176 |
+
"lstrip": false,
|
| 177 |
+
"normalized": false,
|
| 178 |
+
"rstrip": false,
|
| 179 |
+
"single_word": false,
|
| 180 |
+
"special": false
|
| 181 |
+
},
|
| 182 |
+
"151665": {
|
| 183 |
+
"content": "<img>",
|
| 184 |
+
"lstrip": false,
|
| 185 |
+
"normalized": false,
|
| 186 |
+
"rstrip": false,
|
| 187 |
+
"single_word": false,
|
| 188 |
+
"special": true
|
| 189 |
+
},
|
| 190 |
+
"151666": {
|
| 191 |
+
"content": "</img>",
|
| 192 |
+
"lstrip": false,
|
| 193 |
+
"normalized": false,
|
| 194 |
+
"rstrip": false,
|
| 195 |
+
"single_word": false,
|
| 196 |
+
"special": true
|
| 197 |
+
},
|
| 198 |
+
"151667": {
|
| 199 |
+
"content": "<IMG_CONTEXT>",
|
| 200 |
+
"lstrip": false,
|
| 201 |
+
"normalized": false,
|
| 202 |
+
"rstrip": false,
|
| 203 |
+
"single_word": false,
|
| 204 |
+
"special": true
|
| 205 |
+
},
|
| 206 |
+
"151668": {
|
| 207 |
+
"content": "<quad>",
|
| 208 |
+
"lstrip": false,
|
| 209 |
+
"normalized": false,
|
| 210 |
+
"rstrip": false,
|
| 211 |
+
"single_word": false,
|
| 212 |
+
"special": true
|
| 213 |
+
},
|
| 214 |
+
"151669": {
|
| 215 |
+
"content": "</quad>",
|
| 216 |
+
"lstrip": false,
|
| 217 |
+
"normalized": false,
|
| 218 |
+
"rstrip": false,
|
| 219 |
+
"single_word": false,
|
| 220 |
+
"special": true
|
| 221 |
+
},
|
| 222 |
+
"151670": {
|
| 223 |
+
"content": "<ref>",
|
| 224 |
+
"lstrip": false,
|
| 225 |
+
"normalized": false,
|
| 226 |
+
"rstrip": false,
|
| 227 |
+
"single_word": false,
|
| 228 |
+
"special": true
|
| 229 |
+
},
|
| 230 |
+
"151671": {
|
| 231 |
+
"content": "</ref>",
|
| 232 |
+
"lstrip": false,
|
| 233 |
+
"normalized": false,
|
| 234 |
+
"rstrip": false,
|
| 235 |
+
"single_word": false,
|
| 236 |
+
"special": true
|
| 237 |
+
},
|
| 238 |
+
"151672": {
|
| 239 |
+
"content": "<box>",
|
| 240 |
+
"lstrip": false,
|
| 241 |
+
"normalized": false,
|
| 242 |
+
"rstrip": false,
|
| 243 |
+
"single_word": false,
|
| 244 |
+
"special": true
|
| 245 |
+
},
|
| 246 |
+
"151673": {
|
| 247 |
+
"content": "</box>",
|
| 248 |
+
"lstrip": false,
|
| 249 |
+
"normalized": false,
|
| 250 |
+
"rstrip": false,
|
| 251 |
+
"single_word": false,
|
| 252 |
+
"special": true
|
| 253 |
+
}
|
| 254 |
+
},
|
| 255 |
+
"additional_special_tokens": [
|
| 256 |
+
"<|im_start|>",
|
| 257 |
+
"<|im_end|>",
|
| 258 |
+
"<|object_ref_start|>",
|
| 259 |
+
"<|object_ref_end|>",
|
| 260 |
+
"<|box_start|>",
|
| 261 |
+
"<|box_end|>",
|
| 262 |
+
"<|quad_start|>",
|
| 263 |
+
"<|quad_end|>",
|
| 264 |
+
"<|vision_start|>",
|
| 265 |
+
"<|vision_end|>",
|
| 266 |
+
"<|vision_pad|>",
|
| 267 |
+
"<|image_pad|>",
|
| 268 |
+
"<|video_pad|>"
|
| 269 |
+
],
|
| 270 |
+
"bos_token": null,
|
| 271 |
+
"chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\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",
|
| 272 |
+
"clean_up_tokenization_spaces": false,
|
| 273 |
+
"eos_token": "<|im_end|>",
|
| 274 |
+
"errors": "replace",
|
| 275 |
+
"extra_special_tokens": {},
|
| 276 |
+
"model_max_length": 12288,
|
| 277 |
+
"pad_token": "<|endoftext|>",
|
| 278 |
+
"split_special_tokens": false,
|
| 279 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 280 |
+
"unk_token": null
|
| 281 |
+
}
|
internvl3_tokenizer/vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
main_ctx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:612e304cd9542cad744fd3fa352e1a83e2d4aea93f7dba8f0b32d2072434527a
|
| 3 |
+
size 6623504
|
run_internvl_3_1b_448_ax630c.sh
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
./main_ctx \
|
| 2 |
+
--system_prompt "You are Qwen, created by Alibaba Cloud. You are a helpful assistant." \
|
| 3 |
+
--template_filename_axmodel "./internvl3_1b_ax630c/qwen2_p128_l%d_together.axmodel" \
|
| 4 |
+
--axmodel_num 24 \
|
| 5 |
+
--filename_image_encoder_axmodedl "./internvl3_1b_ax630c/internvl3_1b_vit.axmodel" \
|
| 6 |
+
--use_mmap_load_embed 1 \
|
| 7 |
+
--url_tokenizer_model "http://127.0.0.1:12345" \
|
| 8 |
+
--filename_post_axmodel "./internvl3_1b_ax630c/qwen2_post.axmodel" \
|
| 9 |
+
--filename_tokens_embed "./internvl3_1b_ax630c/model.embed_tokens.weight.bfloat16.bin" \
|
| 10 |
+
--tokens_embed_num 151674 \
|
| 11 |
+
--tokens_embed_size 896 \
|
| 12 |
+
--live_print 1
|
tokenizer_internvl3-1B-448-ax650.py
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoTokenizer
|
| 2 |
+
from http.server import HTTPServer, BaseHTTPRequestHandler
|
| 3 |
+
import json
|
| 4 |
+
import argparse
|
| 5 |
+
import uuid
|
| 6 |
+
|
| 7 |
+
tokenizers = {}
|
| 8 |
+
|
| 9 |
+
class Tokenizer_Http():
|
| 10 |
+
def __init__(self, model_id):
|
| 11 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 12 |
+
self.messages = [
|
| 13 |
+
{"role": "system", "content": "你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。"},
|
| 14 |
+
]
|
| 15 |
+
self.token_ids = []
|
| 16 |
+
self.token_ids_cache = []
|
| 17 |
+
|
| 18 |
+
def encode(self, prompt, last_reply=None):
|
| 19 |
+
if last_reply is not None:
|
| 20 |
+
self.messages.append({"role": "assistant", "content": last_reply})
|
| 21 |
+
text = self.tokenizer.apply_chat_template(
|
| 22 |
+
self.messages,
|
| 23 |
+
tokenize=False,
|
| 24 |
+
add_generation_prompt=True
|
| 25 |
+
)
|
| 26 |
+
self.token_ids = self.tokenizer.encode(text)[:-3]
|
| 27 |
+
self.messages.append({"role": "user", "content": prompt})
|
| 28 |
+
|
| 29 |
+
text = self.tokenizer.apply_chat_template(
|
| 30 |
+
self.messages,
|
| 31 |
+
tokenize=False,
|
| 32 |
+
add_generation_prompt=True
|
| 33 |
+
)
|
| 34 |
+
token_ids = self.tokenizer.encode(text)
|
| 35 |
+
diff = token_ids[len(self.token_ids):]
|
| 36 |
+
self.token_ids = token_ids
|
| 37 |
+
return token_ids, diff
|
| 38 |
+
|
| 39 |
+
def encode_with_image(self, question: str, num_of_images: int, imgsz: int, last_reply=None):
|
| 40 |
+
if last_reply is not None:
|
| 41 |
+
self.messages.append({"role": "assistant", "content": last_reply})
|
| 42 |
+
|
| 43 |
+
# 根据图片尺寸设定 context_len
|
| 44 |
+
if imgsz == 448:
|
| 45 |
+
context_len = 256
|
| 46 |
+
elif imgsz == 224:
|
| 47 |
+
context_len = 64
|
| 48 |
+
else:
|
| 49 |
+
print(f"Unsupported imgsz: {imgsz}")
|
| 50 |
+
return None, None
|
| 51 |
+
|
| 52 |
+
# 拼接带图片的用户输入
|
| 53 |
+
question_with_images = question
|
| 54 |
+
if num_of_images > 0:
|
| 55 |
+
for _ in range(num_of_images):
|
| 56 |
+
question_with_images += "\n<img>" + "<IMG_CONTEXT>" * context_len + "</img>\n"
|
| 57 |
+
|
| 58 |
+
self.messages.append({"role": "user", "content": question_with_images})
|
| 59 |
+
|
| 60 |
+
text = self.tokenizer.apply_chat_template(
|
| 61 |
+
self.messages,
|
| 62 |
+
tokenize=False,
|
| 63 |
+
add_generation_prompt=True
|
| 64 |
+
)
|
| 65 |
+
token_ids = self.tokenizer.encode(text)
|
| 66 |
+
diff = token_ids[len(self.token_ids):]
|
| 67 |
+
self.token_ids = token_ids
|
| 68 |
+
return token_ids, diff
|
| 69 |
+
|
| 70 |
+
def decode(self, token_ids):
|
| 71 |
+
self.token_ids_cache += token_ids
|
| 72 |
+
text = self.tokenizer.decode(self.token_ids_cache)
|
| 73 |
+
if "\ufffd" in text:
|
| 74 |
+
print("Text 中包含非法字符")
|
| 75 |
+
return ""
|
| 76 |
+
else:
|
| 77 |
+
self.token_ids_cache.clear()
|
| 78 |
+
return text
|
| 79 |
+
|
| 80 |
+
@property
|
| 81 |
+
def bos_id(self):
|
| 82 |
+
return self.tokenizer.bos_token_id
|
| 83 |
+
@property
|
| 84 |
+
def eos_id(self):
|
| 85 |
+
return self.tokenizer.eos_token_id
|
| 86 |
+
@property
|
| 87 |
+
def bos_token(self):
|
| 88 |
+
return self.tokenizer.bos_token
|
| 89 |
+
@property
|
| 90 |
+
def eos_token(self):
|
| 91 |
+
return self.tokenizer.eos_token
|
| 92 |
+
@property
|
| 93 |
+
def img_start_token(self):
|
| 94 |
+
return self.tokenizer.encode("<img>")[0]
|
| 95 |
+
@property
|
| 96 |
+
def img_context_token(self):
|
| 97 |
+
return self.tokenizer.encode("<IMG_CONTEXT>")[0]
|
| 98 |
+
|
| 99 |
+
def reset(self, system_prompt=None):
|
| 100 |
+
if system_prompt is None:
|
| 101 |
+
system_prompt = args.content
|
| 102 |
+
self.messages = [
|
| 103 |
+
{"role": "system", "content": system_prompt},
|
| 104 |
+
]
|
| 105 |
+
text = self.tokenizer.apply_chat_template(
|
| 106 |
+
self.messages,
|
| 107 |
+
tokenize=False,
|
| 108 |
+
add_generation_prompt=True
|
| 109 |
+
)
|
| 110 |
+
token_ids = self.tokenizer.encode(text)[:-3]
|
| 111 |
+
self.token_ids = token_ids
|
| 112 |
+
print(self.decode(token_ids))
|
| 113 |
+
return token_ids
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
class Request(BaseHTTPRequestHandler):
|
| 117 |
+
timeout = 5
|
| 118 |
+
server_version = 'Apache'
|
| 119 |
+
|
| 120 |
+
def do_GET(self):
|
| 121 |
+
print(self.path)
|
| 122 |
+
self.send_response(200)
|
| 123 |
+
self.send_header("Content-Type", "application/json")
|
| 124 |
+
self.end_headers()
|
| 125 |
+
if '/get_uid' in self.path:
|
| 126 |
+
new_uid = str(uuid.uuid4())
|
| 127 |
+
print("新 uid:", new_uid)
|
| 128 |
+
tokenizers[new_uid] = Tokenizer_Http(args.model_id)
|
| 129 |
+
msg = json.dumps({'uid': new_uid})
|
| 130 |
+
elif '/bos_id' in self.path:
|
| 131 |
+
uid = self.get_query_param("uid")
|
| 132 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 133 |
+
if instance is None:
|
| 134 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 135 |
+
else:
|
| 136 |
+
msg = json.dumps({'bos_id': instance.bos_id if instance.bos_id is not None else -1})
|
| 137 |
+
elif '/eos_id' in self.path:
|
| 138 |
+
uid = self.get_query_param("uid")
|
| 139 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 140 |
+
if instance is None:
|
| 141 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 142 |
+
else:
|
| 143 |
+
msg = json.dumps({'eos_id': instance.eos_id if instance.eos_id is not None else -1})
|
| 144 |
+
elif '/img_start_token' in self.path:
|
| 145 |
+
uid = self.get_query_param("uid")
|
| 146 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 147 |
+
if instance is None:
|
| 148 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 149 |
+
else:
|
| 150 |
+
msg = json.dumps({'img_start_token': instance.img_start_token})
|
| 151 |
+
|
| 152 |
+
elif '/img_context_token' in self.path:
|
| 153 |
+
uid = self.get_query_param("uid")
|
| 154 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 155 |
+
if instance is None:
|
| 156 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 157 |
+
else:
|
| 158 |
+
msg = json.dumps({'img_context_token': instance.img_context_token})
|
| 159 |
+
else:
|
| 160 |
+
msg = json.dumps({'error': 'Invalid GET endpoint'})
|
| 161 |
+
print(msg)
|
| 162 |
+
self.wfile.write(msg.encode())
|
| 163 |
+
|
| 164 |
+
def do_POST(self):
|
| 165 |
+
content_length = int(self.headers.get('content-length', 0))
|
| 166 |
+
data = self.rfile.read(content_length).decode()
|
| 167 |
+
req = json.loads(data)
|
| 168 |
+
self.send_response(200)
|
| 169 |
+
self.send_header("Content-Type", "application/json")
|
| 170 |
+
self.end_headers()
|
| 171 |
+
|
| 172 |
+
if '/encode' in self.path:
|
| 173 |
+
uid = req.get('uid')
|
| 174 |
+
prompt = req.get('text')
|
| 175 |
+
last_reply = req.get('last_reply')
|
| 176 |
+
b_img_prompt = False
|
| 177 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 178 |
+
if 'img_prompt' in req:
|
| 179 |
+
b_img_prompt = req['img_prompt']
|
| 180 |
+
if b_img_prompt:
|
| 181 |
+
num_img = req['num_img']
|
| 182 |
+
imgsz = req['imgsz']
|
| 183 |
+
|
| 184 |
+
if instance is None:
|
| 185 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 186 |
+
else:
|
| 187 |
+
if b_img_prompt:
|
| 188 |
+
token_ids, diff = instance.encode_with_image(prompt, num_img, imgsz, last_reply)
|
| 189 |
+
else:
|
| 190 |
+
token_ids, diff = instance.encode(prompt, last_reply)
|
| 191 |
+
msg = json.dumps({'token_ids': token_ids, 'diff': diff})
|
| 192 |
+
|
| 193 |
+
elif '/decode' in self.path:
|
| 194 |
+
uid = req.get('uid')
|
| 195 |
+
token_ids = req.get('token_ids')
|
| 196 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 197 |
+
if instance is None:
|
| 198 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 199 |
+
else:
|
| 200 |
+
text = instance.decode(token_ids)
|
| 201 |
+
msg = json.dumps({'text': text})
|
| 202 |
+
|
| 203 |
+
elif '/reset' in self.path:
|
| 204 |
+
uid = req.get("uid")
|
| 205 |
+
system_prompt = req.get("system_prompt")
|
| 206 |
+
instance: Tokenizer_Http = tokenizers.get(uid)
|
| 207 |
+
if instance is None:
|
| 208 |
+
msg = json.dumps({'error': 'Invalid uid'})
|
| 209 |
+
else:
|
| 210 |
+
if system_prompt is not None:
|
| 211 |
+
print("system_prompt:", system_prompt)
|
| 212 |
+
token_ids = instance.reset(system_prompt)
|
| 213 |
+
else:
|
| 214 |
+
token_ids = instance.reset()
|
| 215 |
+
msg = json.dumps({'token_ids': token_ids})
|
| 216 |
+
|
| 217 |
+
else:
|
| 218 |
+
msg = json.dumps({'error': 'Invalid POST endpoint'})
|
| 219 |
+
|
| 220 |
+
self.wfile.write(msg.encode())
|
| 221 |
+
|
| 222 |
+
def get_query_param(self, key):
|
| 223 |
+
from urllib.parse import urlparse, parse_qs
|
| 224 |
+
query = urlparse(self.path).query
|
| 225 |
+
params = parse_qs(query)
|
| 226 |
+
values = params.get(key)
|
| 227 |
+
return values[0] if values else None
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
if __name__ == "__main__":
|
| 231 |
+
parser = argparse.ArgumentParser()
|
| 232 |
+
parser.add_argument("--host", type=str, default="localhost")
|
| 233 |
+
parser.add_argument("--port", type=int, default=8080)
|
| 234 |
+
parser.add_argument('--model_id', type=str, default='internvl3_tokenizer')
|
| 235 |
+
parser.add_argument('--content', type=str, default='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。')
|
| 236 |
+
args = parser.parse_args()
|
| 237 |
+
|
| 238 |
+
host = (args.host, args.port)
|
| 239 |
+
print("http://%s:%s" % host)
|
| 240 |
+
server = HTTPServer(host, Request)
|
| 241 |
+
server.serve_forever()
|