Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbed2fa7

Browse files
committed
reduce tests
Signed-off-by: Yibin Li <109242046+yibinl-nvidia@users.noreply.github.com>
1 parentb78bc41 commitbed2fa7

File tree

1 file changed

+1
-93
lines changed

1 file changed

+1
-93
lines changed

‎tests/unittest/_torch/executor/test_chunked_logits.py‎

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,9 @@ def sample_logits():
2020
returntorch.randn(1,1,1000,device='cuda')
2121

2222

23-
@pytest.fixture
24-
defchunked_request():
25-
"""Create LlmRequest with chunked logits enabled"""
26-
returnLlmRequest(request_id=100,
27-
max_new_tokens=10,
28-
input_tokens=[1,2,3],
29-
sampling_config=SamplingConfig(),
30-
is_streaming=False,
31-
return_generation_logits=True,
32-
use_chunked_generation_logits=True,
33-
logits_chunk_size=4)
34-
35-
36-
@pytest.fixture
37-
defnon_chunked_request():
38-
"""Create LlmRequest with chunked logits disabled"""
39-
returnLlmRequest(request_id=101,
40-
max_new_tokens=10,
41-
input_tokens=[1,2,3],
42-
sampling_config=SamplingConfig(),
43-
is_streaming=False,
44-
return_generation_logits=True,
45-
use_chunked_generation_logits=False)
46-
47-
4823
classTestLogitsStorage:
4924
"""Unit tests for LogitsStorage class"""
5025

51-
deftest_initialization(self):
52-
"""Test LogitsStorage initialization with different parameters"""
53-
# Test basic initialization
54-
storage=LogitsStorage(seq_length=10,
55-
use_device_memory=True,
56-
should_exclude_last=False,
57-
use_chunked_generation_logits=False,
58-
chunk_size=8)
59-
60-
assertstorage.seq_length==10
61-
assertstorage.use_device_memoryisTrue
62-
assertstorage._should_exclude_lastisFalse
63-
assertstorage.use_chunked_generation_logitsisFalse
64-
assertstorage.chunk_size==8
65-
assertstorage._logits_indices== []
66-
assertstorage.beam_width==-1
67-
assertstorage.vocab_size==-1
68-
6926
deftest_initialization_chunked_mode(self):
7027
"""Test LogitsStorage initialization in chunked mode"""
7128
storage=LogitsStorage(seq_length=10,
@@ -79,23 +36,6 @@ def test_initialization_chunked_mode(self):
7936
assertstorage._device_fragments== []
8037
assertstorage._current_position==0
8138

82-
deftest_append_3d_logits(self,sample_logits):
83-
"""Test appending 3D logits"""
84-
storage=LogitsStorage(seq_length=10,
85-
use_chunked_generation_logits=False)
86-
storage.append(sample_logits)
87-
88-
assertstorage.beam_width==1
89-
assertstorage.vocab_size==1000
90-
91-
deftest_append_invalid_shape(self):
92-
"""Test appending logits with invalid shape"""
93-
storage=LogitsStorage(seq_length=10,
94-
use_chunked_generation_logits=False)
95-
96-
withpytest.raises(AssertionError):
97-
storage.append(torch.randn(1000))# 1D - should fail
98-
9939
deftest_append_chunked_mode_streaming(self,sample_logits):
10040
"""Test append behavior in chunked streaming mode"""
10141
storage=LogitsStorage(seq_length=10,
@@ -145,17 +85,6 @@ def test_finalize_chunked_transfer_non_chunked_mode(self):
14585
# Should not raise any errors
14686
storage.finalize_chunked_transfer()
14787

148-
deftest_storage_overflow(self,sample_logits):
149-
"""Test storage overflow handling"""
150-
storage=LogitsStorage(seq_length=2,
151-
use_chunked_generation_logits=False)
152-
storage.append(sample_logits)
153-
storage.append(sample_logits)
154-
155-
# This should cause overflow
156-
withpytest.raises(ValueError,match="LogitsStorage overflow"):
157-
storage.append(sample_logits)
158-
15988

16089
classTestPyResult:
16190
"""Unit tests for PyResult class"""
@@ -202,27 +131,6 @@ def test_transfer_remaining_device_logits(self, sample_logits):
202131

203132
# Should not raise errors
204133

205-
deftest_context_generation_logits_property(self,sample_logits):
206-
"""Test context_logits property"""
207-
result=PyResult(prompt_len=5,
208-
max_new_tokens=10,
209-
return_context_logits=True,
210-
return_generation_logits=True,
211-
use_chunked_generation_logits=False)
212-
213-
result.append_context_logits(sample_logits)
214-
context_logits=result.context_logits
215-
216-
assertcontext_logitsisnotNone
217-
assertcontext_logits.shape== (1,1000)# Should remove beam dimension
218-
219-
result.append_generation_logits(sample_logits)
220-
generation_logits=result.generation_logits
221-
222-
assertgeneration_logitsisnotNone
223-
assertgeneration_logits.shape== (1,1,1000
224-
)# Should transpose dimensions
225-
226134

227135
classTestLlmRequest:
228136
"""Unit tests for LlmRequest class"""
@@ -251,7 +159,7 @@ def test_initialization_chunked_logits(self):
251159
assertrequest_streaming.py_logits_chunk_size==1# 1 in streaming mode
252160

253161

254-
classTestChunkedLogitsIntegration:
162+
classTestChunkedLogitsComplicated:
255163
"""Integration tests for chunked logits functionality"""
256164

257165
deftest_chunked_vs_non_chunked_equivalence(self,sample_logits):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp