ktprms commited on
Commit
a594424
·
1 Parent(s): ef05e68

add model files for mlc fotmat

Browse files

Signed-off-by: David Wu <ktprms23@gmail.com>

added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<|PAD_TOKEN|>": 49152
3
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
mlc-chat-config.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "0.1.0",
3
+ "model_type": "llama",
4
+ "quantization": "q4f16_1",
5
+ "model_config": {
6
+ "hidden_size": 960,
7
+ "intermediate_size": 2560,
8
+ "num_attention_heads": 15,
9
+ "num_hidden_layers": 32,
10
+ "rms_norm_eps": 1e-05,
11
+ "vocab_size": 49153,
12
+ "tie_word_embeddings": true,
13
+ "position_embedding_base": 100000,
14
+ "rope_scaling": null,
15
+ "context_window_size": 8192,
16
+ "prefill_chunk_size": 8192,
17
+ "num_key_value_heads": 5,
18
+ "head_dim": 64,
19
+ "tensor_parallel_shards": 1,
20
+ "pipeline_parallel_stages": 1,
21
+ "max_batch_size": 128,
22
+ "disaggregation": false
23
+ },
24
+ "vocab_size": 49153,
25
+ "context_window_size": 8192,
26
+ "sliding_window_size": -1,
27
+ "prefill_chunk_size": 8192,
28
+ "attention_sink_size": -1,
29
+ "tensor_parallel_shards": 1,
30
+ "pipeline_parallel_stages": 1,
31
+ "temperature": 1.0,
32
+ "presence_penalty": 0.0,
33
+ "frequency_penalty": 0.0,
34
+ "repetition_penalty": 1.0,
35
+ "top_p": 1.0,
36
+ "tokenizer_files": [
37
+ "tokenizer.json",
38
+ "vocab.json",
39
+ "merges.txt",
40
+ "added_tokens.json",
41
+ "tokenizer_config.json"
42
+ ],
43
+ "tokenizer_info": {
44
+ "token_postproc_method": "byte_level",
45
+ "prepend_space_in_encode": false,
46
+ "strip_space_in_decode": false
47
+ },
48
+ "conv_template": {
49
+ "name": "chatml",
50
+ "system_template": "<|im_start|>system\n{system_message}<|im_end|>\n",
51
+ "system_message": "A conversation between a user and an LLM-based AI assistant. The assistant gives helpful and honest answers.",
52
+ "system_prefix_token_ids": null,
53
+ "add_role_after_system_message": true,
54
+ "roles": {
55
+ "user": "<|im_start|>user",
56
+ "assistant": "<|im_start|>assistant"
57
+ },
58
+ "role_templates": {
59
+ "user": "{user_message}",
60
+ "assistant": "{assistant_message}",
61
+ "tool": "{tool_message}"
62
+ },
63
+ "messages": [],
64
+ "seps": [
65
+ "<|im_end|>\n"
66
+ ],
67
+ "role_content_sep": "\n",
68
+ "role_empty_sep": "\n",
69
+ "stop_str": [
70
+ "<|im_end|>"
71
+ ],
72
+ "stop_token_ids": [
73
+ 2
74
+ ],
75
+ "function_string": "",
76
+ "use_function_calling": false
77
+ },
78
+ "pad_token_id": 49152,
79
+ "bos_token_id": 1,
80
+ "eos_token_id": 2
81
+ }
ndarray-cache.json ADDED
The diff for this file is too large to render. See raw diff
 
params_shard_0.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eedd21484a4b24f8ce481e52f866e6136cba45bc4c2d85c51bc90421e1ddb601
3
+ size 33460380
params_shard_1.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78bd4b91d545136a648ca505a38ec7cdd609d43bfb8b7d76b2c1f2e9e5d6b308
3
+ size 33200640
params_shard_2.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8dcdd84fd6a74a541312e4796815541553dee36cf20c496a959e3877b889313f
3
+ size 33200640
params_shard_3.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05c2b23d802b77511a2165480280f2054c4e954e70e372865344c7433679e501
3
+ size 33200640
params_shard_4.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49dd334166efc5868c65e477fc45e5bf3e0dc5139994a945910490ab14c4e854
3
+ size 33200640
params_shard_5.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11a07a24efe080216ee92f6bf414773b8aba8c691f2ade9c899bc755bb8d62e5
3
+ size 33200640
params_shard_6.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15d8afc5ad608aaf769295cc926bf8d76e3ca769492b9420dd0d16a9c8491e2a
3
+ size 4151040
run_model.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from mlc_llm import MLCEngine
2
+
3
+ # Create engine
4
+ model = "."
5
+ engine = MLCEngine(model, mode="interactive")
6
+
7
+ messages = []
8
+
9
+ print("輸入exit以結束")
10
+ while True:
11
+ user_input = input("你:").strip()
12
+ if user_input.lower() == "exit":
13
+ break
14
+
15
+ messages.append( {"role": "user", "content": user_input} )
16
+ response_string = ""
17
+ s_tmps = []
18
+ # Run chat completion in OpenAI API.
19
+ # response = await engine.chat.completions.create(
20
+ for response in engine.chat.completions.create(
21
+ messages=messages,
22
+ #messages=[{"role": "user", "content": user_input}],
23
+ model=model,
24
+ stream=True,
25
+ ):
26
+ # )
27
+ # s_tmps = []
28
+ for choice in response.choices:
29
+ tmp = choice.delta.content
30
+ print(tmp, end="", flush=True)
31
+ s_tmps.append(tmp)
32
+ response_string = "".join(s_tmps)
33
+ messages.append( {"role": "assistant", "content": response_string} )
34
+ #print(response)
35
+ #response = stmps
36
+ #messages.append( {"role": "assistant", "content": response} )
37
+ print("\n")
38
+
39
+ # print(messages)
40
+
41
+
42
+ engine.terminate()
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "added_tokens_decoder": {
4
+ "0": {
5
+ "content": "<|endoftext|>",
6
+ "lstrip": false,
7
+ "normalized": false,
8
+ "rstrip": false,
9
+ "single_word": false,
10
+ "special": true
11
+ },
12
+ "1": {
13
+ "content": "<|im_start|>",
14
+ "lstrip": false,
15
+ "normalized": false,
16
+ "rstrip": false,
17
+ "single_word": false,
18
+ "special": true
19
+ },
20
+ "2": {
21
+ "content": "<|im_end|>",
22
+ "lstrip": false,
23
+ "normalized": false,
24
+ "rstrip": false,
25
+ "single_word": false,
26
+ "special": true
27
+ },
28
+ "3": {
29
+ "content": "<repo_name>",
30
+ "lstrip": false,
31
+ "normalized": false,
32
+ "rstrip": false,
33
+ "single_word": false,
34
+ "special": true
35
+ },
36
+ "4": {
37
+ "content": "<reponame>",
38
+ "lstrip": false,
39
+ "normalized": false,
40
+ "rstrip": false,
41
+ "single_word": false,
42
+ "special": true
43
+ },
44
+ "5": {
45
+ "content": "<file_sep>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false,
50
+ "special": true
51
+ },
52
+ "6": {
53
+ "content": "<filename>",
54
+ "lstrip": false,
55
+ "normalized": false,
56
+ "rstrip": false,
57
+ "single_word": false,
58
+ "special": true
59
+ },
60
+ "7": {
61
+ "content": "<gh_stars>",
62
+ "lstrip": false,
63
+ "normalized": false,
64
+ "rstrip": false,
65
+ "single_word": false,
66
+ "special": true
67
+ },
68
+ "8": {
69
+ "content": "<issue_start>",
70
+ "lstrip": false,
71
+ "normalized": false,
72
+ "rstrip": false,
73
+ "single_word": false,
74
+ "special": true
75
+ },
76
+ "9": {
77
+ "content": "<issue_comment>",
78
+ "lstrip": false,
79
+ "normalized": false,
80
+ "rstrip": false,
81
+ "single_word": false,
82
+ "special": true
83
+ },
84
+ "10": {
85
+ "content": "<issue_closed>",
86
+ "lstrip": false,
87
+ "normalized": false,
88
+ "rstrip": false,
89
+ "single_word": false,
90
+ "special": true
91
+ },
92
+ "11": {
93
+ "content": "<jupyter_start>",
94
+ "lstrip": false,
95
+ "normalized": false,
96
+ "rstrip": false,
97
+ "single_word": false,
98
+ "special": true
99
+ },
100
+ "12": {
101
+ "content": "<jupyter_text>",
102
+ "lstrip": false,
103
+ "normalized": false,
104
+ "rstrip": false,
105
+ "single_word": false,
106
+ "special": true
107
+ },
108
+ "13": {
109
+ "content": "<jupyter_code>",
110
+ "lstrip": false,
111
+ "normalized": false,
112
+ "rstrip": false,
113
+ "single_word": false,
114
+ "special": true
115
+ },
116
+ "14": {
117
+ "content": "<jupyter_output>",
118
+ "lstrip": false,
119
+ "normalized": false,
120
+ "rstrip": false,
121
+ "single_word": false,
122
+ "special": true
123
+ },
124
+ "15": {
125
+ "content": "<jupyter_script>",
126
+ "lstrip": false,
127
+ "normalized": false,
128
+ "rstrip": false,
129
+ "single_word": false,
130
+ "special": true
131
+ },
132
+ "16": {
133
+ "content": "<empty_output>",
134
+ "lstrip": false,
135
+ "normalized": false,
136
+ "rstrip": false,
137
+ "single_word": false,
138
+ "special": true
139
+ },
140
+ "24211": {
141
+ "content": "�",
142
+ "lstrip": false,
143
+ "normalized": false,
144
+ "rstrip": false,
145
+ "single_word": false,
146
+ "special": true
147
+ },
148
+ "49152": {
149
+ "content": "<|PAD_TOKEN|>",
150
+ "lstrip": false,
151
+ "normalized": false,
152
+ "rstrip": false,
153
+ "single_word": false,
154
+ "special": true
155
+ }
156
+ },
157
+ "additional_special_tokens": [
158
+ "<|im_start|>",
159
+ "<|im_end|>"
160
+ ],
161
+ "bos_token": "<|im_start|>",
162
+ "chat_template": "{% for message in messages %}{% if loop.first and messages[0]['role'] != 'system' %}{{ '<|im_start|>system\nYou are a helpful AI assistant named SmolLM, trained by Hugging Face<|im_end|>\n' }}{% endif %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
163
+ "clean_up_tokenization_spaces": false,
164
+ "eos_token": "<|im_end|>",
165
+ "extra_special_tokens": {},
166
+ "model_max_length": 8192,
167
+ "pad_token": "<|PAD_TOKEN|>",
168
+ "padding_side": "left",
169
+ "tokenizer_class": "GPT2Tokenizer",
170
+ "unk_token": "�",
171
+ "vocab_size": 49152
172
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff