Skip to content

Always initialize dist #864

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

Merged
merged 3 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion tests/a_scripts/eval/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def test_icl_eval(eval_cfg: Union[om.ListConfig, om.DictConfig], capfd: Any,
assert expected_results in out


@pytest.mark.gpu
def test_loader_eval(capfd: Any, mock_saved_model_path: Any,
tmp_path: pathlib.Path):

Expand Down
6 changes: 1 addition & 5 deletions tests/fixtures/autouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@
@pytest.fixture(autouse=True)
def initialize_dist(request: pytest.FixtureRequest):
"""Initialize the default PyTorch distributed process group for tests."""
# should we just always initialize dist like in train.py?
_default = pytest.mark.world_size(1).mark
world_size = request.node.get_closest_marker('world_size', _default).args[0]
gpu = request.node.get_closest_marker('gpu')
if world_size > 1:
dist.initialize_dist(get_device('gpu' if gpu is not None else 'cpu'))
dist.initialize_dist(get_device('gpu' if gpu is not None else 'cpu'))


@pytest.fixture(autouse=True)
Expand Down