forked from vllm-project/vllm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into min-new-tokens
* upstream/main: [Misc] Bump up transformers to v4.39.0 & Remove StarCoder2Config (vllm-project#3551) [Misc][Log] Add log for tokenizer length not equal to vocabulary size (vllm-project#3500) [🚀 Ready to be merged] Added support for Jais models (vllm-project#3183) Fix 1D query issue from `_prune_hidden_states` (vllm-project#3539) [PREFIX CACHING FOLLOW UP] OrderedDict-based evictor (vllm-project#3431) [BugFix] Hot fix in setup.py for neuron build (vllm-project#3537) Migrate `logits` computation and gather to `model_runner` (vllm-project#3233) [1/n][Chunked Prefill] Refactor input query shapes (vllm-project#3236) [1/n] Triton sampling kernel (vllm-project#3186) [Bugfix] Fix ROCm support in CMakeLists.txt (vllm-project#3534)
- Loading branch information
Showing
71 changed files
with
2,856 additions
and
687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import torch | ||
import pytest | ||
import random | ||
|
||
from vllm.model_executor.layers.ops.rand import seeded_uniform | ||
from vllm.model_executor.utils import set_random_seed | ||
|
||
|
||
@pytest.mark.parametrize("dtype", | ||
[torch.float32, torch.float16, torch.bfloat16]) | ||
@pytest.mark.parametrize("use_3d", [True, False]) | ||
def test_seeded_uniform(dtype: torch.dtype, use_3d: bool): | ||
device = "cuda" | ||
for seed in range(512): | ||
set_random_seed(seed) | ||
rows = random.randint(1, 512) | ||
cols = random.randint(1, 64000) | ||
if use_3d: | ||
third_dim = random.randint(2, 10) | ||
dims = [rows, third_dim, cols] | ||
else: | ||
dims = [rows, cols] | ||
seeds = torch.randint(torch.iinfo(torch.long).min, | ||
torch.iinfo(torch.long).max, (rows, ), | ||
device=device) | ||
|
||
# Test that the same seed produces the same output | ||
out = seeded_uniform(*dims, seeds=seeds, dtype=dtype, device=device) | ||
out2 = seeded_uniform(*dims, seeds=seeds, dtype=dtype, device=device) | ||
torch.testing.assert_close(out, out2) | ||
# del to save memory | ||
del out2 | ||
|
||
out3 = seeded_uniform(*dims, seeds=seeds, dtype=dtype, device=device) | ||
torch.testing.assert_close(out, out3) | ||
# del to save memory | ||
del out3 | ||
|
||
# Initialize out tensor with garbage to ensure that it is overwritten | ||
out_with_tensor = seeded_uniform( | ||
*dims, | ||
out=torch.full( | ||
(*dims, ), | ||
-1, | ||
dtype=dtype, | ||
device=device, | ||
), | ||
seeds=seeds, | ||
dtype=dtype, | ||
) | ||
torch.testing.assert_close(out, out_with_tensor) |
Oops, something went wrong.