LG-AI-EXAONE commited on
Commit
25a7b60
·
1 Parent(s): 5c4b94d

Update README.md & chat template

Browse files
Files changed (2) hide show
  1. README.md +8 -7
  2. chat_template.jinja +8 -8
README.md CHANGED
@@ -94,8 +94,8 @@ You can run EXAONE models locally using llama.cpp by following these steps:
94
 
95
  4. Generate result with greedy decoding.
96
  ```bash
97
- llama-cli -m EXAONE-4.0-1.2B-GGUF-Q4_K_M.gguf \
98
- -fa -ngl 64 \
99
  --temp 0.0 --top-k 1 \
100
  -f inputs.txt -no-cnv
101
  ```
@@ -107,12 +107,12 @@ You can run EXAONE models locally using llama.cpp by following these steps:
107
 
108
  3. Run llama-server with EXAONE 4.0 Jinja template. You can find the [chat template file](https://huggingface.co/LGAI-EXAONE/EXAONE-4.0-1.2B-GGUF/blob/main/chat_template.jinja) in this repository.
109
  ```bash
110
- llama-server -m EXAONE-4.0-32B-Q4_K_M.gguf \
111
- -c 131072 -fa -ngl 64 \
112
  --temp 0.6 --top-p 0.95 \
113
  --jinja --chat-template-file chat_template.jinja \
114
  --host 0.0.0.0 --port 8820 \
115
- -a EXAONE-4.0-32B-Q4_K_M
116
  ```
117
 
118
  4. Use OpenAI chat completion to test the GGUF model.
@@ -122,13 +122,14 @@ You can run EXAONE models locally using llama.cpp by following these steps:
122
  curl -X POST http://localhost:8820/v1/chat/completions \
123
  -H "Content-Type: application/json" \
124
  -d '{
125
- "model": "EXAONE-4.0-32B-Q4_K_M",
126
  "messages": [
127
  {"role": "user", "content": "Let'\''s work together on server!"}
128
  ],
129
  "max_tokens": 1024,
130
  "temperature": 0.6,
131
- "top_p": 0.95
 
132
  }'
133
  ```
134
 
 
94
 
95
  4. Generate result with greedy decoding.
96
  ```bash
97
+ llama-cli -m EXAONE-4.0-1.2B-Q4_K_M.gguf \
98
+ -fa -ngl 31 \
99
  --temp 0.0 --top-k 1 \
100
  -f inputs.txt -no-cnv
101
  ```
 
107
 
108
  3. Run llama-server with EXAONE 4.0 Jinja template. You can find the [chat template file](https://huggingface.co/LGAI-EXAONE/EXAONE-4.0-1.2B-GGUF/blob/main/chat_template.jinja) in this repository.
109
  ```bash
110
+ llama-server -m EXAONE-4.0-1.2B-Q4_K_M.gguf \
111
+ -c 131072 -fa -ngl 31 \
112
  --temp 0.6 --top-p 0.95 \
113
  --jinja --chat-template-file chat_template.jinja \
114
  --host 0.0.0.0 --port 8820 \
115
+ -a EXAONE-4.0-1.2B-Q4_K_M
116
  ```
117
 
118
  4. Use OpenAI chat completion to test the GGUF model.
 
122
  curl -X POST http://localhost:8820/v1/chat/completions \
123
  -H "Content-Type: application/json" \
124
  -d '{
125
+ "model": "EXAONE-4.0-1.2B-Q4_K_M",
126
  "messages": [
127
  {"role": "user", "content": "Let'\''s work together on server!"}
128
  ],
129
  "max_tokens": 1024,
130
  "temperature": 0.6,
131
+ "top_p": 0.95,
132
+ "chat_template_kwargs": {"enable_thinking": false}
133
  }'
134
  ```
135
 
chat_template.jinja CHANGED
@@ -17,7 +17,7 @@
17
  {{- "\nHere are the tools available to you in JSON format within <tool> and </tool> tags:\n" }}
18
  {%- for tool in tools %}
19
  {{- "<tool>" }}
20
- {{- tool | safe }}
21
  {{- "</tool>\n" }}
22
  {%- endfor %}
23
 
@@ -38,7 +38,7 @@
38
  {%- for i in range(messages | length) %}
39
  {%- set msg = messages[i] %}
40
  {%- set role = msg.role %}
41
- {% if role is not none and role.class is not none and role not in role_indicators %}
42
  {{- raise_exception('Unknown role: ' ~ role) }}
43
  {%- endif %}
44
 
@@ -51,17 +51,17 @@
51
  {%- endif %}
52
  {{- end_of_turn -}}
53
  {%- continue %}
54
- {%- elif tools is defined and tools %}
55
  {{- role_indicators['system'] }}
56
  {{- available_tools(tools) }}
57
- {{- end_of_turn -}}
58
  {%- endif %}
59
  {%- endif %}
60
 
61
  {%- if role == 'assistant' %}
62
  {{- role_indicators['assistant'] }}
63
 
64
- {%- if msg.content %}
65
  {%- if "</think>" in msg.content %}
66
  {%- set content = msg.content.split('</think>')[-1].strip() %}
67
  {%- set reasoning_content = msg.content.split('</think>')[0].strip() %}
@@ -105,7 +105,7 @@
105
  {{- raise_exception('arguments or parameters are mandatory: ' ~ tool_call) }}
106
  {%- endif %}
107
 
108
- {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments | safe }}}{{- "</tool_call>" }}
109
 
110
  {%- if not loop.last %}
111
  {{- "\n" }}
@@ -119,8 +119,8 @@
119
  {%- if i == 0 or messages[i - 1].role != "tool" %}
120
  {{- role_indicators['tool'] }}
121
  {%- endif %}
122
- {%- if msg.content is defined %}
123
- {{- "<tool_result>" }}{"result": {{ msg.content | safe }}}{{- "</tool_result>" }}
124
  {%- endif %}
125
  {%- if loop.last or messages[i + 1].role != "tool" %}
126
  {{- end_of_turn -}}
 
17
  {{- "\nHere are the tools available to you in JSON format within <tool> and </tool> tags:\n" }}
18
  {%- for tool in tools %}
19
  {{- "<tool>" }}
20
+ {{- tool | tojson | safe }}
21
  {{- "</tool>\n" }}
22
  {%- endfor %}
23
 
 
38
  {%- for i in range(messages | length) %}
39
  {%- set msg = messages[i] %}
40
  {%- set role = msg.role %}
41
+ {% if role is not none and role.class is not none and not role in role_indicators %}
42
  {{- raise_exception('Unknown role: ' ~ role) }}
43
  {%- endif %}
44
 
 
51
  {%- endif %}
52
  {{- end_of_turn -}}
53
  {%- continue %}
54
+ {%- elif tools is defined and tools %}
55
  {{- role_indicators['system'] }}
56
  {{- available_tools(tools) }}
57
+ {{- end_of_turn -}}
58
  {%- endif %}
59
  {%- endif %}
60
 
61
  {%- if role == 'assistant' %}
62
  {{- role_indicators['assistant'] }}
63
 
64
+ {%- if msg.content %}
65
  {%- if "</think>" in msg.content %}
66
  {%- set content = msg.content.split('</think>')[-1].strip() %}
67
  {%- set reasoning_content = msg.content.split('</think>')[0].strip() %}
 
105
  {{- raise_exception('arguments or parameters are mandatory: ' ~ tool_call) }}
106
  {%- endif %}
107
 
108
+ {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments | tojson | safe }}}{{- "</tool_call>" }}
109
 
110
  {%- if not loop.last %}
111
  {{- "\n" }}
 
119
  {%- if i == 0 or messages[i - 1].role != "tool" %}
120
  {{- role_indicators['tool'] }}
121
  {%- endif %}
122
+ {%- if msg.content is defined %}
123
+ {{- "<tool_result>" }}{"result": {{ msg.content | tojson | safe }}}{{- "</tool_result>" }}
124
  {%- endif %}
125
  {%- if loop.last or messages[i + 1].role != "tool" %}
126
  {{- end_of_turn -}}