Skip to content

Commit

Permalink
Fix tests, add wandb to gitignore (#573)
Browse files Browse the repository at this point in the history
* Fix tests, add wandb to gitignore

* Clean
  • Loading branch information
muellerzr authored Jul 26, 2022
1 parent 1486fa3 commit 015f228
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ dmypy.json
.idea

# Mac .DS_Store
.DS_Store
.DS_Store

# More test things
wandb
14 changes: 12 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import unittest
from unittest import mock

import torch

from accelerate.test_utils.examples import compare_against_test
from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow
from accelerate.utils import write_basic_config
Expand Down Expand Up @@ -169,8 +171,16 @@ def test_load_states_by_steps(self):
--resume_from_checkpoint {os.path.join(self.tmpdir, "step_2")}
""".split()
output = run_command(self._launch_args + testargs, return_stdout=True)
self.assertNotIn("epoch 0:", output)
self.assertIn("epoch 1:", output)
if torch.cuda.is_available():
num_processes = torch.cuda.device_count()
else:
num_processes = 1
if num_processes > 1:
self.assertNotIn("epoch 0:", output)
self.assertIn("epoch 1:", output)
else:
self.assertIn("epoch 0:", output)
self.assertIn("epoch 1:", output)

@slow
def test_cross_validation(self):
Expand Down

0 comments on commit 015f228

Please sign in to comment.