Skip to content

Commit c56d926

Browse files
committed
refactor: simplify test_trtllm_sampler by removing unused test_case fixture
- Removed the test_case fixture and its associated JSON loading, simplifying the test setup. - Hardcoded sampling parameters for clarity and consistency in the test execution. Signed-off-by: Robin Kobus <[email protected]>
1 parent ae9261c commit c56d926

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

tests/unittest/_torch/sampler/test_trtllm_sampler.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import json
2-
from pathlib import Path
3-
41
import pytest
52
from utils.llm_data import llm_models_root
63
from utils.util import similar
@@ -10,15 +7,6 @@
107
from tensorrt_llm.llmapi import KvCacheConfig as TRT_KvCacheConfig
118

129

13-
# A test case of mmlu_llama from lm_eval
14-
@pytest.fixture(scope="module")
15-
def test_case():
16-
with open(
17-
Path(__file__).parent.parent / "executor" /
18-
"test_overlap_scheduler_input.json") as f:
19-
return json.load(f)
20-
21-
2210
@pytest.fixture(scope="module")
2311
def model_path():
2412
return llm_models_root() / "llama-models-v2/TinyLlama-1.1B-Chat-v1.0"
@@ -41,7 +29,7 @@ def create_llm(model_dir):
4129

4230

4331
@pytest.mark.high_cuda_memory
44-
def test_trtllm_sampler(model_path, test_case):
32+
def test_trtllm_sampler(model_path):
4533
prompts = [
4634
"Magellan and Elcano lead the first",
4735
"The capital of France is",
@@ -52,10 +40,10 @@ def test_trtllm_sampler(model_path, test_case):
5240
["La Paz"]]
5341

5442
# Test configuration
55-
max_new_tokens = test_case["max_new_tokens"]
56-
temperature = test_case["temperature"]
57-
top_p = test_case["top_p"]
58-
stop_words = test_case["stop_words"]
43+
max_new_tokens = 10
44+
temperature = 1.0
45+
top_p = None
46+
stop_words = ["."]
5947

6048
sampling_config = SamplingParams(max_tokens=max_new_tokens,
6149
n=1,

0 commit comments

Comments
 (0)