Created
June 8, 2021 23:13
-
-
Save generall/ee915ab8aaa1e50c8e88d139b62f009a to your computer and use it in GitHub Desktop.
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
import numpy as np | |
import json | |
fd = open('./startups.json') | |
# payload is now an iterator over startup data | |
payload = map(json.loads, fd) | |
# Here we load all vectors into memory, numpy array works as iterable for itself. | |
# Other option would be to use Mmap, if we don't want to load all data into RAM | |
vectors = np.load('./startup_vectors.npy') | |
# And the final step - data uploading | |
qdrant_client.upload_collection( | |
collection_name='startups', | |
vectors=vectors, | |
payload=payload, | |
ids=None, # Vector ids will be assigned automatically | |
batch_size=256 # How many vectors will be uploaded in a single request? | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment