Skip to content

Conversation

jackcook
Copy link
Contributor

@jackcook jackcook commented May 20, 2025

When using prompt_tokens_max (and not using prompt_tokens_stdev), there will occasionally be one token more than the maximum number specified. This can be tested as follows:

from guidellm.utils import IntegerRangeSampler

MIN_VALUE = 5
MAX_VALUE = 15

irs = IntegerRangeSampler(average=(MAX_VALUE - MIN_VALUE) // 2, variance=None, min_value=MIN_VALUE, max_value=MAX_VALUE, random_seed=None)
it = iter(irs)

for _ in range(10000):
    assert next(it) != 16

The assertion will fire, despite the max being set to 15. This happens because random.randint, which is used by IntegerRangeSampler, generates numbers up to and including the max value it is given. This PR fixes that.

Copy link
Collaborator

@markurtz markurtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @jackcook!

@markurtz markurtz merged commit b85c6b9 into vllm-project:main May 21, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants