"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "cd51893d37950b9528135e8b7cfb38efe6e0c793"
Unverified Commit 619200cc authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

[cuda ext tests] fixing tests (#11619)

* fixing tests

* cleanup
parent 44c5621d
...@@ -261,6 +261,7 @@ jobs: ...@@ -261,6 +261,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
apt -y update && apt install -y libaio-dev
pip install --upgrade pip pip install --upgrade pip
pip install .[testing,deepspeed] pip install .[testing,deepspeed]
...@@ -301,6 +302,7 @@ jobs: ...@@ -301,6 +302,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
apt -y update && apt install -y libaio-dev
pip install --upgrade pip pip install --upgrade pip
pip install .[testing,deepspeed,fairscale] pip install .[testing,deepspeed,fairscale]
......
...@@ -318,9 +318,10 @@ class TrainerIntegrationDeepSpeed(TestCasePlus, TrainerIntegrationCommon): ...@@ -318,9 +318,10 @@ class TrainerIntegrationDeepSpeed(TestCasePlus, TrainerIntegrationCommon):
yes_grad_accum_b = yes_grad_accum_trainer.model.b.item() yes_grad_accum_b = yes_grad_accum_trainer.model.b.item()
self.assertNotEqual(yes_grad_accum_a, a) self.assertNotEqual(yes_grad_accum_a, a)
# training with half the batch size but accumulation steps as 2 should give the same weights # training with half the batch size but accumulation steps as 2 should give the same
self.assertEqual(no_grad_accum_a, yes_grad_accum_a) # weights, but sometimes get a slight difference still of 1e-6
self.assertEqual(no_grad_accum_b, yes_grad_accum_b) self.assertAlmostEqual(no_grad_accum_a, yes_grad_accum_a, places=5)
self.assertAlmostEqual(no_grad_accum_b, yes_grad_accum_b, places=5)
# see the note above how to get identical loss on a small bs # see the note above how to get identical loss on a small bs
self.assertAlmostEqual(no_grad_accum_loss, yes_grad_accum_loss, places=5) self.assertAlmostEqual(no_grad_accum_loss, yes_grad_accum_loss, places=5)
......
...@@ -167,8 +167,8 @@ class TestTrainerExt(TestCasePlus): ...@@ -167,8 +167,8 @@ class TestTrainerExt(TestCasePlus):
# test if do_predict saves generations and metrics # test if do_predict saves generations and metrics
contents = os.listdir(output_dir) contents = os.listdir(output_dir)
contents = {os.path.basename(p) for p in contents} contents = {os.path.basename(p) for p in contents}
assert "test_generations.txt" in contents assert "generated_predictions.txt" in contents
assert "test_results.json" in contents assert "predict_results.json" in contents
def run_trainer( def run_trainer(
self, self,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment