better grad acc tests#45434
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
vasqu
left a comment
There was a problem hiding this comment.
Nice thank you, just thinking if we should have a 4th case with proper check against different gas bsz x step (4:2 vs 8:1 which is tested for both)
|
|
||
| def test_gradient_accumulation_grad_norm_consistency(self): | ||
| trainer = Trainer(model=RegressionModel(), args=args, train_dataset=RegressionDataset()) | ||
| self.assertEqual(trainer.accelerator.gradient_accumulation_steps, 1) |
There was a problem hiding this comment.
We can add a reference to the issue imo
| loss_tolerance=0.1, | ||
| model_accepts_loss_kwargs=False, |
There was a problem hiding this comment.
Would it make sense with a tighter tolerance when we accept loss kwargs as last test case?
There was a problem hiding this comment.
do have a tigher tolerance here already test_gradient_accumulation_grad_norm_with_num_items_in_batch
What does this PR do?
This PR updates the grad acc tests so that we are able to better catch issues. We check the grad norm also in addition to the loss. We are remove some redundant tests. As promised @vasqu. Just read the new test directly, don't bother checking the old tests