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