Skip to content

Commit 777ab91

Browse files
committed
1. remove kl_loss_coef and kl_loss_type in verl_config.
2. check `micro_batch_size` when not using `use_dynamic_bsz` in fsdp_workers.
1 parent 28586eb commit 777ab91

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

trinity/common/verl_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ class Actor:
164164
clip_ratio_high: Optional[float] = None
165165
entropy_coeff: float = 0.001
166166
use_kl_loss: bool = False
167-
kl_loss_coef: float = 0.0
168-
kl_loss_type: str = "low_var_kl"
169167

170168

171169
@dataclass

trinity/trainer/verl/fsdp_workers.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ def __init__(self, config: DictConfig, role: str):
168168
self.config.actor.ppo_micro_batch_size
169169
)
170170

171-
if self.config.actor.ppo_micro_batch_size_per_gpu is not None:
171+
if (
172+
not self.config.actor.use_dynamic_bsz
173+
and self.config.actor.ppo_micro_batch_size_per_gpu is not None
174+
):
172175
assert (
173176
self.config.actor.ppo_mini_batch_size
174177
% self.config.actor.ppo_micro_batch_size_per_gpu
@@ -181,7 +184,11 @@ def __init__(self, config: DictConfig, role: str):
181184
), f"normalized ppo_mini_batch_size {self.config.actor.ppo_mini_batch_size} should be larger than ppo_micro_batch_size_per_gpu {self.config.actor.ppo_micro_batch_size_per_gpu}"
182185

183186
# normalize ref config
184-
if self._is_ref and self.config.ref.log_prob_micro_batch_size is not None:
187+
if (
188+
self._is_ref
189+
and not self.config.ref.log_prob_use_dynamic_bsz
190+
and self.config.ref.log_prob_micro_batch_size is not None
191+
):
185192
self.config.ref.log_prob_micro_batch_size //= (
186193
self.device_mesh.size() // self.ulysses_sequence_parallel_size
187194
)
@@ -968,7 +975,7 @@ def __init__(self, config):
968975
self.config.ppo_micro_batch_size_per_gpu = self.config.ppo_micro_batch_size
969976
self.config.forward_micro_batch_size_per_gpu = self.config.forward_micro_batch_size
970977

971-
if self.config.ppo_micro_batch_size_per_gpu is not None:
978+
if not self.config.use_dynamic_bsz and self.config.ppo_micro_batch_size_per_gpu is not None:
972979
assert (
973980
self.config.ppo_mini_batch_size % self.config.ppo_micro_batch_size_per_gpu == 0
974981
), f"normalized ppo_mini_batch_size {self.config.ppo_mini_batch_size} should be divisible by ppo_micro_batch_size_per_gpu {self.config.ppo_micro_batch_size_per_gpu}"

0 commit comments

Comments
 (0)