jianguozhang
commited on
Add explanations for why we have adjusted SYSTEM prompt position for xLAM_8x22b tokenizer.
Browse filesFor Mixtral-8x22b-inst-v0.1, move the "SYSTEM" prompt to the beginning to improve conversation flow.
Originally, it appeared toward the end of the prompt, disrupting natural interactions.
Original template:
```
<s>[INST] USER[/INST][TOOL_CALLS] ASSISTANT TOOL CALLS</s>[TOOL_RESULTS] OBSERVATIONS[/TOOL_RESULTS] USER[/INST] ASSISTANT</s>[AVAILABLE_TOOLS] LIST OF TOOLS[/AVAILABLE_TOOLS][INST] SYSTEM PROMPT\n\nUSER[/INST]
```
example/xlam_chat_template_examples_11_21.ipynb
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [
|
8 |
{
|
@@ -35,7 +35,7 @@
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
-
"execution_count":
|
39 |
"metadata": {},
|
40 |
"outputs": [
|
41 |
{
|
@@ -153,7 +153,7 @@
|
|
153 |
},
|
154 |
{
|
155 |
"cell_type": "code",
|
156 |
-
"execution_count":
|
157 |
"metadata": {},
|
158 |
"outputs": [],
|
159 |
"source": [
|
@@ -279,9 +279,7 @@
|
|
279 |
"name": "stdout",
|
280 |
"output_type": "stream",
|
281 |
"text": [
|
282 |
-
"
|
283 |
-
"Updated tokenizer for /export/agentstudio-family/checkpoints//xlam_v1/xlam_8x7b_r\n",
|
284 |
-
"Updated tokenizer for /export/agentstudio-family/checkpoints//xlam_v1/xlam_8x22b_r\n"
|
285 |
]
|
286 |
}
|
287 |
],
|
@@ -307,6 +305,10 @@
|
|
307 |
" return \n",
|
308 |
" \n",
|
309 |
" checkpoint = os.path.join(BASE_XLAM_DIR, checkpoint)\n",
|
|
|
|
|
|
|
|
|
310 |
" if \"8x22b\" in checkpoint:\n",
|
311 |
" original_tokenize_config = open_json(os.path.join(checkpoint, \"original_tokenizer_config_fixed.json\"))\n",
|
312 |
" else:\n",
|
@@ -333,7 +335,7 @@
|
|
333 |
},
|
334 |
{
|
335 |
"cell_type": "code",
|
336 |
-
"execution_count":
|
337 |
"metadata": {},
|
338 |
"outputs": [],
|
339 |
"source": [
|
@@ -1437,7 +1439,7 @@
|
|
1437 |
},
|
1438 |
{
|
1439 |
"cell_type": "code",
|
1440 |
-
"execution_count":
|
1441 |
"metadata": {},
|
1442 |
"outputs": [
|
1443 |
{
|
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
"metadata": {},
|
7 |
"outputs": [
|
8 |
{
|
|
|
35 |
},
|
36 |
{
|
37 |
"cell_type": "code",
|
38 |
+
"execution_count": 2,
|
39 |
"metadata": {},
|
40 |
"outputs": [
|
41 |
{
|
|
|
153 |
},
|
154 |
{
|
155 |
"cell_type": "code",
|
156 |
+
"execution_count": 4,
|
157 |
"metadata": {},
|
158 |
"outputs": [],
|
159 |
"source": [
|
|
|
279 |
"name": "stdout",
|
280 |
"output_type": "stream",
|
281 |
"text": [
|
282 |
+
"Tokenizer is already updated for xLAM 1.0 series: /export/agentstudio-family/checkpoints//xlam_v1/xlam_7b_r. Contact ❤❤❤Jianguo Zhang❤❤❤ for more details! \n"
|
|
|
|
|
283 |
]
|
284 |
}
|
285 |
],
|
|
|
305 |
" return \n",
|
306 |
" \n",
|
307 |
" checkpoint = os.path.join(BASE_XLAM_DIR, checkpoint)\n",
|
308 |
+
" \n",
|
309 |
+
" # For Mixtral-8x22b-inst-v0.1, move the \"SYSTEM\" prompt to the beginning to improve conversation flow. \n",
|
310 |
+
" # Originally, it appeared toward the end of the prompt, disrupting natural interactions.\n",
|
311 |
+
" # Original template: \"<s>[INST] USER[/INST][TOOL_CALLS] ASSISTANT TOOL CALLS</s>[TOOL_RESULTS] OBSERVATIONS[/TOOL_RESULTS] USER[/INST] ASSISTANT</s>[AVAILABLE_TOOLS] LIST OF TOOLS[/AVAILABLE_TOOLS][INST] SYSTEM PROMPT\\n\\nUSER[/INST]\"\"\n",
|
312 |
" if \"8x22b\" in checkpoint:\n",
|
313 |
" original_tokenize_config = open_json(os.path.join(checkpoint, \"original_tokenizer_config_fixed.json\"))\n",
|
314 |
" else:\n",
|
|
|
335 |
},
|
336 |
{
|
337 |
"cell_type": "code",
|
338 |
+
"execution_count": 6,
|
339 |
"metadata": {},
|
340 |
"outputs": [],
|
341 |
"source": [
|
|
|
1439 |
},
|
1440 |
{
|
1441 |
"cell_type": "code",
|
1442 |
+
"execution_count": 11,
|
1443 |
"metadata": {},
|
1444 |
"outputs": [
|
1445 |
{
|