Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some modules not found in advanced RAG notebook when running in Colab #120

Closed
sergiopaniego opened this issue Jun 14, 2024 · 0 comments · Fixed by #121
Closed

Some modules not found in advanced RAG notebook when running in Colab #120

sergiopaniego opened this issue Jun 14, 2024 · 0 comments · Fixed by #121

Comments

@sergiopaniego
Copy link
Contributor

In the Advanced RAG on Hugging Face documentation using LangChain example, when running it on Colab, it generates some errors due to missing dependencies.

These dependencies are:

  • datasets
  • langchain-community
  • ragatouille

All of them are used through the notebook but not installed previously.

The errors are thrown in:

  • datasets:
from tqdm.notebook import tqdm
import pandas as pd
from typing import Optional, List, Tuple
from datasets import Dataset
import matplotlib.pyplot as plt

pd.set_option(
    "display.max_colwidth", None
)  # This will be helpful when visualizing retriever outputs
  • langchain-community :
from langchain.vectorstores import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.vectorstores.utils import DistanceStrategy

embedding_model = HuggingFaceEmbeddings(
    model_name=EMBEDDING_MODEL_NAME,
    multi_process=True,
    model_kwargs={"device": "cuda"},
    encode_kwargs={"normalize_embeddings": True},  # Set `True` for cosine similarity
)

KNOWLEDGE_VECTOR_DATABASE = FAISS.from_documents(
    docs_processed, embedding_model, distance_strategy=DistanceStrategy.COSINE
)
  • ragatouille
from ragatouille import RAGPretrainedModel

RERANKER = RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant