DavidBShan commited on
Commit
42d88e5
·
verified ·
1 Parent(s): b4da31b

Upload folder using huggingface_hub

Browse files
code/autoslm/engine/disaggregated.py CHANGED
@@ -276,8 +276,14 @@ def build_accelerate_launch_cmd(
276
  "FULL_SHARD",
277
  "--fsdp_auto_wrap_policy",
278
  "TRANSFORMER_BASED_WRAP",
 
 
 
 
 
 
279
  "--fsdp_state_dict_type",
280
- "SHARDED_STATE_DICT",
281
  ]
282
  else:
283
  # Plain DDP across the train GPUs (replicate, no sharding) — needs the explicit --multi_gpu.
 
276
  "FULL_SHARD",
277
  "--fsdp_auto_wrap_policy",
278
  "TRANSFORMER_BASED_WRAP",
279
+ # FULL_STATE_DICT (not SHARDED): transformers' Trainer rejects save_only_model — which
280
+ # GRPOConfig sets — alongside SHARDED_STATE_DICT ("save_only_model is not compatible with
281
+ # FSDP state dict type 'SHARDED_STATE_DICT'"). FULL gathers the (small LoRA) adapter on
282
+ # rank 0 at save time, which is what trainer.save_model needs anyway. Fine for the dense
283
+ # 1-9B models here; a 70B+ base would want SHARDED + save_only_model off, but those route
284
+ # to TP inference, not a sharded full-state save.
285
  "--fsdp_state_dict_type",
286
+ "FULL_STATE_DICT",
287
  ]
288
  else:
289
  # Plain DDP across the train GPUs (replicate, no sharding) — needs the explicit --multi_gpu.
code/autoslm/engine/worker.py CHANGED
@@ -1514,6 +1514,11 @@ def run_rl():
1514
  )
1515
  _rollout_split = None
1516
  _disagg_base_env: dict | None = None
 
 
 
 
 
1517
  if _inference_gpus > 0:
1518
  _total_gpus = _disagg.detect_total_gpus()
1519
  _rollout_split = select_rollout_split(_total_gpus, _inference_gpus)
 
1514
  )
1515
  _rollout_split = None
1516
  _disagg_base_env: dict | None = None
1517
+ # Defaults for the colocate (inference_gpus==0) and train_gpus==1 paths — these MUST be defined
1518
+ # before the disaggregated branch so the trainer-build block's `if _is_fsdp_launcher:` never hits
1519
+ # an UnboundLocalError on the colocate path (only the train_gpus>1 launcher sets it True).
1520
+ _trainer_only = False
1521
+ _is_fsdp_launcher = False
1522
  if _inference_gpus > 0:
1523
  _total_gpus = _disagg.detect_total_gpus()
1524
  _rollout_split = select_rollout_split(_total_gpus, _inference_gpus)