MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / test_sampler

Function test_sampler

tests/layers/test_sampler.py:131–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129
130
131def test_sampler():
132 batch_size = 32
133 vocab_size = 1024
134 min_seq_len = 1
135 max_seq_len = 1024
136
137 sampler = Sampler(get_fd_config(batch_size))
138 logits = _create_fake_logits(batch_size, vocab_size)
139 sampling_metadata = _create_default_sampling_metadata(batch_size, min_seq_len, max_seq_len)
140 next_tokens = sampler(logits, sampling_metadata)
141 print(next_tokens)
142
143
144def get_baseline_logprobs(logits, sampling_metadata, logprobs_mode, token_ids):

Callers 1

test_sampler.pyFile · 0.85

Calls 5

SamplerClass · 0.90
printFunction · 0.85
get_fd_configFunction · 0.70
_create_fake_logitsFunction · 0.70

Tested by

no test coverage detected