Skip to content

Commit 6a3da5e

Browse files
authored
Fix FSDP error when DTensor device mesh is empty (#448)
1 parent eb6a9c1 commit 6a3da5e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

slime/backends/fsdp_utils/update_weight_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ def request_update_params(self, state_dict):
338338
# Ensure tensor is contiguous and on the right device
339339
param_data = param.data.contiguous()
340340

341+
# avoid `DTensor._op_dispatcher.dispatch` has `assert compute_mesh is not None` error
342+
if dist.get_world_size() == 1:
343+
param_data = param_data.full_tensor()
344+
341345
# Synchronous broadcast to avoid memory buildup
342346
dist.broadcast(param_data, 0, group=self._model_update_groups, async_op=False)
343347

0 commit comments

Comments
 (0)