Skip to content

Commit a03cad4

Browse files
committed
Adding the enable_thinking args
1 parent 38fb6e3 commit a03cad4

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ PYTHONPATH="${PYTHONPATH}:src/" poetry run accelerate launch --config_file accel
215215
- "lm_head"
216216
lora_r: 256
217217
lora_alpha: 256
218+
enable_thinking: False # set True if the model and dataset supports thinking
218219
assistant_message_template: "<|start_header_id|>assistant<|end_header_id|>\n\n"
219220
custom_pad_token: "<|reserved_special_token_0|>"
220221
custom_eos_token: "<|eot_id|>"

scripts/model_training/sft.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ def process_row(row, add_gen_prompt=False):
9494
constructed_prompt = tokenizer.apply_chat_template(
9595
system_message + history,
9696
tokenize=False,
97-
add_generation_prompt=add_gen_prompt
97+
add_generation_prompt=add_gen_prompt,
98+
enable_thinking=args.enable_thinking
9899
)
99100
if tokenizer.bos_token is not None:
100101
if constructed_prompt.startswith(tokenizer.bos_token): # Remove extra bos token

scripts/prompts_training/sft.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ def process_row(row, add_gen_prompt=False):
100100
constructed_prompt = tokenizer.apply_chat_template(
101101
system_message + history,
102102
tokenize=False,
103-
add_generation_prompt=add_gen_prompt
103+
add_generation_prompt=add_gen_prompt,
104+
enable_thinking=args.enable_thinking
104105
)
105106
if tokenizer.bos_token is not None:
106107
if constructed_prompt.startswith(tokenizer.bos_token): # Remove extra bos token

src/configs/additional/sft_args.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class SFTScriptArguments(CommonScriptArguments):
1717
"help": "Will use system prompt if there is no one in dialogue, set to None to disable"
1818
},
1919
)
20+
enable_thinking: bool | None = field(
21+
default=False, metadata={"help": "Do train with thinking"}
22+
)
2023
train_only_on_completions: bool | None = field(
2124
default=True, metadata={"help": "Do train only on completions or not"}
2225
)

0 commit comments

Comments
 (0)