-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: fp32 vector to fp16/bf16 vector conversion for RESTful API #37556
feat: fp32 vector to fp16/bf16 vector conversion for RESTful API #37556
Conversation
033d02f
to
b990bae
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #37556 +/- ##
=======================================
Coverage 81.04% 81.05%
=======================================
Files 1358 1358
Lines 190438 190526 +88
=======================================
+ Hits 154334 154423 +89
+ Misses 30628 30626 -2
- Partials 5476 5477 +1
|
@jiangyinzuo E2e jenkins job failed, comment |
b990bae
to
13cec0b
Compare
41dc76b
to
43c1181
Compare
@jiangyinzuo go-sdk check failed, comment |
@jiangyinzuo E2e jenkins job failed, comment |
69831ba
to
a900400
Compare
@jiangyinzuo E2e jenkins job failed, comment |
a900400
to
bd88e93
Compare
bd88e93
to
8b004b8
Compare
@jiangyinzuo E2e jenkins job failed, comment |
e8c2f3c
to
53b5480
Compare
@jiangyinzuo E2e jenkins job failed, comment |
/run-cpu-e2e |
/lgtm |
/lgtm |
// unmarshal []float32 first to make sure `[3, 3]` is []float instead of []byte | ||
var float32Array []float32 | ||
err := json.Unmarshal([]byte(vectorStr), &float32Array) | ||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance of a false positive occurring here?
// try to unmarshal as [][]float32 first to make sure `[[3, 3]]` is [][]float32 instead of [][]byte | ||
fp32Values := make([][]float32, 0) | ||
err := json.Unmarshal([]byte(vectorStr), &fp32Values) | ||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance of a false positive occurring here?
the performance here is likely to deteriorate, isn't it?
@czs007 I added a micro-benchmark at Run benchmarks at go test -bench=BenchmarkSerialize -run=^$
The key to performance improvement lies in reducing the number of |
3ff7f84
to
b6ae5e9
Compare
2c28e76
to
febe188
Compare
Make the Milvus server support the conversion from fp32 to fp16/bf16, so as to facilitate the client users who have difficulties in handling fp16/bf16 conversions. 1. The influenced RESTful API are as follows: - Handler. insert - HandlerV1. insert/upsert - HandlerV2. insert/upsert/search We do not modify search API in Handler/HandlerV1 because they do not support fp16/bf16 vectors. 2. Add micro-benchmarks for various vector serialization methods. 3. Module github.com/milvus-io/milvus/pkg. Add `Float32ArrayToBFloat16Bytes()`, `Float32ArrayToFloat16Bytes()` and `Float32ArrayToBytes()`. These method will be used in GoSDK in the future. issue: milvus-io#37448 Signed-off-by: Yinzuo Jiang <[email protected]> Signed-off-by: Yinzuo Jiang <[email protected]>
@jiangyinzuo E2e jenkins job failed, comment |
@jiangyinzuo cpp-unit-test check failed, comment |
@jiangyinzuo go-sdk check failed, comment |
/run-cpu-e2e |
rerun cpp-unit-test |
rerun go-sdk |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: czs007, jiangyinzuo, zhuwenxing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
RESTful API. The influenced API are as follows:
We do not modify search API in Handler/HandlerV1 because they do not support fp16/bf16 vectors.
module github.com/milvus-io/milvus/pkg:
Add
Float32ArrayToBFloat16Bytes()
,Float32ArrayToFloat16Bytes()
andFloat32ArrayToBytes()
. These method will be used in GoSDK in thefuture.
issue: #37448