-
Notifications
You must be signed in to change notification settings - Fork 161
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
update hippo client #283
Open
ybtsdst
wants to merge
3
commits into
zilliztech:main
Choose a base branch
from
ybtsdst:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
update hippo client #283
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false | ||
|
||
[Dockerfile*] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 4 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python: Streamlit", | ||
"type": "debugpy", | ||
"request": "launch", | ||
"module": "streamlit", | ||
"args": [ | ||
"run", | ||
"vectordb_bench/frontend/vdb_benchmark.py", | ||
"--logger.level", | ||
"info", | ||
"--theme.base", | ||
"light", | ||
"--theme.primaryColor", | ||
"#3670F2", | ||
"--theme.secondaryBackgroundColor", | ||
"#F0F2F6", | ||
], | ||
"subProcess": true, | ||
"justMyCode": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"[python]": { | ||
"editor.formatOnSave": false, | ||
// "editor.codeActionsOnSave": { | ||
// "source.fixAll": "always", | ||
// "source.organizeImports": "always" | ||
// }, | ||
"editor.defaultFormatter": "charliermarsh.ruff" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "build vectordb bench", | ||
"type": "shell", | ||
"command": "python", | ||
"args": [ | ||
"-m", | ||
"pip", | ||
"install", | ||
"-e", | ||
".[test]" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
} | ||
}, | ||
{ | ||
"label": "run vectordb bench", | ||
"type": "shell", | ||
"command": "init_bench", | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from pydantic import BaseModel, Field, SecretStr | ||
from transwarp_hippo_api.hippo_type import IndexType | ||
from transwarp_hippo_api.hippo_type import MetricType as HippoMetricType | ||
|
||
from ..api import DBCaseConfig, DBConfig, MetricType | ||
|
||
|
||
class HippoConfig(DBConfig): | ||
ip: SecretStr = "" | ||
port: SecretStr = "18902" | ||
username: SecretStr = "shiva" | ||
password: SecretStr = "shiva" | ||
number_of_shards: int = Field(default=1, ge=1) | ||
number_of_replicas: int = Field(default=1, ge=1) | ||
insert_batch_size: int = Field(default=100, ge=1) | ||
|
||
def to_dict(self) -> dict: | ||
return { | ||
"host_port": [ | ||
f"{self.ip.get_secret_value()}:{self.port.get_secret_value()}" | ||
], | ||
"username": self.username.get_secret_value(), | ||
"pwd": self.password.get_secret_value(), | ||
"number_of_shards": self.number_of_shards, | ||
"number_of_replicas": self.number_of_replicas, | ||
"insert_batch_size": self.insert_batch_size, | ||
} | ||
|
||
|
||
class HippoIndexConfig(BaseModel, DBCaseConfig): | ||
index: IndexType = IndexType.HNSW # HNSW, FLAT, IVF_FLAT, IVF_SQ, IVF_PQ, ANNOY | ||
metric_type: MetricType | None = None | ||
M: int = 30 # [4,96] | ||
ef_construction: int = 360 # [8, 512] | ||
ef_search: int = 100 # [topk, 32768] | ||
nlist: int = 1024 # [1,65536] | ||
nprobe: int = 64 # [1, nlist] | ||
m: int = 16 # divisible by dim | ||
nbits: int = 8 # [1, 16] | ||
k_factor: int = 100 # [10, 1000] | ||
|
||
def parse_metric(self) -> HippoMetricType: | ||
if self.metric_type == MetricType.COSINE: | ||
return HippoMetricType.COSINE | ||
if self.metric_type == MetricType.IP: | ||
return HippoMetricType.IP | ||
if self.metric_type == MetricType.L2: | ||
return HippoMetricType.L2 | ||
return "" | ||
|
||
def index_param(self) -> dict: | ||
return { | ||
"M": self.M, | ||
"ef_construction": self.ef_construction, | ||
"ef_search": self.ef_search, | ||
"nlist": self.nlist, | ||
"nprobe": self.nprobe, | ||
"m": self.m, | ||
"nbits": self.nbits, | ||
} | ||
|
||
def search_param(self) -> dict: | ||
return { | ||
"ef_search": self.ef_search, | ||
"nprobe": self.nprobe, | ||
"k_factor": self.k_factor, | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
each file should end with a newline, same for other files.