voidful commited on
Commit
2e192bb
·
verified ·
1 Parent(s): 0e1f12a

Create Modelfile

Browse files
Files changed (1) hide show
  1. Modelfile +102 -0
Modelfile ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ./llama-3-1-TAIDE-R1-Chat.gguf
2
+
3
+ PARAMETER temperature 0.6
4
+ PARAMETER num_ctx 8192
5
+ PARAMETER top_p 0.9
6
+ PARAMETER repeat_penalty 1.1
7
+
8
+ SYSTEM """
9
+ You first think about the reasoning process in the mind and then provide the user with the answer while reasoning step by step, and putting the final answer within \\boxed{}.
10
+ The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e.,
11
+ <think> reasoning process here </think><answer> answer here </answer>.
12
+ """
13
+
14
+ # 設定聊天模板
15
+ TEMPLATE """
16
+ {{- bos_token }}<think>
17
+ {%- if custom_tools is defined %}
18
+ {%- set tools = custom_tools %}
19
+ {%- endif %}
20
+ {%- if not tools_in_user_message is defined %}
21
+ {%- set tools_in_user_message = true %}
22
+ {%- endif %}
23
+ {%- if not date_string is defined %}
24
+ {%- set date_string = "26 Jul 2024" %}
25
+ {%- endif %}
26
+ {%- if not tools is defined %}
27
+ {%- set tools = none %}
28
+ {%- endif %}
29
+
30
+ {%- if messages[0]['role'] == 'system' %}
31
+ {%- set system_message = "你是一個來自台灣的AI助理,你的名字是 TAIDE,樂於以台灣人的立場幫助使用者,會用繁體中文回答問題。\\n" + messages[0]['content']|trim %}
32
+ {%- set messages = messages[1:] %}
33
+ {%- else %}
34
+ {%- set system_message = "你是一個來自台灣的AI助理,你的名字是 TAIDE,樂於以台灣人的立場幫助使用者,會用繁體中文回答問題。" %}
35
+ {%- endif %}
36
+
37
+ {{- "You first think about the reasoning process in the mind and then provide the user with the answer while reasoning step by step, and putting the final answer within \\boxed{}.\n" }}
38
+ {{- "The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e.,\n" }}
39
+ {{- "<think> reasoning process here </think><answer> answer here </answer>\n" }}
40
+
41
+ {{- "<|start_header_id|>system<|end_header_id|>\\n\\n" }}
42
+ {%- if builtin_tools is defined or tools is not none %}
43
+ {{- "Environment: ipython\\n" }}
44
+ {%- endif %}
45
+ {%- if builtin_tools is defined %}
46
+ {{- "Tools: " + builtin_tools | reject('equalto', 'code_interpreter') | join(", ") + "\\n\\n"}}
47
+ {%- endif %}
48
+ {{- "Cutting Knowledge Date: December 2023\\n" }}
49
+ {{- "Today Date: " + date_string + "\\n\\n" }}
50
+ {%- if tools is not none and not tools_in_user_message %}
51
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
52
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
53
+ {{- "Do not use variables.\\n\\n" }}
54
+ {%- for t in tools %}
55
+ {{- t | tojson(indent=4) }}
56
+ {{- "\\n\\n" }}
57
+ {%- endfor %}
58
+ {%- endif %}
59
+ {{- system_message }}
60
+ {{- "<|eot_id|>" }}
61
+
62
+ {%- for message in messages %}
63
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
64
+ {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}
65
+ {%- elif 'tool_calls' in message %}
66
+ {%- if not message.tool_calls|length == 1 %}
67
+ {{- raise_exception("This model only supports single tool-calls at once!") }}
68
+ {%- endif %}
69
+ {%- set tool_call = message.tool_calls[0].function %}
70
+ {%- if builtin_tools is defined and tool_call.name in builtin_tools %}
71
+ {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}
72
+ {{- "<|python_tag|>" + tool_call.name + ".call(" }}
73
+ {%- for arg_name, arg_val in tool_call.arguments | items %}
74
+ {{- arg_name + '="' + arg_val + '"' }}
75
+ {%- if not loop.last %}
76
+ {{- ", " }}
77
+ {%- endif %}
78
+ {%- endfor %}
79
+ {{- ")" }}
80
+ {%- else %}
81
+ {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}
82
+ {{- '{"name": "' + tool_call.name + '", ' }}
83
+ {{- '"parameters": ' }}
84
+ {{- tool_call.arguments | tojson }}
85
+ {{- "}" }}
86
+ {%- endif %}
87
+ {%- if builtin_tools is defined %}
88
+ {{- "<|eom_id|>" }}
89
+ {%- else %}
90
+ {{- "<|eot_id|>" }}
91
+ {%- endif %}
92
+ {%- elif message.role == "tool" or message.role == "ipython" %}
93
+ {{- "<|start_header_id|>ipython<|end_header_id|>\\n\\n" }}
94
+ {%- if message.content is mapping or message.content is iterable %}
95
+ {{- message.content | tojson }}
96
+ {%- else %}
97
+ {{- message.content }}
98
+ {%- endif %}
99
+ {{- "<|eot_id|>" }}
100
+ {%- endif %}
101
+ {%- endfor %}
102
+ """