[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
@@ -64,6 +64,13 @@ def tensor2base64(x: torch.Tensor) -> str:
|
||||
return pybase64.b64encode(binary_data).decode("utf-8")
|
||||
|
||||
|
||||
def numpy2base64(array: np.ndarray) -> str:
|
||||
"""Encode a NumPy array using its `.npy` representation."""
|
||||
with io.BytesIO() as buffer:
|
||||
np.save(buffer, array, allow_pickle=False)
|
||||
return pybase64.b64encode(buffer.getbuffer()).decode("ascii")
|
||||
|
||||
|
||||
def tensor2binary(
|
||||
tensor: torch.Tensor,
|
||||
embed_dtype: "EmbedDType | MmMetadataDType",
|
||||
|
||||
Reference in New Issue
Block a user