Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiyiXia committed Jan 16, 2025
1 parent 20caa7d commit 7a41570
Show file tree
Hide file tree
Showing 21 changed files with 8,633 additions and 736 deletions.
4 changes: 3 additions & 1 deletion docs/source/tutorial/1_Embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
1_Embedding/1.1.1
1_Embedding/1.2.1
1_Embedding/1.2.2
1_Embedding/1.2.3
1_Embedding/1.2.3
1_Embedding/1.2.4
1_Embedding/1.2.5
34 changes: 27 additions & 7 deletions docs/source/tutorial/1_Embedding/1.1.1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@
"%pip install -U FlagEmbedding sentence_transformers openai cohere"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import os \n",
"os.environ['TRANSFORMERS_NO_ADVISORY_WARNINGS'] = 'true'\n",
"# single GPU is better for small tasks\n",
"os.environ['CUDA_VISIBLE_DEVICES'] = '0'"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -92,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -138,19 +150,27 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"initial target device: 100%|██████████| 8/8 [00:31<00:00, 3.89s/it]\n",
"Chunks: 100%|██████████| 3/3 [00:04<00:00, 1.61s/it]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Embeddings:\n",
"(3, 768)\n",
"Similarity scores:\n",
"[[1. 0.7900386 0.57525384]\n",
" [0.7900386 0.9999998 0.59190154]\n",
" [0.57525384 0.59190154 0.99999994]]\n"
"[[1. 0.79 0.575 ]\n",
" [0.79 0.9995 0.592 ]\n",
" [0.575 0.592 0.999 ]]\n"
]
}
],
Expand Down Expand Up @@ -373,7 +393,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "base",
"display_name": "dev",
"language": "python",
"name": "python3"
},
Expand All @@ -387,7 +407,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 7a41570

Please sign in to comment.