@@ -235,7 +235,7 @@ def loss_fn(params, batch):
235235 # = 0.81
236236 diloco_test_state , loss = diloco_train_step (diloco_test_state , (inputs , labels ), jax .random .key (seed = 42 ))
237237 chex .assert_equal (diloco_test_state .step , 2.0 )
238- chex .assert_trees_all_close (loss , 0.65 )
238+ chex .assert_trees_all_close (loss , 0.65 , rtol = 1e-2 , atol = 1e-2 )
239239 # Assert no updates to the global model yet (no synchronization)
240240 if test_config .pure_nnx :
241241 _ , params_pure , _ = nnx .split (initial_test_state .model , nnx .Param , ...)
@@ -280,7 +280,7 @@ def loss_fn(params, batch):
280280 # based outer optimizer.
281281 diloco_test_state , loss = diloco_train_step (diloco_test_state , (inputs , labels ), jax .random .key (seed = 42 ))
282282 chex .assert_equal (diloco_test_state .step , 3.0 )
283- chex .assert_trees_all_close (loss , 0.4481 )
283+ chex .assert_trees_all_close (loss , 0.4481 , rtol = 1e-2 , atol = 1e-2 )
284284 # Assert that inner and outer parameters are all equal now that
285285 # synchronization has happened.
286286 if test_config .pure_nnx :
@@ -338,7 +338,7 @@ def loss_fn(params, batch):
338338 step_three_outer_params = diloco_test_state .params
339339 diloco_test_state , loss = diloco_train_step (diloco_test_state , (inputs , labels ), jax .random .key (seed = 42 ))
340340 chex .assert_equal (diloco_test_state .step , 4.0 )
341- chex .assert_trees_all_close (loss , 0.574244 )
341+ chex .assert_trees_all_close (loss , 0.574244 , rtol = 1e-2 , atol = 1e-2 )
342342 # Assert no updates to the global model since previous step (no
343343 # synchronization).
344344 chex .assert_trees_all_equal (diloco_test_state .params , step_three_outer_params )
0 commit comments