Skip to content
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

[WIP]sparse-quantizer #374

Conversation

Roxanne0321
Copy link

Implemented SparseQuantizer and SparseComputer classes, and completed functions such as sparse vector inner product calculation

ShawnShawnYou and others added 2 commits January 13, 2025 20:59
Signed-off-by: zhongxiaoyao.zxy <zhongxiaoyao.zxy@antgroup.com>
@pull-request-size pull-request-size bot added size/L and removed size/XL labels Feb 6, 2025
@ShawnShawnYou ShawnShawnYou changed the title first [WIP]sparse-quantizer Feb 11, 2025
}

inline void
ComputeDist(uint32_t u, float* dists) {//u是quant中存储的第u个稀疏向量
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

computer and quantizer only consider compute distance from code to code, don't consider the storage


bool
SparseQuantizer::InsertAll(const SparseVectors& sv) {
// 首先释放旧的内存
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, for test the quantizer, this func of code can be moved to sparse_quantizer_test

}

inline float Compute(int32_t nnz1, const uint32_t* ids1, const float* vals1,
int32_t nnz2, const uint32_t* ids2, const float* vals2) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement encode and decode

inline void
SparseQuantizer::ComputeDist(SparseComputer& computer, uint32_t u, float* dists) const {

if (u >= num_) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reuse code in L130


inline float
SparseQuantizer::ComputeDist(SparseComputer& computer, uint32_t u) const {

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

}

inline void
SparseQuantizer::ProcessQuery(int32_t nnz, const uint32_t* ids, const float* vals, SparseComputer& computer) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement in Encode

@ShawnShawnYou ShawnShawnYou deleted the branch antgroup:support-sparse-dataset February 21, 2025 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants