Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 multiprocessing | |
import tempfile | |
import time | |
from pathlib import Path | |
from urllib.request import urlretrieve | |
import h5py | |
from qdrant_client import QdrantClient | |
from qdrant_client.conversions.common_types import VectorParams | |
from qdrant_client.http.models import Distance, SearchRequest |
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
from qdrant_client import QdrantClient | |
from qdrant_client.conversions.common_types import VectorParams | |
client = QdrantClient("localhost", 6333) | |
client.recreate_collection( | |
collection_name="test_collection", | |
vectors_config=VectorParams(size=4, distance=Distance.EUCLID), | |
) |
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
vectors = [ | |
[.1, .0, .0, .0], | |
[.0, .1, .0, .0], | |
[.0, .0, .1, .0], | |
[.0, .0, .0, .1], | |
[.1, .0, .1, .0], | |
[.0, .1, .0, .1], | |
[.1, .1, .0, .0], | |
[.0, .0, .1, .1], | |
[.1, .1, .1, .1], |
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
results = client.search_batch( | |
collection_name="test_collection", | |
requests=[ | |
SearchRequest( | |
vector=[0., 0., 2., 0.], | |
limit=1, | |
), | |
SearchRequest( | |
vector=[0., 0., 0., 0.01], | |
with_vector=True, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from qdrant_client import QdrantClient | |
from qdrant_client.http.models import VectorParams, Distance | |
client = QdrantClient() | |
client.recreate_collection( | |
collection_name="multiple_vectors", | |
vectors_config={ | |
"title": VectorParams( | |
size=100, | |
distance=Distance.EUCLID, |
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
client.recreate_collection( | |
collection_name="single_vector", | |
vectors_config=VectorParams( | |
size=100, | |
distance=Distance.COSINE, | |
) | |
) |
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
from datasets import load_dataset | |
dataset = load_dataset("ChristophSchuhmann/MS_COCO_2017_URL_TEXT") |
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 pandas as pd | |
dataset_df = pd.DataFrame(dataset["train"]) |
OlderNewer