@@ -139,44 +139,33 @@ def test_llama2_chat_formatter(messages, expected):
139
139
# single user message (no system prompt)
140
140
(MSGS_NO_SYS , f"""<|begin_of_text|><|start_header_id|>user<|end_header_id|>
141
141
142
- { USER1 } <|eot_id|>
143
- """ ),
142
+ { USER1 } <|eot_id|>""" ),
144
143
# sys, usr
145
144
(MSGS_SYS_USR , f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
146
145
147
- { SYSTEM_PROMPT } <|eot_id|>
148
- <|start_header_id|>user<|end_header_id|>
146
+ { SYSTEM_PROMPT } <|eot_id|><|start_header_id|>user<|end_header_id|>
149
147
150
- { USER1 } <|eot_id|>
151
- """ ),
148
+ { USER1 } <|eot_id|>""" ),
152
149
# sys, usr, asst
153
150
(MSGS_SYS_USR_ASST , f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
154
151
155
- { SYSTEM_PROMPT } <|eot_id|>
156
- <|start_header_id|>user<|end_header_id|>
152
+ { SYSTEM_PROMPT } <|eot_id|><|start_header_id|>user<|end_header_id|>
157
153
158
- { USER1 } <|eot_id|>
159
- <|start_header_id|>assistant<|end_header_id|>
154
+ { USER1 } <|eot_id|><|start_header_id|>assistant<|end_header_id|>
160
155
161
- { ASSISTANT1 } <|eot_id|>
162
- """ ),
156
+ { ASSISTANT1 } <|eot_id|>""" ),
163
157
# sys, usr, asst, usr, asst
164
158
(MSGS_MULTI_TURN , f"""<|begin_of_text|><|start_header_id|>system<|end_header_id|>
165
159
166
- { SYSTEM_PROMPT } <|eot_id|>
167
- <|start_header_id|>user<|end_header_id|>
160
+ { SYSTEM_PROMPT } <|eot_id|><|start_header_id|>user<|end_header_id|>
168
161
169
- { USER1 } <|eot_id|>
170
- <|start_header_id|>assistant<|end_header_id|>
162
+ { USER1 } <|eot_id|><|start_header_id|>assistant<|end_header_id|>
171
163
172
- { ASSISTANT1 } <|eot_id|>
173
- <|start_header_id|>user<|end_header_id|>
164
+ { ASSISTANT1 } <|eot_id|><|start_header_id|>user<|end_header_id|>
174
165
175
- { USER2 } <|eot_id|>
176
- <|start_header_id|>assistant<|end_header_id|>
166
+ { USER2 } <|eot_id|><|start_header_id|>assistant<|end_header_id|>
177
167
178
- { ASSISTANT2 } <|eot_id|>
179
- """ ),
168
+ { ASSISTANT2 } <|eot_id|>""" ),
180
169
]
181
170
)
182
171
@pytest .mark .parametrize ("add_generation_prompt" , [True , False ])
0 commit comments