Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ __pycache__/

# C extensions
*.so

.vscode
# Distribution / packaging
.idea
.Python
Expand Down Expand Up @@ -129,3 +129,8 @@ dmypy.json

# Pyre type checker
.pyre/
applications/DeepSpeed-Chat/training/output/ds_tensorboard_logs/*
applications/DeepSpeed-Chat/training/output/*
applications/DeepSpeed-Chat/training/step1_supervised_finetuning/output/*
applications/DeepSpeed-Chat/training/step2_reward_model_finetuning/output/*
applications/DeepSpeed-Chat/training/step3_rlhf_finetuning/output/*
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,17 @@ def parse_args():
parser.add_argument(
"--model_name_or_path",
type=str,
default="facebook/opt-1.3b",
help=
"Path to pretrained model or model identifier from huggingface.co/models.",
required=True,
# required=True,
)
parser.add_argument(
"--tokenizer_name_or_path",
type=str,
default=None,
help=
"Path to pretrained tokenizer or tokenizer identifier from huggingface.co/models, if None, use `model_name_or_path`"
)
parser.add_argument(
"--per_device_train_batch_size",
Expand Down Expand Up @@ -209,7 +217,10 @@ def main():
torch.distributed.barrier()

# load_hf_tokenizer will get the correct tokenizer and set padding tokens based on the model family
tokenizer = load_hf_tokenizer(args.model_name_or_path, fast_tokenizer=True)
# Occasionally , some repo owners of huggingface hub, such as bigscience, would like to separate model and tokenizer
tokenizer_name_or_path = args.model_name_or_path if not args.tokenizer_name_or_path else args.tokenizer_name_or_path

tokenizer = load_hf_tokenizer(tokenizer_name_or_path, fast_tokenizer=True)
model = create_hf_model(AutoModelForCausalLM,
args.model_name_or_path,
tokenizer,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ if [ "$ZERO_STAGE" == "" ]; then
fi
mkdir -p $OUTPUT

deepspeed main.py \
--data_path Dahoas/rm-static Dahoas/full-hh-rlhf Dahoas/synthetic-instruct-gptj-pairwise yitingxie/rlhf-reward-datasets \
if [[ $0 =~ ^\/.* ]]
then
script=$0
else
script=$(pwd)/$0
fi
path_dir=${script%%training_scripts*}
echo $path_dir

nohup ds --num_gpus 2 $path_dir'main.py' \
--data_path $HOME/.cache/huggingface/hub/datasets--Dahoas--full-hh-rlhf \
--data_split 2,4,4 \
--model_name_or_path facebook/opt-1.3b \
--per_device_train_batch_size 8 \
Expand All @@ -32,4 +41,6 @@ deepspeed main.py \
--enable_tensorboard \
--tensorboard_path $OUTPUT \
--output_dir $OUTPUT \
&> $OUTPUT/training.log
> $OUTPUT/training.log 2>&1 &

# Dahoas/full-hh-rlhf Dahoas/synthetic-instruct-gptj-pairwise yitingxie/rlhf-reward-datasets
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0

# DeepSpeed Team
OUTPUT=$1
ZERO_STAGE=$2
if [ "$OUTPUT" == "" ]; then
OUTPUT=./output
fi
if [ "$ZERO_STAGE" == "" ]; then
ZERO_STAGE=2
fi
mkdir -p $OUTPUT

if [[ $0 =~ ^\/.* ]]
then
script=$0
else
script=$(pwd)/$0
fi
path_dir=${script%%training_scripts*}
echo $path_dir

nohup ds --num_gpus 2 $path_dir'main.py' \
--data_path $HOME/.cache/huggingface/hub/datasets--Dahoas--full-hh-rlhf \
--data_split 2,4,4 \
--model_name_or_path bigscience/bloom-560m \
--tokenizer_name_or_path bigscience/tokenizer \
--per_device_train_batch_size 4 \
--per_device_eval_batch_size 4 \
--max_seq_len 512 \
--learning_rate 9.65e-6 \
--weight_decay 0. \
--num_train_epochs 16 \
--gradient_accumulation_steps 1 \
--lr_scheduler_type cosine \
--num_warmup_steps 0 \
--seed 1234 \
--zero_stage $ZERO_STAGE \
--deepspeed \
--enable_tensorboard \
--tensorboard_path $OUTPUT \
--output_dir $OUTPUT \
> $OUTPUT/training_step1_bloom_560m_dahoas_full_hh_rlhf.log 2>&1 &

# Dahoas/full-hh-rlhf Dahoas/synthetic-instruct-gptj-pairwise yitingxie/rlhf-reward-datasets
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ def parse_args():
"Path to pretrained model or model identifier from huggingface.co/models.",
required=True,
)
parser.add_argument(
"--tokenizer_name_or_path",
type=str,
default=None,
help=
"Path to pretrained tokenizer or tokenizer identifier from huggingface.co/models, if None, use `model_name_or_path`"
)
parser.add_argument(
"--num_padding_at_beginning",
type=int,
Expand Down Expand Up @@ -204,7 +211,10 @@ def main():
torch.distributed.barrier()

# load_hf_tokenizer will get the correct tokenizer and set padding tokens based on the model family
tokenizer = load_hf_tokenizer(args.model_name_or_path, fast_tokenizer=True)
# Occasionally , some repo owners of huggingface hub, such as bigscience, would like to separate model and tokenizer
tokenizer_name_or_path = args.model_name_or_path if not args.tokenizer_name_or_path else args.tokenizer_name_or_path

tokenizer = load_hf_tokenizer(tokenizer_name_or_path, fast_tokenizer=True)
rm_model = create_critic_model(args.model_name_or_path,
tokenizer,
ds_config,
Expand Down
Loading