qq8933 commited on
Commit
b8b2ea1
1 Parent(s): dc08ea6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -8
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
- "{}\n",
84
- "<|Bot|>:\n"
 
 
 
85
  ]
86
- system = f'{prefix_template[0]}\n{prefix_template[-1].format(instruction)}\n'
87
- history = "\n".join([f'{prompt_template[0]}\n{prompt_template[1].format(qa[0])}{prompt_template[-1]}{qa[1]}' for qa in history])
88
- prompt = f'\n{prompt_template[0]}\n{prompt_template[1].format(prompt)}{prompt_template[-1]}'
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,