Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uses dvclive_test mode in examples/pytorch/test_accelerate_examples.py #27763

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions examples/pytorch/test_accelerate_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def setUpClass(cls):
def tearDownClass(cls):
shutil.rmtree(cls.tmpdir)

@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_glue_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand All @@ -100,7 +100,7 @@ def test_run_glue_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "glue_no_trainer")))

@unittest.skip("Zach is working on this.")
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_clm_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand Down Expand Up @@ -128,7 +128,7 @@ def test_run_clm_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "clm_no_trainer")))

@unittest.skip("Zach is working on this.")
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_mlm_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand All @@ -148,7 +148,7 @@ def test_run_mlm_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "epoch_0")))
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "mlm_no_trainer")))

@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_ner_no_trainer(self):
# with so little data distributed training needs more epochs to get the score on par with 0/1 gpu
epochs = 7 if backend_device_count(torch_device) > 1 else 2
Expand Down Expand Up @@ -176,7 +176,7 @@ def test_run_ner_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "epoch_0")))
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "ner_no_trainer")))

@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_squad_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_run_squad_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "epoch_0")))
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "qa_no_trainer")))

@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_swag_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand All @@ -227,7 +227,7 @@ def test_run_swag_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "swag_no_trainer")))

@slow
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_summarization_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand Down Expand Up @@ -255,7 +255,7 @@ def test_run_summarization_no_trainer(self):
self.assertTrue(os.path.exists(os.path.join(tmp_dir, "summarization_no_trainer")))

@slow
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_translation_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand Down Expand Up @@ -306,7 +306,7 @@ def test_run_semantic_segmentation_no_trainer(self):
result = get_results(tmp_dir)
self.assertGreaterEqual(result["eval_overall_accuracy"], 0.10)

@mock.patch.dict(os.environ, {"WANDB_MODE": "offline"})
@mock.patch.dict(os.environ, {"WANDB_MODE": "offline", "DVCLIVE_TEST": "true"})
def test_run_image_classification_no_trainer(self):
tmp_dir = self.get_auto_remove_tmp_dir()
testargs = f"""
Expand Down
Loading