Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 20 additions & 1 deletion tests/test_ppov2_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def test():
command = """\
python -i examples/scripts/ppo/ppo.py \
python examples/scripts/ppo/ppo.py \
--learning_rate 3e-6 \
--output_dir models/minimal/ppo \
--per_device_train_batch_size 5 \
Expand All @@ -31,3 +31,22 @@ def test():
shell=True,
check=True,
)


def test_num_train_epochs():
command = """\
python examples/scripts/ppo/ppo.py \
--learning_rate 3e-6 \
--output_dir models/minimal/ppo \
--per_device_train_batch_size 5 \
--gradient_accumulation_steps 1 \
--num_train_epochs 0.003 \
--model_name_or_path EleutherAI/pythia-14m \
--non_eos_penalty \
--stop_token eos \
"""
subprocess.run(
command,
shell=True,
check=True,
)
2 changes: 1 addition & 1 deletion tests/test_rloo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def test():
command = """\
python -i examples/scripts/rloo/rloo.py \
python examples/scripts/rloo/rloo.py \
--learning_rate 3e-6 \
--output_dir models/minimal/rloo \
--per_device_train_batch_size 5 \
Expand Down
2 changes: 1 addition & 1 deletion trl/trainer/ppov2_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def __init__(
# calculate various batch sizes
#########
if args.total_episodes is None: # allow the users to define episodes in terms of epochs.
args.total_episodes = args.num_train_epochs * self.train_dataset_len
args.total_episodes = int(args.num_train_epochs * self.train_dataset_len)
accelerator = Accelerator(gradient_accumulation_steps=args.gradient_accumulation_steps)
self.accelerator = accelerator
args.world_size = accelerator.num_processes
Expand Down
2 changes: 1 addition & 1 deletion trl/trainer/rloo_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(
# calculate various batch sizes
#########
if args.total_episodes is None: # allow the users to define episodes in terms of epochs.
args.total_episodes = args.num_train_epochs * self.train_dataset_len
args.total_episodes = int(args.num_train_epochs * self.train_dataset_len)
accelerator = Accelerator(gradient_accumulation_steps=args.gradient_accumulation_steps)
self.accelerator = accelerator
args.world_size = accelerator.num_processes
Expand Down