Skip to content

Commit

Permalink
test: update the lib of bf16 (#34043)
Browse files Browse the repository at this point in the history
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
  • Loading branch information
zhuwenxing committed Jun 21, 2024
1 parent e653ad2 commit 03a5f7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tests/restful_client_v2/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ pytest-xdist==2.5.0
minio==7.1.14
tenacity==8.1.0
# for bf16 datatype
jax==0.4.13
jaxlib==0.4.13
ml-dtypes==0.2.0
4 changes: 2 additions & 2 deletions tests/restful_client_v2/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import string
from faker import Faker
import numpy as np
import jax.numpy as jnp
from ml_dtypes import bfloat16
from sklearn import preprocessing
import base64
import requests
Expand Down Expand Up @@ -191,7 +191,7 @@ def gen_bf16_vectors(num, dim):
for _ in range(num):
raw_vector = [random.random() for _ in range(dim)]
raw_vectors.append(raw_vector)
bf16_vector = np.array(jnp.array(raw_vector, dtype=jnp.bfloat16)).view(np.uint8).tolist()
bf16_vector = np.array(raw_vector, dtype=bfloat16).view(np.uint8).tolist()
bf16_vectors.append(bytes(bf16_vector))

return raw_vectors, bf16_vectors
Expand Down

0 comments on commit 03a5f7e

Please sign in to comment.