Skip to content

Commit f71c1b6

Browse files
Code refactoring
Signed-off-by: Daniel Korzekwa <[email protected]>
1 parent 9753b8d commit f71c1b6

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

tests/experimental/torch/_compress/nas/plugins/test_nas_convert.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ def test_nas_convert(project_root_path: Path, tmp_path: Path):
4848
def _test_nas_convert_multiprocess_job(
4949
project_root_path: Path, tmp_path: Path, rank: int, size: int
5050
):
51-
runtime = NativeDdpRuntime(
51+
with NativeDdpRuntime(
5252
dtype=torch.bfloat16, torch_distributed_timeout=datetime.timedelta(10)
53-
)
54-
55-
with runtime as runtime:
53+
) as runtime:
5654
converted_model, puzzle_dir = run_nas_convert(project_root_path, tmp_path, rank, runtime)
5755

5856
#

tests/experimental/torch/_compress/nas/plugins/test_nas_search.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ def test_nas_search(project_root_path: Path, tmp_path: Path):
4040
def _test_nas_search_multiprocess_job(
4141
project_root_path: Path, tmp_path: Path, rank: int, size: int
4242
):
43-
runtime = NativeDdpRuntime(
43+
with NativeDdpRuntime(
4444
dtype=torch.bfloat16, torch_distributed_timeout=datetime.timedelta(10)
45-
)
46-
47-
with runtime as runtime:
45+
) as runtime:
4846
converted_model, puzzle_dir = run_nas_convert(project_root_path, tmp_path, rank, runtime)
4947

5048
#

0 commit comments

Comments
 (0)