hf-transformers-bot commited on
Commit
38ac9b7
·
verified ·
1 Parent(s): 62d71f6

Update tiny models for AfmoeModel

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ 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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
chat_template.jinja ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# 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>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\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" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- for message in messages %}
18
+ {%- if message.content is string %}
19
+ {%- set content = message.content %}
20
+ {%- else %}
21
+ {%- set content = '' %}
22
+ {%- endif %}
23
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
24
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
25
+ {%- elif message.role == "assistant" %}
26
+ {%- if '</think>' in content %}
27
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
28
+ {%- endif %}
29
+ {{- '<|im_start|>' + message.role + '\n' }}
30
+ {% generation %}
31
+ {{- content }}
32
+ {%- if message.tool_calls %}
33
+ {%- for tool_call in message.tool_calls %}
34
+ {%- if (loop.first and content) or (not loop.first) %}
35
+ {{- '\n' }}
36
+ {%- endif %}
37
+ {%- if tool_call.function %}
38
+ {%- set tool_call = tool_call.function %}
39
+ {%- endif %}
40
+ {{- '<tool_call>\n{"name": "' }}
41
+ {{- tool_call.name }}
42
+ {{- '", "arguments": ' }}
43
+ {%- if tool_call.arguments is string %}
44
+ {{- tool_call.arguments }}
45
+ {%- else %}
46
+ {{- tool_call.arguments | tojson }}
47
+ {%- endif %}
48
+ {{- '}\n</tool_call>' }}
49
+ {%- endfor %}
50
+ {%- endif %}
51
+ {{- '<|im_end|>' }}
52
+ {% endgeneration %}
53
+ {{- '\n' }}
54
+ {%- elif message.role == "tool" %}
55
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
56
+ {{- '<|im_start|>user' }}
57
+ {%- endif %}
58
+ {{- '\n<tool_response>\n' }}
59
+ {{- content }}
60
+ {{- '\n</tool_response>' }}
61
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
62
+ {{- '<|im_end|>\n' }}
63
+ {%- endif %}
64
+ {%- endif %}
65
+ {%- endfor %}
66
+ {%- if add_generation_prompt %}
67
+ {{- '<|im_start|>assistant\n<think>\n' }}
68
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "AfmoeModel"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "dtype": "float32",
9
+ "eos_token_id": 3,
10
+ "global_attn_every_n_layers": 2,
11
+ "head_dim": 128,
12
+ "hidden_act": "silu",
13
+ "hidden_size": 32,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 16,
16
+ "layer_types": [
17
+ "sliding_attention",
18
+ "full_attention"
19
+ ],
20
+ "max_position_embeddings": 200,
21
+ "model_type": "afmoe",
22
+ "moe_intermediate_size": 16,
23
+ "mup_enabled": false,
24
+ "num_attention_heads": 16,
25
+ "num_dense_layers": 1,
26
+ "num_experts": 4,
27
+ "num_experts_per_tok": 2,
28
+ "num_hidden_layers": 2,
29
+ "num_key_value_heads": 16,
30
+ "num_shared_experts": 2,
31
+ "output_router_logits": false,
32
+ "pad_token_id": 12,
33
+ "rms_norm_eps": 1e-05,
34
+ "rope_parameters": {
35
+ "rope_theta": 10000.0,
36
+ "rope_type": "default"
37
+ },
38
+ "route_scale": 1.0,
39
+ "sliding_window": 128,
40
+ "tie_word_embeddings": false,
41
+ "transformers_version": "5.16.0.dev0",
42
+ "use_cache": false,
43
+ "vocab_size": 200000
44
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b4772d6f590b192b11ed268ba0fbe7d54ae1203e0bacdabb372b41bb3068389c
3
+ size 28272768
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0058acf26a6e7228298b0c9fed2a87fcb3f6cb5f84752cfde101b9e68b380918
3
+ size 14614841
tokenizer_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": null,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|begin_of_text|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "is_local": true,
8
+ "local_files_only": false,
9
+ "model_max_length": 200,
10
+ "pad_token": "<|pad|>",
11
+ "tokenizer_class": "TokenizersBackend",
12
+ "use_default_system_prompt": false
13
+ }