Skip to content

Commit 62c17d8

Browse files
authored
Merge pull request #275 from jamestran201/patch-1
Small fixes to Advanced RAG cookbook
2 parents 06d9d36 + bae525f commit 62c17d8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

notebooks/en/advanced_rag.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"\n",
2929
"In this notebook, we will take a look into many of these blue notes to see how to tune your RAG system and get the best performance.\n",
3030
"\n",
31-
"__Let's dig into the model building!__ First, we install the required model dependancies."
31+
"__Let's dig into the model building!__ First, we install the required model dependencies."
3232
]
3333
},
3434
{
@@ -39,7 +39,7 @@
3939
},
4040
"outputs": [],
4141
"source": [
42-
"!pip install -q torch transformers transformers accelerate bitsandbytes langchain sentence-transformers faiss-cpu openpyxl pacmap datasets langchain-community ragatouille"
42+
"!pip install -q torch transformers accelerate bitsandbytes langchain sentence-transformers faiss-cpu openpyxl pacmap datasets langchain-community ragatouille"
4343
]
4444
},
4545
{
@@ -272,7 +272,7 @@
272272
"👀 As you can see, __the chunk lengths are not aligned with our limit of 512 tokens__, and some documents are above the limit, thus some part of them will be lost in truncation!\n",
273273
" - So we should change the `RecursiveCharacterTextSplitter` class to count length in number of tokens instead of number of characters.\n",
274274
" - Then we can choose a specific chunk size, here we would choose a lower threshold than 512:\n",
275-
" - smaller documents could allow the split to focus more on specific ideas.\n",
275+
" - Smaller documents could allow the split to focus more on specific ideas.\n",
276276
" - But too small chunks would split sentences in half, thus losing meaning again: the proper tuning is a matter of balance."
277277
]
278278
},

notebooks/en/rag_evaluation.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"outputs": [],
4545
"source": [
46-
"!pip install -q torch transformers transformers langchain sentence-transformers tqdm openpyxl openai pandas datasets langchain-community ragatouille"
46+
"!pip install -q torch transformers langchain sentence-transformers tqdm openpyxl openai pandas datasets langchain-community ragatouille"
4747
]
4848
},
4949
{
@@ -366,7 +366,7 @@
366366
"\n",
367367
"We thus build critique agents that will rate each question on several criteria, given in [this paper](https://huggingface.co/papers/2312.10003):\n",
368368
"- **Groundedness:** can the question be answered from the given context?\n",
369-
"- **Relevance:** is the question relevant to users? For instance, `\"What is the date when transformers 4.29.1 was released?\"` is not relevant for ML practicioners.\n",
369+
"- **Relevance:** is the question relevant to users? For instance, `\"What is the date when transformers 4.29.1 was released?\"` is not relevant for ML practitioners.\n",
370370
"\n",
371371
"One last failure case we've noticed is when a function is tailored for the particular setting where the question was generated, but undecipherable by itself, like `\"What is the name of the function used in this guide?\"`.\n",
372372
"We also build a critique agent for this criteria:\n",
@@ -426,12 +426,12 @@
426426
"\n",
427427
"question_standalone_critique_prompt = \"\"\"\n",
428428
"You will be given a question.\n",
429-
"Your task is to provide a 'total rating' representing how context-independant this question is.\n",
429+
"Your task is to provide a 'total rating' representing how context-independent this question is.\n",
430430
"Give your answer on a scale of 1 to 5, where 1 means that the question depends on additional information to be understood, and 5 means that the question makes sense by itself.\n",
431431
"For instance, if the question refers to a particular setting, like 'in the context' or 'in the document', the rating must be 1.\n",
432432
"The questions can contain obscure technical nouns or acronyms like Gradio, Hub, Hugging Face or Space and still be a 5: it must simply be clear to an operator with access to documentation what the question is about.\n",
433433
"\n",
434-
"For instance, \"What is the name of the checkpoint from which the ViT model is imported?\" should receive a 1, since there is an implicit mention of a context, thus the question is not independant from the context.\n",
434+
"For instance, \"What is the name of the checkpoint from which the ViT model is imported?\" should receive a 1, since there is an implicit mention of a context, thus the question is not independent from the context.\n",
435435
"\n",
436436
"Provide your answer as follows:\n",
437437
"\n",
@@ -804,7 +804,7 @@
804804
"source": [
805805
"Now our synthetic evaluation dataset is complete! We can evaluate different RAG systems on this evaluation dataset.\n",
806806
"\n",
807-
"We have generated only a few QA couples here to reduce time and cost. But let's kick start the next part by loading a pre-generated dataset:"
807+
"We have generated only a few QA couples here to reduce time and cost. But let's kickstart the next part by loading a pre-generated dataset:"
808808
]
809809
},
810810
{
@@ -1123,7 +1123,7 @@
11231123
"source": [
11241124
"# 3. Benchmarking the RAG system\n",
11251125
"\n",
1126-
"The RAG system and the evaluation datasets are now ready. The last step is to judge the RAG system's output on this evlauation dataset.\n",
1126+
"The RAG system and the evaluation datasets are now ready. The last step is to judge the RAG system's output on this evaluation dataset.\n",
11271127
"\n",
11281128
"To this end, __we setup a judge agent__. ⚖️🤖\n",
11291129
"\n",
@@ -1427,7 +1427,7 @@
14271427
"## Example results\n",
14281428
"\n",
14291429
"Let us load the results that I obtained by tweaking the different options available in this notebook.\n",
1430-
"For more detail on why these options could work on not, see the notebook on [advanced_RAG](advanced_rag).\n",
1430+
"For more detail on why these options could work or not, see the notebook on [advanced_RAG](advanced_rag).\n",
14311431
"\n",
14321432
"As you can see in the graph below, some tweaks do not bring any improvement, some give huge performance boosts.\n",
14331433
"\n",

0 commit comments

Comments
 (0)