Skip to content

Commit

Permalink
Fix load for non-HSDP device mesh (mosaicml#2997)
Browse files Browse the repository at this point in the history
* fix

* lint

* lint

* fix
  • Loading branch information
mvpatel2000 authored Feb 13, 2024
1 parent a88c7fe commit d2b9cd3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion composer/utils/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def __init__(self, source_path: str, destination_path: str, object_store: Union[
super().__init__(destination_path)

def read_data(self, plan: LoadPlan, planner: LoadPlanner):
first_replica = self.device_mesh is None or self.device_mesh.get_local_rank(mesh_dim=0) == 0
# Download files if not using HSDP or if on first replica with HSDP enabled
first_replica = self.device_mesh is None or self.device_mesh.ndim == 1 or (
self.device_mesh.ndim >= 2 and self.device_mesh.get_local_rank(mesh_dim=0) == 0)

# 1. Download to the destination all files this rank needs if on first replica
if first_replica:
Expand Down

0 comments on commit d2b9cd3

Please sign in to comment.