@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / e5043a3e75
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 17, 03:00 UTC

[Misc] Add pytest marker to opt-out of global test cleanup (#3863)

Cade Daniel committed Apr 4, 2024 at 21:54 UTC e5043a3e7505aefc59636f7df129dc168da4a7d2
3 files changed +11 -4
tests/conftest.py
+5 -1
@@ -56,11 +56,15 @@ def cleanup():
56
57
58 @pytest.fixture()
59 -def should_do_global_cleanup_after_test() -> bool:
59 +def should_do_global_cleanup_after_test(request) -> bool:
60 """Allow subdirectories to skip global cleanup by overriding this fixture.
61 This can provide a ~10x speedup for non-GPU unit tests since they don't need
62 to initialize torch.
63 """
64 +
65 + if request.node.get_closest_marker("skip_global_cleanup"):
66 + return False
67 +
68 return True
69
70
tests/spec_decode/test_batch_expansion.py
+3
@@ -7,6 +7,7 @@ from .utils import create_seq_group_metadata_from_prompts, mock_worker
7
8
9 @pytest.mark.parametrize('num_target_seq_ids', [100])
10 +@pytest.mark.skip_global_cleanup
11 def test_create_target_seq_id_iterator(num_target_seq_ids: int):
12 """Verify all new sequence ids are greater than all input
13 seq ids.
@@ -27,6 +28,7 @@ def test_create_target_seq_id_iterator(num_target_seq_ids: int):
28
29
30 @pytest.mark.parametrize('k', [1, 2, 6])
31 +@pytest.mark.skip_global_cleanup
32 def test_get_token_ids_to_score(k: int):
33 """Verify correct tokens are selected for scoring.
34 """
@@ -53,6 +55,7 @@ def test_get_token_ids_to_score(k: int):
55
56
57 @pytest.mark.parametrize('k', [1, 2, 6])
58 +@pytest.mark.skip_global_cleanup
59 def test_create_single_target_seq_group_metadata(k: int):
60 """Verify correct creation of a batch-expanded seq group metadata.
61 """
tests/spec_decode/test_spec_decode_worker.py
+3 -3
@@ -487,7 +487,7 @@ def test_empty_input_batch(k: int, batch_size: int):
487 **execute_model_data.to_dict())
488
489
490 -@torch.inference_mode()
490 +@pytest.mark.skip_global_cleanup
491 def test_init_device():
492 """Verify SpecDecodeWorker invokes proposer/scorer worker init_device, as
493 well as other GPU initialization.
@@ -537,7 +537,7 @@ def test_init_cache_engine():
537 @pytest.mark.parametrize('available_cpu_blocks', [500])
538 @pytest.mark.parametrize('target_cache_block_size_bytes', [2 * 2 * 4096])
539 @pytest.mark.parametrize('draft_kv_size_bytes', [0, 2 * 2 * 768, 2 * 2 * 4096])
540 -@torch.inference_mode()
540 +@pytest.mark.skip_global_cleanup
541 def test_profile_num_available_blocks(available_gpu_blocks: int,
542 available_cpu_blocks: int,
543 target_cache_block_size_bytes: int,
@@ -584,7 +584,7 @@ def test_profile_num_available_blocks(available_gpu_blocks: int,
584 @pytest.mark.parametrize('target_cache_block_size_bytes',
585 [2 * 2 * 4096, 2 * 2 * 8192])
586 @pytest.mark.parametrize('draft_kv_size_bytes', [0, 2 * 2 * 768, 2 * 2 * 4096])
587 -@torch.inference_mode()
587 +@pytest.mark.skip_global_cleanup
588 def test_split_num_cache_blocks_evenly(available_gpu_blocks: int,
589 target_cache_block_size_bytes: int,
590 draft_kv_size_bytes: int):