Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
xrsrke committed Feb 10, 2024
1 parent 0b97c38 commit 8c7355e
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions tests/test_clip_grads.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,12 +427,6 @@ def _test_clip_grads_tied_weights(parallel_context: ParallelContext, norm_type:
assert not torch.allclose(old_grad, weight.grad), "Gradients should have changed after clipping"

# Test that we get the same gradient after clipping
# torch.testing.assert_close(weight.grad, ref_weight.grad, rtol=1e-7, atol=1e-6)
# torch.testing.assert_close(bias.grad, ref_bias.grad, rtol=1e-7, atol=1e-6)
# torch.testing.assert_close(
# total_norm.cpu(), ref_total_norm.cpu(), rtol=0, atol=0, msg=lambda msg: f"{msg}\n" f"Got {total_norm} and {ref_total_norm}"
# )

assert torch.allclose(weight.grad, ref_weight.grad, rtol=1e-7, atol=1e-6)
assert torch.allclose(bias.grad, ref_bias.grad, rtol=1e-7, atol=1e-6)
assert torch.allclose(total_norm, ref_total_norm, rtol=0, atol=0), f"Got {total_norm} and {ref_total_norm}"
Expand Down

0 comments on commit 8c7355e

Please sign in to comment.