qq8933 commited on
Commit
215c0db
1 Parent(s): 888ec40

Update README.md

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