@@ -256,11 +256,10 @@ def val_dataloader(self):
256256
257257@pytest .mark .filterwarnings ("ignore::FutureWarning" )
258258@RunIf (standalone = True , skip_windows = True )
259- @pytest .mark .parametrize ("state_dict_type" , ["full" , "sharded" ])
260- def test_fsdp_cpu_trainable (state_dict_type , tmp_path ):
259+ def test_fsdp_cpu_trainable (tmp_path ):
261260 """FSDP on CPU across 2 ranks trains and round-trips a checkpoint.
262261
263- Exercises both the ``full`` (single-file) and `` sharded`` (per-rank directory) checkpoint formats : the module is
262+ Exercises the ``sharded`` (per-rank directory) checkpoint format : the module is
264263 genuinely FSDP-wrapped, the loss drops sharply over 15 epochs, and the checkpoint written after training reads back
265264 with identical sharded parameters.
266265
@@ -270,7 +269,7 @@ def _make_trainer(max_epochs: int) -> Trainer:
270269 return Trainer (
271270 accelerator = "cpu" ,
272271 devices = 2 ,
273- strategy = FSDPStrategy (state_dict_type = state_dict_type ),
272+ strategy = FSDPStrategy (state_dict_type = "sharded" ),
274273 max_epochs = max_epochs ,
275274 default_root_dir = tmp_path ,
276275 enable_checkpointing = False ,
@@ -299,13 +298,7 @@ def _make_trainer(max_epochs: int) -> Trainer:
299298 ckpt_path = Path (trainer .strategy .broadcast (str (tmp_path / "checkpoint" )))
300299 trainer .save_checkpoint (ckpt_path )
301300
302- # the two formats must produce genuinely different on-disk layouts
303- if state_dict_type == "sharded" :
304- assert ckpt_path .is_dir ()
305- assert _is_sharded_checkpoint (ckpt_path )
306- else :
307- assert ckpt_path .is_file ()
308- assert not _is_sharded_checkpoint (ckpt_path )
301+ assert ckpt_path .is_dir () and _is_sharded_checkpoint (ckpt_path )
309302
310303 # snapshot the trained local shards on this rank for a read-back comparison
311304 trained_params = deepcopy (list (trainer .model .parameters ()))
0 commit comments