accelerate
fd132822 - Raise a clear error when FSDP is enabled on a mesh with no shard dimension (#4180)

Commit
7 days ago
Raise a clear error when FSDP is enabled on a mesh with no shard dimension (#4180) * Raise a clear error when FSDP is enabled on a mesh with no shard dimension `ParallelismConfig.fsdp_dim_names` always asks for `dp_shard_cp`, but that joint dimension is only flattened into the device mesh when `dp_shard` or `cp` is enabled. Launching an already-parallelized model -- e.g. one loaded with `DistributedConfig(tp_size=world_size)` or `enable_expert_parallel=True` -- under an FSDP config therefore slices a tp-only mesh by a name it does not contain, and the user sees a bare `KeyError` from `torch.distributed.device_mesh`, several frames below any code they wrote. Say what is actually wrong instead. * Move the no-shard-dimension check to ParallelismConfig._validate_accelerator
Author
Parents
Loading