File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -304,11 +304,6 @@ def process_item(item):
304304 "Let's think step by step, and put your final answer within \\ boxed{}."
305305 )
306306 prompt = f"{ question } { instruction } "
307- prompt = tokenizer .apply_chat_template (
308- [{"role" : "user" , "content" : prompt }],
309- tokenize = False ,
310- add_generation_prompt = True ,
311- )
312307
313308 return {
314309 "prompts" : prompt ,
@@ -326,7 +321,7 @@ def process_item(item):
326321tokenizer_source = MODEL_PATH if NOTEBOOK_ENV == "g3" else MODEL_VERSION
327322tokenizer = AutoTokenizer .from_pretrained (tokenizer_source )
328323
329- chat_parser = parser .QwenChatTemplateParser (tokenizer )
324+ chat_parser = parser .DefaultChatTemplateParser (tokenizer )
330325
331326# %%
332327train_dataset , test_dataset = create_datasets ()
Original file line number Diff line number Diff line change @@ -168,7 +168,13 @@ def _observation_to_messages(
168168 info: Additional information from the environment.
169169 """
170170 del reward , done , info # Unused in default implementation.
171- if isinstance (observation , dict ) and "question" in observation :
171+ # prompts should not be applied with template beforehand to avoid double
172+ # templating.
173+ if isinstance (observation , dict ) and "prompts" in observation :
174+ self ._messages .append (
175+ {"role" : "user" , "content" : observation ["prompts" ]}
176+ )
177+ elif isinstance (observation , dict ) and "question" in observation :
172178 self ._messages .append (
173179 {"role" : "user" , "content" : observation ["question" ]}
174180 )
You can’t perform that action at this time.
0 commit comments