-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
380 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"train_stage": "reward_seq", | ||
"conv_format": "openbuddy", | ||
"end_of_conversation": 151643, | ||
"data_path": [ | ||
{ | ||
"path": "Dahoas/rm-static", | ||
"sample": 1.0, | ||
"preprocessor": "reward_rm_static" | ||
} | ||
|
||
], | ||
"data_output_path": "./tmp/data_files/", | ||
"model_name_or_path": "Qwen/Qwen1.5-4B", | ||
"model_class": "AutoModelForCausalLMWithValueHead", | ||
"atten_class": "eager", | ||
"per_device_train_batch_size": 2, | ||
"per_device_eval_batch_size": 8, | ||
"accumulate_grad_batches": 64, | ||
"max_seq_len": 2048, | ||
"checkpoint_every_n_train_steps": 100, | ||
"log_every_n_steps": 1, | ||
"val_check_interval": 0.25, | ||
"limit_val_batches": 0.1, | ||
"learning_rate": 4e-5, | ||
"betas": [0.9, 0.95], | ||
"eps": 8e-6, | ||
"lr_decay": 0.999875, | ||
"lr_scheduler_type": "cosine", | ||
"num_warmup_steps": 100, | ||
"max_epochs": 300, | ||
"disable_dropout": true, | ||
"model_torch_dtype": "auto", | ||
"bf16": true, | ||
"gradient_checkpointing": true, | ||
"weight_decay": 0.0, | ||
"gradient_clip_algorithm": "norm", | ||
"gradient_clip_val": 1.0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# coding=utf-8 | ||
# Copyright 2024 XiaHan | ||
# | ||
# Use of this source code is governed by an MIT-style | ||
# license that can be found in the LICENSE file or at | ||
# https://opensource.org/licenses/MIT. | ||
|
||
from typing import Any, Dict | ||
|
||
def fn_rm_static(sample: Dict[str, Any]) -> Dict[str, Any]: | ||
prompt: str = sample["prompt"] | ||
lines = prompt.splitlines() | ||
|
||
messages = [] | ||
for line in lines: | ||
if len(line.strip()) == 0: | ||
continue | ||
line = line.strip() | ||
|
||
if line.startswith("Human:"): | ||
if len(messages) != 0 and messages[-1]["role"] == "user": | ||
messages[-1]["content"] += "\n" + line | ||
else: | ||
messages.append({ | ||
"role": "user", | ||
"content": line.lstrip(), | ||
}) | ||
elif line.startswith("Assistant:"): | ||
if len(messages) != 0 and messages[-1]["role"] == "assistant": | ||
messages[-1]["content"] += "\n" + line | ||
else: | ||
messages.append({ | ||
"role": "assistant", | ||
"content": line.lstrip(), | ||
}) | ||
else: | ||
if len(messages) != 0: | ||
messages[-1]["content"] += "\n" + line | ||
else: | ||
raise Exception("fn_rm_static mapping invalid data.") | ||
|
||
sample["messages"] = messages | ||
return sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.