File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,9 +161,7 @@ def _train_batch(
161161 """
162162 if scheduled_pipeline is not None :
163163 if isinstance (loss_fun , ChunkedLMHeadCrossEntropyLoss ):
164- raise NotImplementedError (
165- "ChunkedLMHeadCrossEntropyLoss is not supported with pipeline parallelism."
166- )
164+ raise NotImplementedError ("ChunkedLMHeadCrossEntropyLoss is not supported with pipeline parallelism." )
167165 pp_schedule = scheduled_pipeline .pp_schedule
168166 # Pipeline Parallel forward / backward inside step() call
169167 # with self.train_context(optional_context_parallel_ctx):
@@ -250,10 +248,10 @@ def train(
250248 m .train ()
251249
252250 local_num_seen_samples = 0
253- cumulated_losses = torch .zeros (3 ).cuda ()
254251
255252 # throughput
256253 device = torch .device ("cuda" if torch .cuda .is_available () else "cpu" )
254+ cumulated_losses = torch .zeros (3 , device = device )
257255
258256 # batch loop
259257 batch : DatasetBatch
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ def gradient_clipper_mock() -> GradientClipperIF:
197197
198198@pytest .fixture (scope = "function" )
199199def loss_mock () -> Loss :
200- return MagicMock (spec = Loss , return_value = torch .rand (1 , requires_grad = True ))
200+ return MagicMock (spec = Loss , return_value = torch .rand (() , requires_grad = True ))
201201
202202
203203@pytest .fixture (scope = "function" )
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ def _make_norm_config() -> LayerNormWrapperConfig:
9797
9898def create_device_mesh_stub (* mesh_dim_names : str ) -> DeviceMesh :
9999 device_mesh = DeviceMesh .__new__ (DeviceMesh )
100- device_mesh .mesh_dim_names = mesh_dim_names
100+ device_mesh ._mesh_dim_names = mesh_dim_names
101101 return device_mesh
102102
103103
You can’t perform that action at this time.
0 commit comments