Skip to content

Commit

Permalink
Remove inline outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
NirantK committed Mar 6, 2024
1 parent 8a3b746 commit 0dec22d
Showing 1 changed file with 18 additions and 150 deletions.
168 changes: 18 additions & 150 deletions docs/examples/Hindi_Tamil_RAG_with_Navrsasa7B.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,7 @@
"id": "aAfdPG15j2U_",
"outputId": "c457a5dd-bccb-4b56-8c7f-878dfc94884d"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[32m2024-03-06 07:36:40.285\u001b[0m | \u001b[33m\u001b[1mWARNING \u001b[0m | \u001b[36mfastembed.embedding\u001b[0m:\u001b[36m<module>\u001b[0m:\u001b[36m7\u001b[0m - \u001b[33m\u001b[1mDefaultEmbedding, FlagEmbedding, JinaEmbedding are deprecated.Use from fastembed import TextEmbedding instead.\u001b[0m\n"
]
}
],
"outputs": [],
"source": [
"from datasets import load_dataset\n",
"from fastembed import TextEmbedding\n",
Expand Down Expand Up @@ -74,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 63,
"execution_count": null,
"metadata": {
"id": "1xh1P9z5kAxd"
},
Expand All @@ -97,29 +89,15 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "x-AkWw420GgW",
"outputId": "460de1e2-aa4d-4dde-cf1d-abb38288bc97"
},
"outputs": [
{
"data": {
"text/plain": [
"Dataset({\n",
" features: ['id', 'context', 'question', 'answer_text', 'answer_start', 'language'],\n",
" num_rows: 1114\n",
"})"
]
},
"execution_count": 72,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"ds"
]
Expand Down Expand Up @@ -159,22 +137,7 @@
"id": "e1FzPDS6j2VA",
"outputId": "3d69a566-0c67-45f9-b768-e0c498863d95"
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8dbaa1a6fdcf4b4d805a94c8cce564eb",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Fetching 9 files: 0%| | 0/9 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"embedding_model = TextEmbedding(model_name=embedding_model)"
]
Expand All @@ -190,7 +153,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
Expand All @@ -212,22 +175,7 @@
"id": "zst575Z6j2VA",
"outputId": "9237546c-7ca0-479b-9cf9-4396ccc15dc7"
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d5a4726255f24bef914841e541a03a30",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Loading checkpoint shards: 0%| | 0/4 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"model = AutoPeftModelForCausalLM.from_pretrained(\n",
" model_id,\n",
Expand Down Expand Up @@ -278,18 +226,7 @@
"id": "X3qnhlyll3dT",
"outputId": "b496f5b4-219a-45fe-8df4-8869d9c6c4e0"
},
"outputs": [
{
"data": {
"text/plain": [
"768"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"len(context_embeddings[0])"
]
Expand Down Expand Up @@ -331,18 +268,7 @@
"id": "QvuRKZCSmJTc",
"outputId": "bd528f49-b3af-4da5-9a80-124b8ce93b80"
},
"outputs": [
{
"data": {
"text/plain": [
"768"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"len(context_points[0].vector)"
]
Expand All @@ -366,18 +292,7 @@
"id": "TkfZxG1gkQ_k",
"outputId": "5c190152-ee40-487c-8aef-858cd5bdccf9"
},
"outputs": [
{
"data": {
"text/plain": [
"UpdateResult(operation_id=0, status=<UpdateStatus.COMPLETED: 'completed'>)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"search_client = QdrantClient(\":memory:\")\n",
"\n",
Expand All @@ -395,15 +310,7 @@
"id": "ORNuYzuOm2tH",
"outputId": "bddb668c-434f-43ad-f773-9bbdc5383612"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"महाराजा अग्रसेन के पिता कौन थे?\n"
]
}
],
"outputs": [],
"source": [
"idx = 997\n",
"\n",
Expand All @@ -414,34 +321,23 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "F5TDUjpTvtnX",
"outputId": "1105b324-b698-4b07-9af5-12394e69fb6e"
},
"outputs": [
{
"data": {
"text/plain": [
"11464"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"search_context_text = search_context[0].payload[\"text\"]\n",
"len(search_context_text)"
]
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": null,
"metadata": {
"id": "FwT2njapj2VA"
},
Expand Down Expand Up @@ -472,7 +368,7 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
Expand All @@ -481,28 +377,14 @@
"id": "jXw3aILgvMdp",
"outputId": "fe73260c-26c4-49c9-819b-24aa50c090ad"
},
"outputs": [
{
"data": {
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
},
"text/plain": [
"'महाराजा अग्रसेन के पिता महाराजा वल्लभ सेन थे।'"
]
},
"execution_count": 70,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"response.split(sep=\"### Answer:\")[-1].strip('<eos>').strip()"
]
},
{
"cell_type": "code",
"execution_count": 73,
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
Expand All @@ -511,21 +393,7 @@
"id": "DKeqAZEm0C0u",
"outputId": "44780197-c7fa-496e-e166-3512321f527d"
},
"outputs": [
{
"data": {
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
},
"text/plain": [
"'महाराजा वल्लभ सेन'"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"ds[idx]['answer_text']"
]
Expand Down

0 comments on commit 0dec22d

Please sign in to comment.