Jackrong commited on
Commit
4f72a7d
·
verified ·
1 Parent(s): 79143f0

Upload exported HF Llama model (from MiniMind pth)

Browse files
README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # MiniMind Export (Llama format)
2
+
3
+ - Exported from MiniMind `.pth` to `LlamaForCausalLM` HF format
4
+ - hidden_size=512, layers=8, max_seq_len=512
5
+ - Intended for llama.cpp `convert_hf_to_gguf.py`
chat_template.jinja ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {%- else -%}
16
+ {{- '<|im_start|>system\nYou are a helpful assistant<|im_end|>\n' }}
17
+ {%- endif %}
18
+ {%- endif %}
19
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
20
+ {%- for message in messages[::-1] %}
21
+ {%- set index = (messages|length - 1) - loop.index0 %}
22
+ {%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
23
+ {%- set ns.multi_step_tool = false %}
24
+ {%- set ns.last_query_index = index %}
25
+ {%- endif %}
26
+ {%- endfor %}
27
+ {%- for message in messages %}
28
+ {%- if message.content is string %}
29
+ {%- set content = message.content %}
30
+ {%- else %}
31
+ {%- set content = '' %}
32
+ {%- endif %}
33
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
34
+ {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
35
+ {%- elif message.role == "assistant" %}
36
+ {{- '<|im_start|>' + message.role + '\n' + content }}
37
+ {%- if message.tool_calls %}
38
+ {%- for tool_call in message.tool_calls %}
39
+ {%- if (loop.first and content) or (not loop.first) %}
40
+ {{- '\n' }}
41
+ {%- endif %}
42
+ {%- if tool_call.function %}
43
+ {%- set tool_call = tool_call.function %}
44
+ {%- endif %}
45
+ {{- '<tool_call>\n{"name": "' }}
46
+ {{- tool_call.name }}
47
+ {{- '", "arguments": ' }}
48
+ {%- if tool_call.arguments is string %}
49
+ {{- tool_call.arguments }}
50
+ {%- else %}
51
+ {{- tool_call.arguments | tojson }}
52
+ {%- endif %}
53
+ {{- '}\n</tool_call>' }}
54
+ {%- endfor %}
55
+ {%- endif %}
56
+ {{- '<|im_end|>\n' }}
57
+ {%- elif message.role == "tool" %}
58
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
59
+ {{- '<|im_start|>user' }}
60
+ {%- endif %}
61
+ {{- '\n<tool_response>\n' }}
62
+ {{- content }}
63
+ {{- '\n</tool_response>' }}
64
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
65
+ {{- '<|im_end|>\n' }}
66
+ {%- endif %}
67
+ {%- endif %}
68
+ {%- endfor %}
69
+ {%- if add_generation_prompt %}
70
+ {{- '<|im_start|>assistant\n' }}
71
+ {%- if enable_thinking is defined and enable_thinking is false %}
72
+ {{- '<think>\n\n</think>\n\n' }}
73
+ {%- endif %}
74
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlamaForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 1,
8
+ "dtype": "float16",
9
+ "eos_token_id": 2,
10
+ "head_dim": 64,
11
+ "hidden_act": "silu",
12
+ "hidden_size": 512,
13
+ "initializer_range": 0.02,
14
+ "intermediate_size": 1408,
15
+ "max_position_embeddings": 32768,
16
+ "mlp_bias": false,
17
+ "model_type": "llama",
18
+ "num_attention_heads": 8,
19
+ "num_hidden_layers": 8,
20
+ "num_key_value_heads": 2,
21
+ "pretraining_tp": 1,
22
+ "rms_norm_eps": 1e-05,
23
+ "rope_scaling": null,
24
+ "rope_theta": 1000000.0,
25
+ "tie_word_embeddings": true,
26
+ "transformers_version": "4.57.1",
27
+ "use_cache": true,
28
+ "vocab_size": 6400
29
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.57.1"
6
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c84311eb126610f6a1e203aefb510d1a494df224317a9b5815c8b61d72c10b9
3
+ size 51667832
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|im_start|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|im_end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|endoftext|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<|endoftext|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "0": {
7
+ "content": "<|endoftext|>",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "1": {
15
+ "content": "<|im_start|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "2": {
23
+ "content": "<|im_end|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ }
30
+ },
31
+ "additional_special_tokens": [],
32
+ "bos_token": "<|im_start|>",
33
+ "clean_up_tokenization_spaces": false,
34
+ "eos_token": "<|im_end|>",
35
+ "extra_special_tokens": {},
36
+ "legacy": true,
37
+ "model_max_length": 32768,
38
+ "pad_token": "<|endoftext|>",
39
+ "sp_model_kwargs": {},
40
+ "spaces_between_special_tokens": false,
41
+ "tokenizer_class": "PreTrainedTokenizerFast",
42
+ "unk_token": "<|endoftext|>"
43
+ }