add documentation for serializer function (#8769)

Description: Added necessary documentation for serializer functions

@baskaryan
pull/8772/head
Bal Narendra Sapa 1 year ago committed by GitHub
parent affaaea87b
commit bd61757423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -249,6 +249,36 @@
"docs[0]"
]
},
{
"cell_type": "markdown",
"id": "30c8f57b",
"metadata": {},
"source": [
"# Serializing and De-Serializing to bytes\n",
"\n",
"you can pickle the FAISS Index by these functions. If you use embeddings model which is of 90 mb (sentence-transformers/all-MiniLM-L6-v2 or any other model), the resultant pickle size would be more than 90 mb. the size of the model is also included in the overall size. To overcome this, use the below functions. These functions only serializes FAISS index and size would be much lesser. this can be helpful if you wish to store the index in database like sql."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d8faead5",
"metadata": {},
"outputs": [],
"source": [
"pkl = db.serialize_to_bytes() # serializes the faiss index"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e36e220b",
"metadata": {},
"outputs": [],
"source": [
"db = FAISS.deserialize_from_bytes(pkl) # Load the index"
]
},
{
"cell_type": "markdown",
"id": "57da60d4",
@ -491,7 +521,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.9.17"
}
},
"nbformat": 4,

Loading…
Cancel
Save