minimind/trainer
basil-k-aji-dev 9c088dd3a5 [fix] route RL trainer forward through DDP so gradients all-reduce
train_grpo.py, train_ppo.py and train_agent.py wrap the policy in
DistributedDataParallel but run the loss-bearing forward through
.module, bypassing the wrapper. DDP arms its gradient all-reduce hooks
inside DistributedDataParallel.forward(), so calling .module directly
means backward() performs no all-reduce: every rank steps on purely
local gradients and the replicas silently diverge. Only rank 0 is
saved, so multi-GPU RL training quietly degrades to single-GPU
training on 1/N of the data with no error.

The supervised trainers are unaffected; they already call the wrapped
module. no_grad uses of .module (rollout generation, checkpoint
saving) are left untouched, where unwrapping is correct.

Single-GPU behaviour is unchanged: with no process group, model is the
bare module and these calls are identical to before.
2026-09-14 14:54:07 +05:30
..
rollout_engine.py [fix] keep agent rollout token-aligned #850 2026-09-10 11:44:05 +08:00
train_agent.py [fix] route RL trainer forward through DDP so gradients all-reduce 2026-09-14 14:54:07 +05:30
train_distillation.py [fix] ddp exit hang 2026-06-01 17:50:39 +08:00
train_dpo.py [fix] ddp exit hang 2026-06-01 17:50:39 +08:00
train_full_sft.py [update] remove expert args 2026-09-04 22:16:38 +08:00
train_grpo.py [fix] route RL trainer forward through DDP so gradients all-reduce 2026-09-14 14:54:07 +05:30
train_lora.py [fix] ddp exit hang 2026-06-01 17:50:39 +08:00
train_ppo.py [fix] route RL trainer forward through DDP so gradients all-reduce 2026-09-14 14:54:07 +05:30
train_pretrain.py [update] remove expert args 2026-09-04 22:16:38 +08:00
train_tokenizer.py [update] minimind-3 2026-03-25 23:57:45 +08:00
trainer_utils.py [update] minimind-3 2026-03-25 23:57:45 +08:00