Update README.md
Browse files
README.md
CHANGED
@@ -71,17 +71,21 @@ You can format it into this InternLM2 Dialogue format like,
|
|
71 |
```
|
72 |
def InternLM2_format(instruction,prompt,answer,history):
|
73 |
prefix_template=[
|
74 |
-
"<|system
|
75 |
-
"{}"
|
|
|
76 |
]
|
77 |
prompt_template=[
|
78 |
-
"<|user
|
79 |
-
"{}
|
80 |
-
"<|
|
|
|
|
|
|
|
81 |
]
|
82 |
-
system = f'{prefix_template[0]}
|
83 |
-
history = "
|
84 |
-
prompt = f'
|
85 |
return f"{system}{history}{prompt}"
|
86 |
```
|
87 |
And there is a good example for system prompt,
|
|
|
71 |
```
|
72 |
def InternLM2_format(instruction,prompt,answer,history):
|
73 |
prefix_template=[
|
74 |
+
"<|im_start|>system\n",
|
75 |
+
"{}",
|
76 |
+
"<|im_end|>\n"
|
77 |
]
|
78 |
prompt_template=[
|
79 |
+
"<|im_start|>user\n",
|
80 |
+
"{}",
|
81 |
+
"<|im_end|>\n"
|
82 |
+
"<|im_start|>assistant\n",
|
83 |
+
"{}",
|
84 |
+
"<|im_end|>\n"
|
85 |
]
|
86 |
+
system = f'{prefix_template[0]}{prefix_template[1].format(instruction)}{prefix_template[2]}'
|
87 |
+
history = "".join([f'{prompt_template[0]}{prompt_template[1].format(qa[0])}{prompt_template[2]}{prompt_template[3]}{prompt_template[4].format(qa[1])}{prompt_template[5]}' for qa in history])
|
88 |
+
prompt = f'{prompt_template[0]}{prompt_template[1].format(prompt)}{prompt_template[2]}{prompt_template[3]}'
|
89 |
return f"{system}{history}{prompt}"
|
90 |
```
|
91 |
And there is a good example for system prompt,
|