Merge pull request #31 from qdrant/fix-defaults

Consistent Default to v1.5
This commit is contained in:
Nirant
2023-10-18 20:56:28 +05:30
committed by GitHub
3 changed files with 27 additions and 43 deletions

View File

@@ -38,18 +38,11 @@
"id": "b61c6552",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([384])\n"
"(384,)\n"
]
}
],
@@ -64,9 +57,9 @@
" \"This is an example document.\",\n",
" \"fastembed is supported by and maintained by Qdrant.\",\n",
"]\n",
"# Initialize the DefaultEmbedding class with the desired parameters\n",
"embedding_model = DefaultEmbedding(model_name=\"BAAI/bge-small-en\", max_length=512)\n",
"embeddings: List[np.ndarray] = embedding_model.embed(documents)\n",
"# Initialize the DefaultEmbedding class\n",
"embedding_model = DefaultEmbedding()\n",
"embeddings: List[np.ndarray] = list(embedding_model.embed(documents))\n",
"print(embeddings[0].shape)"
]
},
@@ -97,7 +90,7 @@
"source": [
"from typing import List\n",
"import numpy as np\n",
"from fastembed.embedding import DefaultEmbedding as Embedding"
"from fastembed.embedding import DefaultEmbedding"
]
},
{
@@ -171,20 +164,12 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"id": "8013eee9",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.\n"
]
}
],
"outputs": [],
"source": [
"embeddings: List[np.ndarray] = embedding_model.embed(documents)"
"embeddings: List[np.ndarray] = list(embedding_model.embed(documents))"
]
},
{
@@ -197,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"id": "0d8c8e08",
"metadata": {},
"outputs": [
@@ -205,7 +190,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"torch.Size([384])\n"
"(384,)\n"
]
}
],

File diff suppressed because one or more lines are too long

View File

@@ -403,7 +403,7 @@ class FlagEmbedding(Embedding):
def __init__(
self,
model_name: str = "BAAI/bge-small-en",
model_name: str = "BAAI/bge-small-en-v1.5",
max_length: int = 512,
cache_dir: str = None,
threads: int = None,