Comments (3)
Test script:
import random
import time
import numpy as np
from pymilvus import (
connections,
FieldSchema, CollectionSchema, DataType,
Collection,
utility,
)
HOST = 'localhost'
PORT = '19530'
connections.connect(host=HOST, port=PORT)
F16_COLLECTION = "f16_col"
DIM = 768
METRIC_TYPE = "L2"
ID_FIELD = "id"
VECTOR_FIELD = "vector"
def gen_fp16_vectors(num):
raw_vectors = []
fp16_vectors = []
for _ in range(num):
raw_vector = [random.random() for _ in range(DIM)]
raw_vectors.append(raw_vector)
fp16_vector = np.array(raw_vector, dtype=np.float16)
fp16_vectors.append(fp16_vector)
return raw_vectors, fp16_vectors
def create_collection():
if utility.has_collection(F16_COLLECTION):
utility.drop_collection(F16_COLLECTION)
fields = [
FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True),
FieldSchema(name="vector", dtype=DataType.FLOAT16_VECTOR, dim=DIM),
]
schema = CollectionSchema(fields=fields)
collection = Collection(name=F16_COLLECTION, schema=schema)
print(f"Collection '{F16_COLLECTION}' created")
def prepare_data():
collection_16 = Collection(name=F16_COLLECTION)
count = 10000
for i in range(100):
raw_vectors, fp16_vectors = gen_fp16_vectors(count)
collection_16.insert(data=[
fp16_vectors,
])
print(f"insert batch {i}")
print("insert done")
time.sleep(5)
collection_16.flush()
print("flush done")
start = time.time()
index_params = {
'metric_type': METRIC_TYPE,
'index_type': "HNSW",
'params': {"M": 8, "efConstruction": 200},
}
collection_16.create_index(field_name=VECTOR_FIELD, index_params=index_params)
utility.wait_for_index_building_complete(collection_name=F16_COLLECTION)
print("index done")
end = time.time()
print(f"fp16 index time cost: {end-start} seconds")
if __name__ == '__main__':
create_collection()
prepare_data()
from milvus.
/assign @cqy123456
/unassign
from milvus.
/assign @yhmo
use latest 2.4 to try, fp16 and bf16 add simd support in latest 2.4.
from milvus.
Related Issues (20)
- [Bug]: Before exiting, make sure the goroutine has exited HOT 1
- [Bug]: err has degenerated into a new variable, which cannot be captured in defer. HOT 1
- [Bug]: Vector Search() bug HOT 7
- [Feature]: Partial load collection at field/column level
- [Bug]: querynode got restarted during test after indexcoord pod kill chaos test HOT 1
- [Bug]: Data race when clustering compaction HOT 1
- [Bug]: sparse column is sealed before append batch in mmap mode HOT 1
- [Bug]: Only one queryNode performs the loading job when the index_type is DISKANN. HOT 12
- [Bug]: Unable to load the collection HOT 19
- [Enhancement]: Enable to backup and restore rbac meta info HOT 1
- [Bug]: err cannot be captured in defer in data_sync_service HOT 1
- [Bug]: The password can contain`: `separators, which may cause errors when parsing the token as user+password. HOT 4
- [Bug]: panic in internal/flushcommon/util/timetick_sender.go HOT 2
- [Enhancement]: Add index task number for standalone milvus
- [Bug]: [benchmark][standalone] load collection raise error `collection not loaded` HOT 6
- [Feature]: Support Range Search Pagination Retain Order so No Duplication when using Different Offset HOT 3
- [Enhancement]: Enable ReadOnly/ReadWrite/Admin Privilege Group HOT 1
- [Enhancement]: improve bitset performance for AVX512
- [Bug]: querynode restarts due to `SIGSEGV: segmentation violation` after etcd follower pod failure chaos test HOT 9
- Why don't I have a GPU_IVF_FLAT in here HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milvus.