-
Notifications
You must be signed in to change notification settings - Fork 329
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
4 changed files
with
129 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
""" | ||
This script is used to convert the GSM8K dataset to standard SFT format. | ||
Note that we don't do any special processing to answer, and we will mainly | ||
use it for generations. | ||
Usage: | ||
python scripts/data/rlvr/rlvr_acecoder.py --push_to_hub | ||
python scripts/data/rlvr/rlvr_acecoder.py --push_to_hub --hf_entity ai2-adapt-dev | ||
""" | ||
|
||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
import datasets | ||
from huggingface_hub import HfApi | ||
from transformers import HfArgumentParser | ||
|
||
@dataclass | ||
class Args: | ||
push_to_hub: bool = False | ||
hf_entity: Optional[str] = None | ||
|
||
def main(args: Args): | ||
dataset = datasets.load_dataset("TIGER-Lab/AceCode-87K", split="train") | ||
|
||
def process(example): | ||
example["messages"] = [ | ||
{"role": "user", "content": example["question"]}, | ||
] | ||
example["ground_truth"] = example["test_cases"] | ||
example["dataset"] = "ace_coder" | ||
return example | ||
|
||
dataset = dataset.map(process) | ||
# reorder columns | ||
dataset = dataset.select_columns(["messages", "ground_truth", "dataset"]) | ||
|
||
if args.push_to_hub: | ||
api = HfApi() | ||
if not args.hf_entity: | ||
args.hf_entity = HfApi().whoami()["name"] | ||
repo_id = f"{args.hf_entity}/rlvr_acecoder" | ||
print(f"Pushing dataset to Hub: {repo_id}") | ||
dataset.push_to_hub(repo_id) | ||
api.upload_file( | ||
path_or_fileobj=__file__, | ||
path_in_repo="create_dataset.py", | ||
repo_type="dataset", | ||
repo_id=repo_id, | ||
) | ||
|
||
if __name__ == "__main__": | ||
parser = HfArgumentParser((Args)) | ||
main(*parser.parse_args_into_dataclasses()) |
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,37 @@ | ||
python open_instruct/grpo_vllm_thread_ray_gtrl.py \ | ||
--dataset_mixer_list vwxyzjn/rlvr_acecoder 1.0 \ | ||
--dataset_mixer_list_splits train \ | ||
--dataset_mixer_eval_list vwxyzjn/rlvr_acecoder 1.0 \ | ||
--dataset_mixer_eval_list_splits train \ | ||
--max_token_length 1023 \ | ||
--max_prompt_token_length 1024 \ | ||
--response_length 1024 \ | ||
--number_samples_per_prompt 4 \ | ||
--model_name_or_path HuggingFaceTB/SmolLM-135M-Instruct \ | ||
--non_stop_penalty \ | ||
--stop_token eos \ | ||
--temperature 1.0 \ | ||
--ground_truths_key ground_truth \ | ||
--chat_template_name tulu \ | ||
--sft_messages_key messages \ | ||
--learning_rate 3e-7 \ | ||
--total_episodes 10000 \ | ||
--penalty_reward_value -10.0 \ | ||
--deepspeed_stage 3 \ | ||
--per_device_train_batch_size 1 \ | ||
--local_rollout_forward_batch_size 1 \ | ||
--local_mini_batch_size 4 \ | ||
--local_rollout_batch_size 4 \ | ||
--num_epochs 1 \ | ||
--actor_num_gpus_per_node 1 \ | ||
--vllm_tensor_parallel_size 1 \ | ||
--beta 0.05 \ | ||
--apply_verifiable_reward true \ | ||
--output_dir output/rlvr_1b \ | ||
--seed 3 \ | ||
--num_evals 3 \ | ||
--save_freq 100 \ | ||
--reward_model_multiplier 0.0 \ | ||
--gradient_checkpointing \ | ||
--vllm_enforce_eager \ | ||
--with_tracking |