[Frontend] Add routed-experts prompt offset (#51906)
Signed-off-by: aoshen02 <aoshen@inferact.ai> Co-authored-by: OpenAI Codex <codex@openai.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
OpenAI Codex
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
f3c1638927
commit
7553aac77b
@@ -1,5 +1,9 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
import io
|
||||
|
||||
import numpy as np
|
||||
import pybase64
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
@@ -12,6 +16,7 @@ from vllm.utils.serial_utils import (
|
||||
Endianness,
|
||||
MmMetadataDType,
|
||||
binary2tensor,
|
||||
numpy2base64,
|
||||
tensor2binary,
|
||||
)
|
||||
|
||||
@@ -19,6 +24,17 @@ FLOAT_EMBED_DTYPES = tuple(EMBED_DTYPES.keys())
|
||||
INTEGER_EMBED_DTYPES = tuple(MM_METADATA_DTYPES.keys())
|
||||
|
||||
|
||||
def test_numpy2base64_round_trip():
|
||||
array = np.arange(24, dtype=np.uint8).reshape(2, 3, 4)
|
||||
|
||||
decoded = np.load(
|
||||
io.BytesIO(pybase64.b64decode(numpy2base64(array))),
|
||||
allow_pickle=False,
|
||||
)
|
||||
|
||||
np.testing.assert_array_equal(decoded, array)
|
||||
|
||||
|
||||
def _build_integer_tensor(
|
||||
embed_dtype: MmMetadataDType, shape: tuple[int, ...]
|
||||
) -> torch.Tensor:
|
||||
|
||||
Reference in New Issue
Block a user