Running the Command
Before using the test tool, download the Python package using the following command. All dependencies are listed in /data/ann-benchmarks-main/requirements.txt.
pip install -r requirements.txt
To avoid prolonged index creation, set the timeout parameter in the create_index function in milvus/module.py.
- Open the file.
1/data/ann-benchmarks-main/ann_benchmarks/milvus/module.py
- Change the value of the timeout parameter. The unit is second.
1 2 3 4 5 6
self.collection.create_index( field_name = "vector", index_params = self.get_index_param(), index_name = "vector_index", timeout = 7200 )
Use the Milvus-HNSW algorithm to search the gist-960-euclidean dataset locally and immediately obtain all queries, ignoring existing results.
1 | python run.py --algorithm milvus-hnsw --batch --threads 1 --local --force --dataset gist-960-euclidean |
The query result is stored in an .hdf5 file. For details, see the command format and execution method in Checking Results.
After data is imported and an index is created for the first time, you can comment out the code for importing data and creating an index in milvus/module.py to reuse the data. In this case, the recall rates keep the same in multiple tests.
Open the file.
1 | /data/ann-benchmarks-main/ann_benchmarks/algorithms/milvus/module.py |
The code to be commented out is as follows:
1 2 3 | if utility.has_collection(self.collection_name): print(f"[Milvus] collection {self.collection_name} already exists, drop it...") utility.drop_collection(self.collection_name) |
1 2 | self.insert(X) self.create_index() |
1 | utility.drop_collection(self.collection_name) |